41 lines
1004 B
Bash
41 lines
1004 B
Bash
|
#!/bin/bash
|
||
|
#
|
||
|
# vhost-stack
|
||
|
# https://git.stack-source.com/msb/vhost-stack
|
||
|
# MIT License Copyright (c) 2021 Matthew Saunders Brown
|
||
|
|
||
|
# load config
|
||
|
source /usr/local/etc/vhost.conf || echo "ERROR: Either you do not have vhost user permissions or the config file is missing." && exit
|
||
|
|
||
|
# make sure jails dir exists
|
||
|
if [[ ! -e /usr/jails/ ]]; then
|
||
|
echo "/usr/jails does not exist"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# check if any jails exist
|
||
|
if [ ! "$(ls -A /usr/jails/)" ]; then
|
||
|
echo "no jails exist"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# check for /usr/sbin/jk_update
|
||
|
if [[ ! -x "/usr/sbin/jk_update" ]]; then
|
||
|
echo "/usr/sbin/jk_update does not exist or is not executable"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# get list of jails
|
||
|
cd /usr/jails/
|
||
|
jails=(*)
|
||
|
|
||
|
for jail in "${!jails[@]}"
|
||
|
do
|
||
|
jail=${jails[$jail]}
|
||
|
echo "updating $jail"
|
||
|
/usr/sbin/jk_update -j /usr/jails/$jail
|
||
|
/usr/sbin/jk_update -j /usr/jails/$jail /lib64/
|
||
|
/usr/sbin/jk_update -s /etc/passwd -s /etc/group -s /etc/ld.so.cache -j /usr/jails/$jail /etc/
|
||
|
/sbin/ldconfig.real -r /usr/jails/$jail
|
||
|
done
|