summaryrefslogtreecommitdiff
path: root/ezjail-admin
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2012-01-02 04:37:27 +0000
committererdgeist <erdgeist@erdgeist.org>2012-01-02 04:37:27 +0000
commitfe8e579fef83d3e3f413fb054c9b550b20f92d21 (patch)
tree98ecb1bf4ea9a7a88558261ffeb4790f201799e0 /ezjail-admin
parentcedf263041c6807a4bb5b44a671110adfd07397e (diff)
Preparing ezjail to work with new release directory layout
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-xezjail-admin46
1 files changed, 33 insertions, 13 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 1ad888a..2ca46aa 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -43,7 +43,7 @@ ezjail_basesystem="base"
43case `uname -p` in amd64) ezjail_dirlist="${ezjail_dirlist} usr/lib32"; ezjail_basesystem="${ezjail_basesystem} lib32";; esac 43case `uname -p` in amd64) ezjail_dirlist="${ezjail_dirlist} usr/lib32"; ezjail_basesystem="${ezjail_basesystem} lib32";; esac
44 44
45# Synopsis messages 45# Synopsis messages
46ezjail_usage_ezjailadmin="${ezjail_admin} v3.1.1b\nUsage: ${ezjail_admin} [archive|config|console|create|delete|install|list|restore|update] {params}" 46ezjail_usage_ezjailadmin="${ezjail_admin} v3.2b\nUsage: ${ezjail_admin} [archive|config|console|create|delete|install|list|restore|update] {params}"
47ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]" 47ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]"
48ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] jailname jailip" 48ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] jailname jailip"
49ezjail_usage_delete="Usage: ${ezjail_admin} delete [-wf] jailname" 49ezjail_usage_delete="Usage: ${ezjail_admin} delete [-wf] jailname"
@@ -939,6 +939,7 @@ install)
939 [ $# -eq 0 ] || exerr ${ezjail_usage_install} 939 [ $# -eq 0 ] || exerr ${ezjail_usage_install}
940 940
941 ezjail_installarch=`uname -p` 941 ezjail_installarch=`uname -p`
942 ezjail_installplatform=`uname -m`
942 : ${ezjail_ftphost="ftp.freebsd.org"} 943 : ${ezjail_ftphost="ftp.freebsd.org"}
943 ezjail_ftphost=${ezjail_ftphost#ftp://} 944 ezjail_ftphost=${ezjail_ftphost#ftp://}
944 ezjail_dir=${ezjail_ftphost#file://} 945 ezjail_dir=${ezjail_ftphost#file://}
@@ -962,6 +963,11 @@ install)
962 fi 963 fi
963 fi 964 fi
964 965
966 # From 9.0 releases come with a new layout
967 # It is now a single archive ${pkg}.txz instead of a list of archive parts under ${pkg}/*
968 # We assume for now that jail's platform is supposed to be that of the host. That may change later.
969 ezjail_release_major=${ezjail_release%%.}
970
965 # Normally fulljail should be renamed by past ezjail-admin commands. 971 # Normally fulljail should be renamed by past ezjail-admin commands.
966 # However those may have failed 972 # However those may have failed
967 if [ "${ezjail_use_zfs}" = "YES" ]; then 973 if [ "${ezjail_use_zfs}" = "YES" ]; then
@@ -995,23 +1001,37 @@ install)
995 [ "${ezjail_ftpserverqueried}" ] || ezjail_queryftpserver 1001 [ "${ezjail_ftpserverqueried}" ] || ezjail_queryftpserver
996 exit 1 1002 exit 1
997 fi 1003 fi
998 ftp "${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/${ezjail_release}/${pkg}/*" && break 1004 if [${ezjail_release_major} -ge 9 ]; then
1005 ftp "${ezjail_ftphost}:${ezjail_path}/${ezjail_installplatform}/${ezjail_installarch}/${ezjail_release}/${pkg}.txz" && break
1006 else
1007 ftp "${ezjail_ftphost}:${ezjail_path}/${ezjail_installarch}/${ezjail_release}/${pkg}/*" && break
1008 fi
999 done 1009 done
1000 1010
1001 # These actions are really ugly: sources want $1 to contain the set 1011 if [ ${ezjail_release_major} -ge 9 ]; then
1002 # of sources to install, base asks the user if he is sure, hence the 1012 tar --unlink -xpJf -C ${DESTDIR} ${pkg}.txz
1003 # yes and the set -- all 1013 else
1004 [ "${pkg}" = "base" ] && echo "Ignore the next question, ezjail answers it for you." 1014 # These actions are really ugly: sources want $1 to contain the set
1005 set -- all 1015 # of sources to install, base asks the user if he is sure, hence the
1006 [ -f install.sh ] && yes | . install.sh 1016 # yes and the set -- all
1007 [ $? -eq 0 ] || exerr "Error: Package install script for ${pkg} failed." 1017 [ "${pkg}" = "base" ] && echo "Ignore the next question, ezjail answers it for you."
1018 set -- all
1019 [ -f install.sh ] && yes | . install.sh
1020 [ $? -eq 0 ] || exerr "Error: Package install script for ${pkg} failed."
1021 fi
1008 1022
1009 rm -rf "${ezjail_jailtemp}" 1023 rm -rf "${ezjail_jailtemp}"
1010 else 1024 else
1011 cd "${ezjail_reldir}/${ezjail_dir}/${pkg}" || exerr "Error: Could not cd to ${ezjail_dir}." 1025 if [ ${ezjail_release_major} -ge 9 ]; then
1012 set -- all 1026 [ -r "${ezjail_reldir}/${ezjail_dir}/${pkg}.txz" ] || exerr "Error: Can not access package file ${ezjail_reldir}/${ezjail_dir}/${pkg}.txz"
1013 [ -f install.sh ] && yes | . install.sh 1027 tar --unlink -xpJf -C ${DESTDIR} ${ezjail_reldir}/${ezjail_dir}/${pkg}.txz
1014 [ $? -eq 0 ] || exerr "Error: Package install script for ${pkg} failed." 1028 else
1029 cd "${ezjail_reldir}/${ezjail_dir}/${pkg}" || exerr "Error: Could not cd to ${ezjail_dir}."
1030 [ "${pkg}" = "base" ] && echo "Ignore the next question, ezjail answers it for you."
1031 set -- all
1032 [ -f install.sh ] && yes | . install.sh
1033 [ $? -eq 0 ] || exerr "Error: Package install script for ${pkg} failed."
1034 fi
1015 fi 1035 fi
1016 done 1036 done
1017 1037