Last active
January 26, 2017 09:38
-
-
Save PieterScheffers/7e245ca05269a5dc0481 to your computer and use it in GitHub Desktop.
FreeBSD - find updates script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# for finding changes in UPDATING | |
PKGQUERY=`pkg query %t | sort | tail -n1` | |
echo "####################################" | |
echo "# Updating ports collection (Host) #" | |
echo "####################################" | |
portsnap fetch update | |
echo " " | |
echo "#####################################" | |
echo "# Updating ports collection (Jails) #" | |
echo "#####################################" | |
ezjail-admin update -P | |
echo " " | |
echo "################################" | |
echo "# Programs with updates (Host) #" | |
echo "################################" | |
portmaster -L | grep New | cut -d: -f2 | tr -d " " | |
echo " " | |
echo "#################################" | |
echo "# Programs with updates (Jails) #" | |
echo "#################################" | |
jls | grep -v JID | tr -s " " | cut -d' ' -f2 | xargs -I {} sh -c 'echo {} && jexec -U root {} portmaster -L | grep New | cut -d: -f2 && jexec -U root {} sh ~/check_updates.sh' | |
echo " " | |
echo "###### List Jails ###############" | |
jls | |
echo " " | |
echo "Start jail console with: 'ezjail-admin console <Hostname>'" | |
echo "To install: 'portmaster -ydbg --no-confirm <ports>'" | |
echo " " | |
echo "###### Contents of UPDATING since last update ###############" | |
UPDATE=`date -r $PKGQUERY "+%Y%m%d"` | |
AWKCMD="awk -F':' '\$2 < "$UPDATE" { print \$1 }'" | |
LINE=`grep -n -E '^[0-9]{8}' /usr/ports/UPDATING | eval $AWKCMD | head -n1` | |
CONTENTS=`head -n$LINE /usr/ports/UPDATING` | |
echo "$CONTENTS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment