Skip to content

Instantly share code, notes, and snippets.

@ikorolev93
Last active August 29, 2015 14:06
Show Gist options
  • Save ikorolev93/9d0ab5a82faf416cce91 to your computer and use it in GitHub Desktop.
Save ikorolev93/9d0ab5a82faf416cce91 to your computer and use it in GitHub Desktop.
portage squashfs updater (server part)
#!/bin/sh
LOG=$(mktemp)
(
set -e
mkdir -p /home/dnt/portage
cd /home/dnt/portage
wget -N --ignore-length http://mirrors.digitalocean.com/gentoo/snapshots/portage-latest.tar.xz
if [ ! -s portage-latest.tar.xz ]; then exit 0; fi
tar -xJpf portage-latest.tar.xz
mksquashfs portage portage-latest.sqfs -comp xz -force-uid 250 -force-gid 250 -noappend
rm -rf portage
touch -r portage-latest.tar.xz timestamp
truncate -s 0 portage-latest.tar.xz
touch -r timestamp portage-latest.tar.xz
rm timestamp
) >$LOG 2>&1
[ $? -ne 0 ] && cat $LOG
rm $LOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment