diff options
-rwxr-xr-x | ezjail-admin | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/ezjail-admin b/ezjail-admin index 6fdc750..093a755 100755 --- a/ezjail-admin +++ b/ezjail-admin | |||
@@ -81,7 +81,7 @@ create) | |||
81 | 81 | ||
82 | # if a directory at the specified jail root already exists, refuse to | 82 | # if a directory at the specified jail root already exists, refuse to |
83 | # install | 83 | # install |
84 | [ -e ${newjail_root} -a "${newjail_fill} = "YES" ] && exerr "Error: the specified jail root ${newjail_root} alread exists." | 84 | [ -e ${newjail_root} -a "${newjail_fill}" = "YES" ] && exerr "Error: the specified jail root ${newjail_root} alread exists." |
85 | 85 | ||
86 | # if jail root specified on command line does not lie within our jail | 86 | # if jail root specified on command line does not lie within our jail |
87 | # directory, we need to create a softlink | 87 | # directory, we need to create a softlink |
@@ -127,8 +127,8 @@ create) | |||
127 | # Final steps for flavour installation | 127 | # Final steps for flavour installation |
128 | if [ "${newjail_flavour}" ]; then | 128 | if [ "${newjail_flavour}" ]; then |
129 | # install files and config to new jail | 129 | # install files and config to new jail |
130 | cd ${ezjail_flavours}/${newjail_flavour} | 130 | cd ${ezjail_flavours}/${newjail_flavour} && find * | cpio -p -v ${newjail_root} > /dev/null |
131 | find * | cpio -p -v ${newjail_root} > /dev/null | 131 | [ $? = 0 ] || echo "Warning: Could not fully install flavour." |
132 | 132 | ||
133 | # If a config is found, make it auto run on jails startup | 133 | # If a config is found, make it auto run on jails startup |
134 | if [ -f ${newjail_root}/ezjail.flavour ]; then | 134 | if [ -f ${newjail_root}/ezjail.flavour ]; then |
@@ -243,18 +243,17 @@ setup|update) | |||
243 | 243 | ||
244 | # Normally fulljail should be renamed by past ezjail-admin commands. | 244 | # Normally fulljail should be renamed by past ezjail-admin commands. |
245 | # However those may have failed | 245 | # However those may have failed |
246 | chflags -R noschg ${ezjail_jailfull}; rm -rf ${ezjail_jailfull} | 246 | [ -d "${ezjail_jailfull}" ] && chflags -R noschg ${ezjail_jailfull} && rm -rf ${ezjail_jailfull} |
247 | mkdir -p ${ezjail_jailfull} | 247 | mkdir -p ${ezjail_jailfull} || exerr "Cannot create temporary Jail directory." |
248 | 248 | ||
249 | # make our world | 249 | # make our world |
250 | cd ${ezjail_sourcetree} | 250 | cd ${ezjail_sourcetree} && make ${updatejail_installaction} DESTDIR=${ezjail_jailfull} || exerr "make ${updatejail_installaction} failed." |
251 | make ${updatejail_installaction} DESTDIR=${ezjail_jailfull} || exerr "make ${updatejail_installaction} failed." | ||
252 | 251 | ||
253 | # setup world | 252 | # setup world |
254 | make distribution DESTDIR=${ezjail_jailfull} || exerr "make distribution failed." | 253 | cd ${ezjail_sourcetree}/etc && make distribution DESTDIR=${ezjail_jailfull} || exerr "make distribution failed." |
255 | 254 | ||
256 | # Fill basejail from installed world | 255 | # Fill basejail from installed world |
257 | cd ${ezjail_jailfull} | 256 | cd ${ezjail_jailfull} || exerr "Cant access temporary Jail directory." |
258 | # This mkdir is important, since cpio will create intermediate | 257 | # This mkdir is important, since cpio will create intermediate |
259 | # directories with permission 0700 which is bad | 258 | # directories with permission 0700 which is bad |
260 | mkdir -p ${ezjail_jailbase}/usr | 259 | mkdir -p ${ezjail_jailbase}/usr |
@@ -265,13 +264,7 @@ setup|update) | |||
265 | mkdir basejail | 264 | mkdir basejail |
266 | 265 | ||
267 | # Try to remove the old template jail | 266 | # Try to remove the old template jail |
268 | if [ -d ${ezjail_jailtemplate} ]; then | 267 | [ -d ${ezjail_template} ] && chflags -R noschg ${ezjail_jailtemplate} && rm -rf ${ezjail_jailtemplate} |
269 | if [ -d ${ezjail_jailtemplate}_old ]; then | ||
270 | chflags -R noschg ${ezjail_jailtemplate}_old | ||
271 | rm -rf ${ezjail_jailtemplate}_old | ||
272 | fi | ||
273 | mv ${ezjail_jailtemplate} ${ezjail_jailtemplate}_old | ||
274 | fi | ||
275 | mv ${ezjail_jailfull} ${ezjail_jailtemplate} | 268 | mv ${ezjail_jailfull} ${ezjail_jailtemplate} |
276 | 269 | ||
277 | # If the default flavour example has not yet been copied, do it now | 270 | # If the default flavour example has not yet been copied, do it now |
@@ -285,11 +278,11 @@ setup|update) | |||
285 | if [ -f ${ezjail_jailbase}/usr/ports/CVS/Root ]; then | 278 | if [ -f ${ezjail_jailbase}/usr/ports/CVS/Root ]; then |
286 | echo -n "Updating ports from "; cat ${ezjail_jailbase}/usr/ports/CVS/Root | 279 | echo -n "Updating ports from "; cat ${ezjail_jailbase}/usr/ports/CVS/Root |
287 | echo "Gathering local information may take a while." | 280 | echo "Gathering local information may take a while." |
288 | cd ${ezjail_jailbase}/usr/ports/; cvs -d ${ezjail_portscvsroot} up -Pd | 281 | cd ${ezjail_jailbase}/usr/ports/ && cvs -d ${ezjail_portscvsroot} up -Pd |
289 | else | 282 | else |
290 | echo "Checking out ports from ${ezjail_portscvsroot}" | 283 | echo "Checking out ports from ${ezjail_portscvsroot}" |
291 | mkdir -p ${ezjail_jailbase}/usr/ports/ | 284 | mkdir -p ${ezjail_jailbase}/usr/ports/ |
292 | cd ${ezjail_jailbase}/usr/; cvs -d ${ezjail_portscvsroot} co ports | 285 | cd ${ezjail_jailbase}/usr/ && cvs -d ${ezjail_portscvsroot} co ports |
293 | fi | 286 | fi |
294 | [ $? = 0 ] || exerr "Updating ports failed." | 287 | [ $? = 0 ] || exerr "Updating ports failed." |
295 | fi | 288 | fi |