FreeBSD/jails/update.sh
Charlie Root 2327d9d6c0 auto now hosts django apps
added devfs_rule configs for jails
configure mail ipv6 settings
windows2019 VM
2020-04-11 00:46:09 -07:00

68 lines
1.6 KiB
Bash
Executable File

# 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
update_jail ()
{
echo "######## ## JAIL:::: $JAIL ##"
## uncomment below to list and remove snapshots
#zfs list -t snapshot -o name | grep ship/iocage/jails/$JAIL | sort
#read -p "remove all $JAIL snapshots (y/N)? " RESP
#if [ ! -z $RESP ] && [ $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 instead of an update
#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 "######## ####"
}
iocage fetch -U -r 12.1-RELEASE
read -p "update pkgp jail (y/N)? " RESP
if [ ! -z $RESP ] && [ $RESP == "y" ]; then
JAIL="pkgp"
update_jail
fi
./jails-update-pkgs.sh
read -p "update all jails (y/N)? " RESP
if [ ! -z $RESP ] && [ $RESP == "y" ]; then
for JAIL in `iocage list -h | cut -f2`;
do
if [ $JAIL == "pkgp" ] || [ $JAIL == "debian"]; then
continue;
fi
update_jail
done
fi
echo "update base system by running:"
echo "freebsd-update fetch"
echo "freebsd-update install"
echo "pkg-static upgrade -f"
echo "mergemaster"