summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xezjail-admin32
1 files changed, 10 insertions, 22 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 196fea5..c1599e4 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -26,10 +26,10 @@ ezjail_procfs_enable=${ezjail_procfs_enable:-"YES"}
26ezjail_fdescfs_enable=${ezjail_fdescfs_enable:-"YES"} 26ezjail_fdescfs_enable=${ezjail_fdescfs_enable:-"YES"}
27 27
28# define our bail out shortcut 28# define our bail out shortcut
29exerr () { echo "$*"; exit 1; } 29exerr () { echo -e "$*"; exit 1; }
30 30
31# check for command 31# check for command
32[ "$1" ] || exerr "Usage: `basename -- $0` [create|delete|list|update] {params}" 32[ $1 ] || exerr "Usage: `basename -- $0` [create|delete|list|update] {params}"
33 33
34case "$1" in 34case "$1" in
35######################## ezjail-admin CREATE ######################## 35######################## ezjail-admin CREATE ########################
@@ -89,7 +89,7 @@ create)
89 fi 89 fi
90 90
91 # do some sanity checks on the selected flavour (if any) 91 # do some sanity checks on the selected flavour (if any)
92 if [ "${newjail_flavour}" ]; then 92 if [ ${newjail_flavour} ]; then
93 [ -d ${ezjail_flavours}/${newjail_flavour}/ ] || exerr "Error: Flavour config directory ${ezjail_flavours}/${newjail_flavour} not found." 93 [ -d ${ezjail_flavours}/${newjail_flavour}/ ] || exerr "Error: Flavour config directory ${ezjail_flavours}/${newjail_flavour} not found."
94 fi 94 fi
95 95
@@ -104,7 +104,7 @@ create)
104 fi 104 fi
105 105
106 # if a soft link is necessary, create it now 106 # if a soft link is necessary, create it now
107 [ "${newjail_softlink}" ] && ln -s ${newjail_root} ${newjail_softlink} 107 [ ${newjail_softlink} ] && ln -s ${newjail_root} ${newjail_softlink}
108 108
109 # if the automount feature is not disabled, this 109 # if the automount feature is not disabled, this
110 # fstab entry for new jail will be obeyed 110 # fstab entry for new jail will be obeyed
@@ -124,7 +124,7 @@ create)
124 echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} 124 echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname}
125 125
126 # Final steps for flavour installation 126 # Final steps for flavour installation
127 if [ "${newjail_flavour}" ]; then 127 if [ ${newjail_flavour} ]; then
128 # install files, packages and config to new jail 128 # install files, packages and config to new jail
129 # user creating, chown and package installation on jails startup 129 # user creating, chown and package installation on jails startup
130 cd ${ezjail_flavours}/${newjail_flavour} 130 cd ${ezjail_flavours}/${newjail_flavour}
@@ -144,18 +144,10 @@ create)
144 # check, whether some host system services do listen on the Jails IP 144 # check, whether some host system services do listen on the Jails IP
145 TIFS=${IFS}; IFS=_ 145 TIFS=${IFS}; IFS=_
146 newjail_listener=`sockstat -4 -l | grep ${newjail_ip}:[[:digit:]]` 146 newjail_listener=`sockstat -4 -l | grep ${newjail_ip}:[[:digit:]]`
147 if [ $? = 0 ]; then 147 [ $? = 0 ] && echo -e "Warning: Some services already seem to be listening on IP ${newjail_ip}\n This may cause some confusion, here they are:\n${newjail_listener}"
148 echo "Warning: Some services already seem to be listening on IP ${newjail_ip}" 148
149 echo " This may cause some confusion, here they are:"
150 echo ${newjail_listener}
151 fi
152 newjail_listener=`sockstat -4 -l | grep \*:[[:digit:]]` 149 newjail_listener=`sockstat -4 -l | grep \*:[[:digit:]]`
153 if [ $? = 0 ]; then 150 [ $? = 0 ] && echo -e "Warning: Some services already seem to be listening on all IP, (including ${newjail_ip})\nThis may cause some confusion, here they are:\n ${newjail_listener}""
154 echo "Warning: Some services already seem to be listening on all IPs."
155 echo " (including ${newjail_ip})"
156 echo " This may cause some confusion, here they are:"
157 echo ${newjail_listener}
158 fi
159 IFS=${TIFS} 151 IFS=${TIFS}
160 152
161 ;; 153 ;;
@@ -191,11 +183,7 @@ delete)
191 eval oldjail_rootdir=\"\$jail_${oldjail_nname}_rootdir\" 183 eval oldjail_rootdir=\"\$jail_${oldjail_nname}_rootdir\"
192 184
193 # if jail is still running, refuse to go any further 185 # if jail is still running, refuse to go any further
194 if [ -f /var/run/jail_${oldjail_nname}.id ]; then 186 [ -f /var/run/jail_${oldjail_nname}.id ] && exerr "Error: Jail appears to be still running, stop it first.\n(/var/run/jail_${oldjail_nname}.id exists)"
195 echo "Error: Jail appears to be still running, stop it first."
196 echo "(/var/run/jail_${oldjail_nname}.id exists)"
197 exit 1
198 fi
199 187
200 # now we know everything we need to let the jail be gone 188 # now we know everything we need to let the jail be gone
201 # remove entry from ezjail resource structure 189 # remove entry from ezjail resource structure
@@ -299,7 +287,7 @@ setup|update)
299 if [ -f ${ezjail_jailbase}/usr/ports/CVS/Root ]; then 287 if [ -f ${ezjail_jailbase}/usr/ports/CVS/Root ]; then
300 echo -n "Updating ports from "; cat ${ezjail_jailbase}/usr/ports/CVS/Root 288 echo -n "Updating ports from "; cat ${ezjail_jailbase}/usr/ports/CVS/Root
301 echo "Gathering local information may take a while." 289 echo "Gathering local information may take a while."
302 cd ${ezjail_jailbase}/usr/ports/; cvs up -Pd 290 cd ${ezjail_jailbase}/usr/ports/; cvs -d ${ezjail_portscvsroot} up -Pd
303 else 291 else
304 echo "Checking out ports from ${ezjail_portscvsroot}" 292 echo "Checking out ports from ${ezjail_portscvsroot}"
305 mkdir -p ${ezjail_jailbase}/usr/ports/ 293 mkdir -p ${ezjail_jailbase}/usr/ports/