FreeBSD/jails/update.sh

54 lines
1.2 KiB
Bash
Raw Normal View History

2020-02-25 11:28:31 -08:00
# Copyright (c) 2018-2020, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
#!/usr/local/bin/bash
iocage fetch -U -r 12.1-RELEASE
iocage list -l
echo update all jails?
read RESP
if [ $RESP == "y" ]; then
for JAIL in `iocage list -h | cut -f2`;
do
echo "## JAIL:::: $JAIL ##"
zfs list -t snapshot -o name | grep ship/iocage/jails/$JAIL | sort
echo remove all $JAIL snapshots?
read RESP
if [ $RESP == "y" ]; then
zfs list -t snapshot -o name | grep ship/iocage/jails/$JAIL | sort | xargs -n 1 zfs destroy
fi
iocage exec $JAIL "freebsd-version"
# uncomment below for an upgrade
#iocage upgrade -r 12.1-RELEASE $JAIL
iocage update $JAIL
iocage exec $JAIL "pkg upgrade -f -y"
iocage exec $JAIL "mergemaster"
iocage exec $JAIL "freebsd-version"
iocage exec $JAIL "pkg update -f"
iocage exec $JAIL "pkg autoremove -y"
iocage exec $JAIL "pkg upgrade -y"
iocage exec $JAIL "pkg clean -ay"
echo "####"
done
fi
echo update base system by running:
echo freebsd-update fetch
echo freebsd-update install
echo pkg-static upgrade -f
echo mergemaster