mirror of
https://codeberg.org/scip/jaildk.git
synced 2025-12-18 13:11:02 +01:00
- simplified main switch statement
- status displays exposed ip of vnet jail
This commit is contained in:
37
jaildk
37
jaildk
@@ -1219,7 +1219,7 @@ jaildk_jail() {
|
|||||||
bold "Running jails:"
|
bold "Running jails:"
|
||||||
|
|
||||||
(
|
(
|
||||||
echo "Jail IP-Address Path Is-Running Build-Mounted Current-Version Base"
|
echo "Jail IP-Address Path Is-Running RW-mounted Current-Version Base"
|
||||||
grep -h "name=" $j/etc/*/jail.conf | cut -d= -f2 | while read jail; do
|
grep -h "name=" $j/etc/*/jail.conf | cut -d= -f2 | while read jail; do
|
||||||
jid=''
|
jid=''
|
||||||
ip=''
|
ip=''
|
||||||
@@ -1227,7 +1227,18 @@ jaildk_jail() {
|
|||||||
runs=''
|
runs=''
|
||||||
build='no'
|
build='no'
|
||||||
base=''
|
base=''
|
||||||
|
|
||||||
load-jail-config $jail
|
load-jail-config $jail
|
||||||
|
|
||||||
|
_eip=''
|
||||||
|
for map in $maps; do
|
||||||
|
eval _eip=\${map_${map}_exposed_ip}
|
||||||
|
if test -n "${_eip}"; then
|
||||||
|
# we only display the first exposed ip we find, if any
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if jls -j $jail > /dev/null 2>&1; then
|
if jls -j $jail > /dev/null 2>&1; then
|
||||||
# jail is running
|
# jail is running
|
||||||
eval `jls -j $jail -qn | perl -n -e 'chomp; %j = map { ($a,$b) = split /=/; $a=~ s/\.//g; $a => $b } split/ /; foreach (keys %j) {print "$_=$j{$_}\n"}'`
|
eval `jls -j $jail -qn | perl -n -e 'chomp; %j = map { ($a,$b) = split /=/; $a=~ s/\.//g; $a => $b } split/ /; foreach (keys %j) {print "$_=$j{$_}\n"}'`
|
||||||
@@ -1236,6 +1247,11 @@ jaildk_jail() {
|
|||||||
else
|
else
|
||||||
if test -z "$ip"; then
|
if test -z "$ip"; then
|
||||||
ip="n/a"
|
ip="n/a"
|
||||||
|
else
|
||||||
|
# ip configured
|
||||||
|
if test -n "${_eip}"; then
|
||||||
|
ip="${_eip}->${ip}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
jid="yes,jid=$jid"
|
jid="yes,jid=$jid"
|
||||||
@@ -2219,23 +2235,26 @@ fi
|
|||||||
|
|
||||||
case $runner in
|
case $runner in
|
||||||
start|stop|restart)
|
start|stop|restart)
|
||||||
|
# running jails
|
||||||
mustberoot
|
mustberoot
|
||||||
jaildk_jail $runner $*
|
jaildk_jail $runner $*
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
|
# same, w/o root
|
||||||
jaildk_jail status $*
|
jaildk_jail status $*
|
||||||
;;
|
;;
|
||||||
setup|reinstall|install|uninstall|build|blogin|clone|create|remove|rc|base|fetchports|freeze|thaw|ipfw|vnet)
|
|
||||||
mustberoot
|
|
||||||
jaildk_$runner $*
|
|
||||||
;;
|
|
||||||
login)
|
login)
|
||||||
|
# login into jail as non root user allowed
|
||||||
|
# eventually calls sudo
|
||||||
jaildk_login $*
|
jaildk_login $*
|
||||||
;;
|
;;
|
||||||
help)
|
|
||||||
usage_help $*
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
usage_jaildk $*
|
# every other management command, if it exists
|
||||||
|
if type "jaildk_$runner" 2> /dev/null; then
|
||||||
|
mustberoot
|
||||||
|
jaildk_$runner $*
|
||||||
|
else
|
||||||
|
usage_jaildk $*
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user