FreeBSD/jails/jails-update-pkgs.sh
Sharad Ahlawat 90c5709862 .
2021-04-01 01:23:14 -07:00

104 lines
2.6 KiB
Bash
Executable File

#!/usr/local/bin/bash
# Copyright (c) 2018-2021, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
pkg_jail="pj122"
pkg_repo="pkgp122"
if [[ $1 == "pkgp-skip" ]]; then
echo "skipping pkgp update"
else
iocage exec pkgp "pkg update"
iocage exec pkgp "pkg upgrade -y"
iocage exec pkgp "pkg clean -ay"
iocage set securelevel=0 pkgp
iocage exec pkgp "poudriere jail -l"
iocage exec pkgp "poudriere jail -u -j $pkg_jail"
iocage set securelevel=2 pkgp
iocage exec pkgp "portsnap auto"
iocage exec pkgp "poudriere ports -l"
iocage exec pkgp "poudriere ports -u"
iocage exec pkgp "poudriere bulk -f /mnt/config/mypkgs -j $pkg_jail"
fi
if [[ $1 == "pkgp-only" ]]; then
exit
fi
#read -p "Return/Enter to continue, ctrl-c to abort? " RESP
#for i in `iocage list -h | cut -f 2`;
for i in `jls -N | cut -d " " -f 2 | cut -d "-" -f 2- | grep -v JID | sort`;
do
echo "######## ## JAIL:::: $i ##"
if [[ $i == "pkgp" || $i == "debian" ]]; then
continue
fi
iocage exec $i "pkg update"
if [[ $i == "ldap" || $i == "r-ldap" ]]; then
iocage exec $i "pkg unlock -y openldap-sasl-server"
iocage exec $i "pkg unlock -y openldap-sasl-client"
iocage exec $i "pkg upgrade -y -r $pkg_repo openldap-sasl-server openldap-sasl-client"
iocage exec $i "pkg lock -y openldap-sasl-server"
iocage exec $i "pkg lock -y openldap-sasl-client"
fi
if [[ $i == "atm" || $i == "hub" || $i == "mail" || $i == "web" ]]; then
iocage exec $i "pkg unlock -y openldap-sasl-client"
iocage exec $i "pkg upgrade -y -r $pkg_repo openldap-sasl-client"
iocage exec $i "pkg lock -y openldap-sasl-client"
fi
iocage exec $i "pkg autoremove -y"
iocage exec $i "pkg upgrade -y"
iocage exec $i "pkg clean -ay"
echo "######## ####"
#read -p "continue, ctrl-c to abort? " RESP
done
cd /mnt/ship/ldap/phpLDAPadmin
pwd
git pull
cd /mnt/ship/r-ldap/phpLDAPadmin
pwd
git pull
cd /mnt/ship/book/calibre-web
pwd
git pull
cd /mnt/ship/plex/PlexConnect
pwd
git pull
cd /mnt/ship/maps/networkmaps
pwd
git pull
echo "NOTES:"
echo ""
echo "update base system by running:"
echo "pkg update"
echo "pkg autoremove -y"
echo "pkg upgrade -y"
echo "pkg clean -ay"
echo ""
echo "# iocage stop ALL"
echo "# iocage start ALL"
echo "iocage restart -s ALL"
echo ""
echo "check hub for index.html and adminer version"
echo ""
echo "iocage exec cert \"/root/.acme.sh/acme.sh --upgrade\""
echo "iocage exec cert \"/mnt/config/backup.sh\""
echo ""
echo "iocage exec hass \"/mnt/config/hass-upgrade.sh\""