Fetching first values from an ezjail archive in restore command. Still not functional.
This commit is contained in:
parent
3953315c47
commit
33c42bb8ce
16
ezjail-admin
16
ezjail-admin
@ -875,6 +875,7 @@ restore)
|
||||
ezjail_archivedir=${ezjail_archivedir:-`pwd -P`}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
unset ezjail_safename
|
||||
ezjail_fromarchive=$1
|
||||
|
||||
# if archive location is absolute and doesn't exist, fail
|
||||
@ -885,12 +886,21 @@ restore)
|
||||
ezjail_fromarchive="${ezjail_archivedir}/${ezjail_fromarchive}"
|
||||
else
|
||||
# If archive is not found, try guessing by jail name
|
||||
ezjail_safename=`echo -n "$1" | tr -c '[:alnum:]' _`
|
||||
ezjail_fromarchive=`ls -tr ${ezjail_archivedir}/${ezjail_safename}* | head -n 1`
|
||||
ezjail_safename=`echo -n "${ezjail_fromarchive}" | tr -c '[:alnum:]' _`
|
||||
unset ezjail_fromarchive
|
||||
for ezjail_archive in "${ezjail_archivedir}/${ezjail_safename}"*; do
|
||||
[ -z "${ezjail_fromarchive}" -a -f "${ezjail_archive}" ] && ezjail_fromarchive=${ezjail_archive}
|
||||
[ "${ezjail_archive}" -nt "${ezjail_fromarchive}" ] && ezjail_fromarchive=${ezjail_archive}
|
||||
done
|
||||
[ -f "${ezjail_fromarchive}" ] || exerr "Error: No archive for pattern $1 can be found."
|
||||
fi
|
||||
fi
|
||||
echo ${ezjail_fromarchive}
|
||||
|
||||
ezjail_nameprop=`tar tzf ${ezjail_fromarchive} --fast-read prop.ezjail_\*`
|
||||
[ $? -eq 0 -a "${ezjail_nameprop}" ] || exerr "Error: File ${ezjail_fromarchive} is not an ezjail archive."
|
||||
|
||||
|
||||
shift 1
|
||||
done
|
||||
;;
|
||||
######################## ezjail-admin CONFIG ########################
|
||||
|
Loading…
x
Reference in New Issue
Block a user