mirror of
https://codeberg.org/scip/jaildk.git
synced 2025-12-18 13:11:02 +01:00
various:
- start ldconfig ONLY in build+start mode - added rcoff union mount to avoid accidentally starting jails inside the build chroot
This commit is contained in:
49
jaildk
49
jaildk
@@ -111,9 +111,46 @@ jaildk_build() {
|
|||||||
base=`ls $j/base | tail -1`
|
base=`ls $j/base | tail -1`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# install the jail to build/
|
||||||
jaildk_install $jail all $mode rw $base $version
|
jaildk_install $jail all $mode rw $base $version
|
||||||
|
|
||||||
ex chroot $j/build/$jail /etc/rc.d/ldconfig onestart
|
case $mode in
|
||||||
|
start)
|
||||||
|
# make it usable
|
||||||
|
ex chroot $j/build/$jail /etc/rc.d/ldconfig onestart
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
jaildk_rc_rcoff() {
|
||||||
|
# avoid starting services inside the build chroot
|
||||||
|
jail=$1
|
||||||
|
mode=$2
|
||||||
|
rw=$3
|
||||||
|
rcscript=rcoff
|
||||||
|
|
||||||
|
if test -n "$rw"; then
|
||||||
|
# not required in run mode
|
||||||
|
case $mode in
|
||||||
|
start)
|
||||||
|
if ! test -d $j/etc/rcoff; then
|
||||||
|
# in order to be backwards compatible to older jaildk
|
||||||
|
# create the rcoff directory on the fly
|
||||||
|
mkdir -d $j/etc/rcoff
|
||||||
|
( echo "#!/bin/sh"
|
||||||
|
echo 'echo "$0 disabled in build chroot!"' ) > $j/etc/rcoff/rc
|
||||||
|
fi
|
||||||
|
|
||||||
|
ex mount -t unionfs $j/etc/rcoff $j/build/$jail/etc
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
# might fail if executed on a yet not union'ed etc
|
||||||
|
if mount | egrep -q "rcoff.*build/$jail"; then
|
||||||
|
ex umount $j/build/$jail/etc
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
jaildk_rc_ports() {
|
jaildk_rc_ports() {
|
||||||
@@ -274,7 +311,7 @@ jaildk_install_usage() {
|
|||||||
err "Usage: $0 install <jail> [[<rc.d-script>] <start|stop|restart|status>]"
|
err "Usage: $0 install <jail> [[<rc.d-script>] <start|stop|restart|status>]"
|
||||||
err "If <rc.d-script> is 'all' every script will be executed in rc-order."
|
err "If <rc.d-script> is 'all' every script will be executed in rc-order."
|
||||||
err "If <rc.d-script> is not specified, just execute all scripts with <start>."
|
err "If <rc.d-script> is not specified, just execute all scripts with <start>."
|
||||||
err "Available rc.d-scripts: $RCSCRIPTS"
|
err "Available rc.d-scripts: $RCSCRIPTS_START"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +350,10 @@ jaildk_install() {
|
|||||||
die_if_not_exist $jail
|
die_if_not_exist $jail
|
||||||
|
|
||||||
if test "$rcd" = "all"; then
|
if test "$rcd" = "all"; then
|
||||||
rcscripts="$RCSCRIPTS"
|
case $mode in
|
||||||
|
start) rcscripts="$RCSCRIPTS_START";;
|
||||||
|
stop) rcscripts="$RCSCRIPTS_STOP";;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
rcscripts="jaildk_rc_${rcd}"
|
rcscripts="jaildk_rc_${rcd}"
|
||||||
if ! type "$rcscripts" > /dev/null 2>&1; then
|
if ! type "$rcscripts" > /dev/null 2>&1; then
|
||||||
@@ -1040,7 +1080,8 @@ jaildk_fetch_ports() {
|
|||||||
JAILDIR=/jail
|
JAILDIR=/jail
|
||||||
|
|
||||||
# install modules
|
# install modules
|
||||||
RCSCRIPTS="jaildk_rc_mount jaildk_rc_ports jaildk_rc_mtree"
|
RCSCRIPTS_START="jaildk_rc_mount jaildk_rc_rcoff jaildk_rc_ports jaildk_rc_mtree"
|
||||||
|
RCSCRIPTS_STOP="jaildk_rc_rcoff jaildk_rc_mount jaildk_rc_ports jaildk_rc_mtree"
|
||||||
|
|
||||||
# globals
|
# globals
|
||||||
j=$JAILDIR
|
j=$JAILDIR
|
||||||
|
|||||||
Reference in New Issue
Block a user