[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch: ezjail-admin "${RANDOM}" bashism fix



Hello,

here is a little patch what allows 'ezjail-admin -u' to run properly from cron.

Regards,
Panagiotis

--
Panagiotis J. Christias    Network Management Center
p.christias AT noc.ntua DOT gr    National Technical Univ. of Athens, GREECE
--- ezjail-admin.orig	2008-09-26 15:16:42.000000000 +0300
+++ ezjail-admin	2010-01-09 00:48:03.000000000 +0200
@@ -682,8 +682,11 @@
     [ -d "${ezjail_jailbase}" ] || exerr "Error: base jail does not exist.\n  You cannot update a base jail until it is created.\n  Please run '${ezjail_admin} update' or '${ezjail_admin} install' first."
     
     # If ran from cron be kind to freebsds update servers and sleep first
-    [ -z "$TERM" -o "$TERM" = "dumb" ] && sleep $(( ${RANDOM} % 3600 ))
-    freebsd-update -b ${ezjail_jailbase} fetch install
+    if [ -z "$TERM" -o "$TERM" = "dumb" ]; then
+      freebsd-update -b ${ezjail_jailbase} cron install
+    else
+      freebsd-update -b ${ezjail_jailbase} fetch install
+    fi
   else
     # Bump the user for some of the most common errors
     [ -d "${ezjail_sourcetree}" ] || exerr "Error: Cannot find your copy of the FreeBSD source tree in ${ezjail_sourcetree}.\n  Consider using '${ezjail_admin} install' to create the base jail from an ftp server."