summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xezjail-admin16
1 files changed, 13 insertions, 3 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 02e9594..4bb361d 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -875,6 +875,7 @@ restore)
875 ezjail_archivedir=${ezjail_archivedir:-`pwd -P`} 875 ezjail_archivedir=${ezjail_archivedir:-`pwd -P`}
876 876
877 while [ $# -gt 0 ]; do 877 while [ $# -gt 0 ]; do
878 unset ezjail_safename
878 ezjail_fromarchive=$1 879 ezjail_fromarchive=$1
879 880
880 # if archive location is absolute and doesn't exist, fail 881 # if archive location is absolute and doesn't exist, fail
@@ -885,12 +886,21 @@ restore)
885 ezjail_fromarchive="${ezjail_archivedir}/${ezjail_fromarchive}" 886 ezjail_fromarchive="${ezjail_archivedir}/${ezjail_fromarchive}"
886 else 887 else
887 # If archive is not found, try guessing by jail name 888 # If archive is not found, try guessing by jail name
888 ezjail_safename=`echo -n "$1" | tr -c '[:alnum:]' _` 889 ezjail_safename=`echo -n "${ezjail_fromarchive}" | tr -c '[:alnum:]' _`
889 ezjail_fromarchive=`ls -tr ${ezjail_archivedir}/${ezjail_safename}* | head -n 1` 890 unset ezjail_fromarchive
891 for ezjail_archive in "${ezjail_archivedir}/${ezjail_safename}"*; do
892 [ -z "${ezjail_fromarchive}" -a -f "${ezjail_archive}" ] && ezjail_fromarchive=${ezjail_archive}
893 [ "${ezjail_archive}" -nt "${ezjail_fromarchive}" ] && ezjail_fromarchive=${ezjail_archive}
894 done
890 [ -f "${ezjail_fromarchive}" ] || exerr "Error: No archive for pattern $1 can be found." 895 [ -f "${ezjail_fromarchive}" ] || exerr "Error: No archive for pattern $1 can be found."
891 fi 896 fi
892 fi 897 fi
893 echo ${ezjail_fromarchive} 898
899 ezjail_nameprop=`tar tzf ${ezjail_fromarchive} --fast-read prop.ezjail_\*`
900 [ $? -eq 0 -a "${ezjail_nameprop}" ] || exerr "Error: File ${ezjail_fromarchive} is not an ezjail archive."
901
902
903 shift 1
894 done 904 done
895 ;; 905 ;;
896######################## ezjail-admin CONFIG ######################## 906######################## ezjail-admin CONFIG ########################