mirror of
https://codeberg.org/scip/jaildk.git
synced 2025-12-16 20:21:05 +01:00
Added a NO_BOLD option to disable bold text manually, also suppressed some error messages by rcorder and ls if local-etc/rc.d is not present inside the jail
This commit is contained in:
53
jaildk
53
jaildk
@@ -70,15 +70,19 @@ err () {
|
||||
}
|
||||
|
||||
bold() {
|
||||
if [ -z "$BOLD_ON" ]; then
|
||||
BOLD_ON=`tput -T ${TERM:-cons25} md`
|
||||
export BOLD_ON
|
||||
BOLD_OFF=`tput -T ${TERM:-cons25} me`
|
||||
export BOLD_OFF
|
||||
if [ -z "$NO_BOLD" ]; then
|
||||
if [ -z "$BOLD_ON" ]; then
|
||||
BOLD_ON=`tput -T ${TERM:-cons25} md`
|
||||
export BOLD_ON
|
||||
BOLD_OFF=`tput -T ${TERM:-cons25} me`
|
||||
export BOLD_OFF
|
||||
fi
|
||||
echo -n "$BOLD_ON"
|
||||
echo "$@"
|
||||
echo -n "$BOLD_OFF"
|
||||
else
|
||||
echo "$@"
|
||||
fi
|
||||
echo -n "$BOLD_ON"
|
||||
echo "$@"
|
||||
echo -n "$BOLD_OFF"
|
||||
}
|
||||
|
||||
fin() {
|
||||
@@ -1053,13 +1057,14 @@ jaildk_jail() {
|
||||
|
||||
get_rc_scripts() {
|
||||
jail="$1"
|
||||
jailpath=`get_jail_path $jail`
|
||||
|
||||
files=$(ls $j/run/$jail/usr/local/etc/rc.d/* $j/run/$jail/etc/rc.d/*)
|
||||
files=$(ls $j/run/$jailpath/usr/local/etc/rc.d/* $j/run/$jailpath/etc/rc.d/* 2>/dev/null)
|
||||
|
||||
rcorder $files | while read SCRIPT; do
|
||||
rcorder $files 2>/dev/null | while read SCRIPT; do
|
||||
rcvar=`egrep "^rcvar=" $SCRIPT | cut -d= -f2 | sed 's/"//g' | tail -1`
|
||||
if egrep -iq "^${rcvar}=.*yes" $j/run/$jail/usr/local/etc/rc.conf; then
|
||||
echo $SCRIPT | sed "s|$j/run/$jail||"
|
||||
if egrep -iq "^${rcvar}=.*yes" $j/run/$jailpath/usr/local/etc/rc.conf; then
|
||||
echo $SCRIPT | sed "s|$j/run/$jailpath||"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1096,19 +1101,25 @@ jaildk_rc() {
|
||||
if ! jls | egrep -q "${jail}"; then
|
||||
die "Jail $jail is not running."
|
||||
fi
|
||||
|
||||
|
||||
rcs=`get_rc_scripts $jail`
|
||||
|
||||
jid=`get_jid $jail`
|
||||
jailpath=`get_jail_path $jail`
|
||||
if test $rcd = "all"; then
|
||||
bold "Jail $jail rc status:"
|
||||
if [ "$jail" == "$jailpath" ]; then
|
||||
bold "Jail $jail rc status:"
|
||||
else
|
||||
bold "Jail $jail/$jailpath rc status:"
|
||||
fi
|
||||
for script in $rcs; do
|
||||
jexec $jail $script $mode
|
||||
jexec $jid $script $mode
|
||||
done
|
||||
else
|
||||
ok=''
|
||||
for script in $rcs; do
|
||||
if echo "$script" | egrep -q "/${rcd}\$"; then
|
||||
jexec $jail $script $mode
|
||||
jexec $jid $script $mode
|
||||
ok=1
|
||||
fi
|
||||
done
|
||||
@@ -1119,6 +1130,16 @@ jaildk_rc() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_jail_path() {
|
||||
jail="$1"
|
||||
echo "$(jls |grep -E "^ +[0-9]+ +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ *${jail} +" | awk '{print $4}' | xargs basename)"
|
||||
}
|
||||
|
||||
get_jid() {
|
||||
jail="$1"
|
||||
echo "$(jls | grep -E "^ +[0-9]+ +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ *${jail} +" | awk '{print $1}' | xargs basename)"
|
||||
}
|
||||
|
||||
usage_blogin() {
|
||||
err "Usage: $file <jail>
|
||||
Chroot into a build jail.
|
||||
|
||||
Reference in New Issue
Block a user