summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2007-09-30 12:09:03 +0000
committererdgeist <erdgeist@erdgeist.org>2007-09-30 12:09:03 +0000
commitdef86d60c07e401d88cc62f7ecd66c8e27b79abe (patch)
tree0204078a04cb00dc3ca7e2fd252d1a45a2b4e811
parent0c78c429db258cc88f0f68d93698822a5c9b2f0a (diff)
Archive command should be working right now
-rwxr-xr-xezjail-admin26
-rwxr-xr-xezjail.conf.sample3
2 files changed, 22 insertions, 7 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 0399a1b..1c34b12 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -706,7 +706,7 @@ archive)
706 unset ezjail_archive ezjail_force 706 unset ezjail_archive ezjail_force
707 707
708 shift; while getopts :fr:d: arg; do case ${arg} in 708 shift; while getopts :fr:d: arg; do case ${arg} in
709 f) ezjail_force=${OPTARG};; 709 f) ezjail_force="YES";;
710 r) ezjail_archive=${OPTARG};; 710 r) ezjail_archive=${OPTARG};;
711 d) ezjail_archivedir=${OPTARG};; 711 d) ezjail_archivedir=${OPTARG};;
712 ?) exerr ${ezjail_usage_archive};; 712 ?) exerr ${ezjail_usage_archive};;
@@ -724,19 +724,31 @@ archive)
724 [ -n "${ezjail_id}" -a -z "${ezjail_force}" ] && exerr "Error: Jail appears to be still running, stop it first or [-f]orce archiving." 724 [ -n "${ezjail_id}" -a -z "${ezjail_force}" ] && exerr "Error: Jail appears to be still running, stop it first or [-f]orce archiving."
725 725
726 # if no archive name was specified, make one up 726 # if no archive name was specified, make one up
727 [ -z "${ezjail_archive}" ] && ezjail_archive="${ezjail_safename}-`date +%Y%m%d%H%M.%S`.tar.bz2" 727 [ -z "${ezjail_archive}" ] && ezjail_archive="${ezjail_safename}-`date +%Y%m%d%H%M.%S`.tar.gz"
728 728
729 # prepend archive directory 729 # if archive location is not absolute, prepend archive directory
730 ezjail_archive="${ezjail_archivedir:-`pwd -P`}"/"${ezjail_archive}" 730 [ "${ezjail_archive%%[!/]*}" ] || ezjail_archive="${ezjail_archivedir:-`pwd -P`}"/"${ezjail_archive}"
731 731
732 # It's a tar archive, after all
732 case ${ezjail_archive} in 733 case ${ezjail_archive} in
733 *.tar.gz|*.tgz) ;; 734 *.tar.gz|*.tgz) ;;
734 *) ezjail_archive="${ezjail_archive}.tar.gz" ;; 735 *) ezjail_archive="${ezjail_archive}.tar.gz" ;;
735 esac; 736 esac;
736 737
737# TODO: tar cpf${ezjail_taroption} ${ezjail_archive} --atime-preserve --one-file-system ${ezjail_config} -C ${ezjail_root} 738 cd "${ezjail_rootdir}" || exerr "Error: can't cd to ${ezjail_root}."
738 cd ${ezjail_root} || exerr "Error: can't cd to ${ezjail_root}." 739 pax -wXtz -x ustar -f ${ezjail_archive} \
739 pax -wXtz -x ustar -f ${ezjail_archive} -s/^/ezjail\// . 740 -s:"^[^\\.].*/ezjail\\.conf\$":ezjail.conf: \
741 -s:"^[^\\.].*/${ezjail_safename}\$":prop.ezjail: \
742 -s:"^[^\\.].*/${ezjail_safename}.norun\$":prop.ezjail: \
743 -s:"etc/fstab.${ezjail_safename}\$":fstab.ezjail: \
744 -s:"^\\.":ezjail: \
745 "/etc/fstab.${ezjail_safename}" "${ezjail_config}" "${ezjail_etc}/ezjail.conf" .
746
747 # An error on a jail not running is bad
748 [ $? != "0" -a -z "${ezjail_force}" ] && exerr "Error: Archiving jail failed. You might want to check ${ezjail_archive}."
749
750 # When archiving a running jail, some errors might occur
751 [ $? = "0" ] || exerr "Warning: Archiving jail was not completely successful. For a running jail this is not unusual. You might want to check ${ezjail_archive}."
740 752
741 ;; 753 ;;
742######################## ezjail-admin CONFIG ######################## 754######################## ezjail-admin CONFIG ########################
diff --git a/ezjail.conf.sample b/ezjail.conf.sample
index 5fee81a..3cbe78a 100755
--- a/ezjail.conf.sample
+++ b/ezjail.conf.sample
@@ -29,6 +29,9 @@
29# This is the command that is being executed by the console subcommand 29# This is the command that is being executed by the console subcommand
30# ezjail_default_execute=/bin/sh 30# ezjail_default_execute=/bin/sh
31 31
32# This is the default location where ezjail archives its jails to
33# ezjail_archivedir=`pwd -P`
34
32# base jail will provide a soft link from /usr/bin/perl to /usr/local/bin/perl 35# base jail will provide a soft link from /usr/bin/perl to /usr/local/bin/perl
33# to accomodate all scripts using '#!/usr/bin/perl'... 36# to accomodate all scripts using '#!/usr/bin/perl'...
34# ezjail_uglyperlhack="YES" 37# ezjail_uglyperlhack="YES"