FreeBSD/jails/jails-update-pkgs.sh

102 lines
2.5 KiB
Bash
Raw Normal View History

2020-05-26 21:15:31 -07:00
#!/usr/local/bin/bash
2021-02-13 11:38:38 -08:00
# Copyright (c) 2018-2021, diyIT.org
2020-02-25 11:28:31 -08:00
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
2021-02-13 11:38:38 -08:00
pkg_jail="pj122"
pkg_repo="pkgp122"
2020-02-25 11:28:31 -08:00
2020-05-26 21:15:31 -07:00
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
2020-02-25 11:28:31 -08:00
2021-02-13 11:38:38 -08:00
#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`;
2020-02-25 11:28:31 -08:00
do
2021-02-13 11:38:38 -08:00
echo "######## ## JAIL:::: $i ##"
if [[ $i == "pkgp" || $i == "debian" ]]; then
continue
2020-06-11 12:02:40 -07:00
fi
2020-05-26 21:15:31 -07:00
iocage exec $i "pkg update"
2021-02-13 11:38:38 -08:00
if [[ $i == "ldap" || $i == "r-ldap" ]]; then
2020-02-25 11:28:31 -08:00
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"
2020-02-25 11:28:31 -08:00
iocage exec $i "pkg lock -y openldap-sasl-server"
iocage exec $i "pkg lock -y openldap-sasl-client"
fi
2021-02-13 11:38:38 -08:00
if [[ $i == "atm" || $i == "hub" || $i == "mail" || $i == "web" ]]; then
2020-02-25 11:28:31 -08:00
iocage exec $i "pkg unlock -y openldap-sasl-client"
iocage exec $i "pkg upgrade -y -r $pkg_repo openldap-sasl-client"
2020-02-25 11:28:31 -08:00
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"
2021-02-13 11:38:38 -08:00
echo "######## ####"
#read -p "continue, ctrl-c to abort? " RESP
2020-02-25 11:28:31 -08:00
done
2021-02-13 11:38:38 -08:00
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:"
2020-06-11 12:02:40 -07:00
echo ""
2020-05-26 21:15:31 -07:00
echo "update base system by running:"
echo "pkg update"
echo "pkg autoremove -y"
echo "pkg upgrade -y"
echo "pkg clean -ay"
2020-06-11 12:02:40 -07:00
echo ""
2021-02-13 11:38:38 -08:00
echo "# iocage stop ALL"
echo "# iocage start ALL"
echo "iocage restart -s ALL"
2020-06-11 12:02:40 -07:00
echo ""
echo "check hub for index.html and adminer version"
echo ""
echo "iocage exec cert \"/root/.acme.sh/acme.sh --upgrade\""
2021-02-13 11:38:38 -08:00
echo "iocage exec cert \"/mnt/config/backup.sh\""