summaryrefslogtreecommitdiff
path: root/ezjail-admin
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2008-07-06 22:24:56 +0000
committererdgeist <erdgeist@erdgeist.org>2008-07-06 22:24:56 +0000
commit518ef661e17b170431d19fcc4d2b4fa02095a156 (patch)
treef501400d5d586e0c09fd6d6367e8bb8fb96e9264 /ezjail-admin
parentaaf34bfa996e42ed05e3c6dd107d48085f7943d4 (diff)
Making paths absolute did not work correctly. Also move commands handling multiple jails to a for loop instead of a while loop
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-xezjail-admin22
1 files changed, 7 insertions, 15 deletions
diff --git a/ezjail-admin b/ezjail-admin
index b960044..b5715c1 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -249,13 +249,9 @@ ezjail_queryftpserver () {
249 249
250# Make a path absolute, if it isn't already 250# Make a path absolute, if it isn't already
251ezjail_makeabsolute ( ) { 251ezjail_makeabsolute ( ) {
252 if [ $# -eq 1 ]; then 252 eval [ \"\${$1%%[!/]*}\" -o "\${$1}" = "-" ] && return
253 path=`pwd -P` 253 [ "${2%%[!/]*}" ] && path=${2} || path=`pwd -P`/${2}
254 else 254 eval export ${1}="${path}/\${$1}"
255 path=$2
256 ezjail_makeabsolute path
257 fi
258 eval [ \"\${$1%%[!/]*}\" -o "\${$1}" = "-" ] || eval export ${1}="${path}/\${$1}"
259} 255}
260 256
261parse_geli_attach_args () { 257parse_geli_attach_args () {
@@ -826,9 +822,9 @@ archive)
826 # Fetch list of all ezjails 822 # Fetch list of all ezjails
827 [ "${ezjail_archivealljails}" -a -d "${ezjail_prefix}/etc/ezjail/" ] && cd "${ezjail_prefix}/etc/ezjail/" && set - `ls | xargs rcorder` 823 [ "${ezjail_archivealljails}" -a -d "${ezjail_prefix}/etc/ezjail/" ] && cd "${ezjail_prefix}/etc/ezjail/" && set - `ls | xargs rcorder`
828 824
829 while [ $# -gt 0 ]; do 825 for ezjail in $@; do
830 # Jail name mandatory 826 # Jail name mandatory
831 fetchjailinfo ${1%.norun} 827 fetchjailinfo ${ezjail%.norun}
832 828
833 # Check for existence of jail in our records 829 # Check for existence of jail in our records
834 [ "${ezjail_config}" ] || exerr "Error: Nothing known about jail ${ezjail_name}." 830 [ "${ezjail_config}" ] || exerr "Error: Nothing known about jail ${ezjail_name}."
@@ -854,7 +850,7 @@ archive)
854 850
855 # If archive location is not absolute, prepend archive directory 851 # If archive location is not absolute, prepend archive directory
856 ezjail_makeabsolute ezjail_archive ${ezjail_archivedir} 852 ezjail_makeabsolute ezjail_archive ${ezjail_archivedir}
857 853echo ${ezjail_archive}
858 # It's a tar archive, after all 854 # It's a tar archive, after all
859 case ${ezjail_archive} in 855 case ${ezjail_archive} in
860 *.tar.gz|*.tgz|-) ;; 856 *.tar.gz|*.tgz|-) ;;
@@ -880,8 +876,6 @@ archive)
880 # When archiving a running jail, some errors might occur 876 # When archiving a running jail, some errors might occur
881 [ $? -eq 0 ] || echo "Warning: Archiving jail ${ezjail_name} was not completely successful. For a running jail this is not unusual. You might want to check ${ezjail_archive}." 877 [ $? -eq 0 ] || echo "Warning: Archiving jail ${ezjail_name} was not completely successful. For a running jail this is not unusual. You might want to check ${ezjail_archive}."
882 878
883 # To the next jail on command line
884 shift 1
885 unset ezjail_archive ezjail_archive_opt ezjail_addfiles 879 unset ezjail_archive ezjail_archive_opt ezjail_addfiles
886 done 880 done
887 ;; 881 ;;
@@ -900,9 +894,8 @@ restore)
900 # Default archive directory to . 894 # Default archive directory to .
901 ezjail_archivedir=${ezjail_archivedir:-`pwd -P`} 895 ezjail_archivedir=${ezjail_archivedir:-`pwd -P`}
902 896
903 while [ $# -gt 0 ]; do 897 for ezjail_fromarchive in $@; do
904 unset ezjail_safename 898 unset ezjail_safename
905 ezjail_fromarchive=$1
906 899
907 # if archive location is absolute and doesn't exist, fail 900 # if archive location is absolute and doesn't exist, fail
908 [ "${ezjail_fromarchive%%[!/]*}" -a ! -f "${ezjail_fromarchive}" ] && exerr "Error: File for archive ${ezjail_fromarchive} not found." 901 [ "${ezjail_fromarchive%%[!/]*}" -a ! -f "${ezjail_fromarchive}" ] && exerr "Error: File for archive ${ezjail_fromarchive} not found."
@@ -955,7 +948,6 @@ restore)
955 . "${ezjail_tmpfile}" 948 . "${ezjail_tmpfile}"
956 rm -f "${ezjail_tmpfile}" 949 rm -f "${ezjail_tmpfile}"
957 950
958 shift 1
959 done 951 done
960 ;; 952 ;;
961######################## ezjail-admin CONFIG ######################## 953######################## ezjail-admin CONFIG ########################