#!/usr/local/bin/bash # Copyright (c) 2018-2020, diyIT.org # All rights reserved. # # BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License") # https://diyit.org/license/ # # 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 "rm -rf /var/tmp/temproot*" iocage exec $JAIL "mergemaster -a" 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 pkgp-only 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 "cd /usr/src && make -j8 buildkernel KERNCONF=diyIT && make -j8 installkernel KERNCONF=diyIT" echo "reboot" echo "pkg-static upgrade -f" echo "mergemaster"