Making paths absolute did not work correctly. Also move commands handling multiple jails to a for loop instead of a while loop

This commit is contained in:
erdgeist 2008-07-06 22:24:56 +00:00
parent aaf34bfa99
commit 518ef661e1

View File

@ -249,13 +249,9 @@ ezjail_queryftpserver () {
# Make a path absolute, if it isn't already # Make a path absolute, if it isn't already
ezjail_makeabsolute ( ) { ezjail_makeabsolute ( ) {
if [ $# -eq 1 ]; then eval [ \"\${$1%%[!/]*}\" -o "\${$1}" = "-" ] && return
path=`pwd -P` [ "${2%%[!/]*}" ] && path=${2} || path=`pwd -P`/${2}
else eval export ${1}="${path}/\${$1}"
path=$2
ezjail_makeabsolute path
fi
eval [ \"\${$1%%[!/]*}\" -o "\${$1}" = "-" ] || eval export ${1}="${path}/\${$1}"
} }
parse_geli_attach_args () { parse_geli_attach_args () {
@ -826,9 +822,9 @@ archive)
# Fetch list of all ezjails # Fetch list of all ezjails
[ "${ezjail_archivealljails}" -a -d "${ezjail_prefix}/etc/ezjail/" ] && cd "${ezjail_prefix}/etc/ezjail/" && set - `ls | xargs rcorder` [ "${ezjail_archivealljails}" -a -d "${ezjail_prefix}/etc/ezjail/" ] && cd "${ezjail_prefix}/etc/ezjail/" && set - `ls | xargs rcorder`
while [ $# -gt 0 ]; do for ezjail in $@; do
# Jail name mandatory # Jail name mandatory
fetchjailinfo ${1%.norun} fetchjailinfo ${ezjail%.norun}
# Check for existence of jail in our records # Check for existence of jail in our records
[ "${ezjail_config}" ] || exerr "Error: Nothing known about jail ${ezjail_name}." [ "${ezjail_config}" ] || exerr "Error: Nothing known about jail ${ezjail_name}."
@ -854,7 +850,7 @@ archive)
# If archive location is not absolute, prepend archive directory # If archive location is not absolute, prepend archive directory
ezjail_makeabsolute ezjail_archive ${ezjail_archivedir} ezjail_makeabsolute ezjail_archive ${ezjail_archivedir}
echo ${ezjail_archive}
# It's a tar archive, after all # It's a tar archive, after all
case ${ezjail_archive} in case ${ezjail_archive} in
*.tar.gz|*.tgz|-) ;; *.tar.gz|*.tgz|-) ;;
@ -880,8 +876,6 @@ archive)
# When archiving a running jail, some errors might occur # When archiving a running jail, some errors might occur
[ $? -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}." [ $? -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}."
# To the next jail on command line
shift 1
unset ezjail_archive ezjail_archive_opt ezjail_addfiles unset ezjail_archive ezjail_archive_opt ezjail_addfiles
done done
;; ;;
@ -900,9 +894,8 @@ restore)
# Default archive directory to . # Default archive directory to .
ezjail_archivedir=${ezjail_archivedir:-`pwd -P`} ezjail_archivedir=${ezjail_archivedir:-`pwd -P`}
while [ $# -gt 0 ]; do for ezjail_fromarchive in $@; do
unset ezjail_safename unset ezjail_safename
ezjail_fromarchive=$1
# if archive location is absolute and doesn't exist, fail # if archive location is absolute and doesn't exist, fail
[ "${ezjail_fromarchive%%[!/]*}" -a ! -f "${ezjail_fromarchive}" ] && exerr "Error: File for archive ${ezjail_fromarchive} not found." [ "${ezjail_fromarchive%%[!/]*}" -a ! -f "${ezjail_fromarchive}" ] && exerr "Error: File for archive ${ezjail_fromarchive} not found."
@ -955,7 +948,6 @@ restore)
. "${ezjail_tmpfile}" . "${ezjail_tmpfile}"
rm -f "${ezjail_tmpfile}" rm -f "${ezjail_tmpfile}"
shift 1
done done
;; ;;
######################## ezjail-admin CONFIG ######################## ######################## ezjail-admin CONFIG ########################