diff options
-rwxr-xr-x | ezjail-release.sh | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ezjail-release.sh b/ezjail-release.sh index 66c2a5b..1ac3fd5 100755 --- a/ezjail-release.sh +++ b/ezjail-release.sh | |||
@@ -29,12 +29,13 @@ case "$1" in | |||
29 | ######################## ezjail-admin RELEASE ######################## | 29 | ######################## ezjail-admin RELEASE ######################## |
30 | release) | 30 | release) |
31 | shift | 31 | shift |
32 | args=`getopt mpr:s: $*` || exerr "Usage: `basename -- $0` release [-m] [-p] [-r release] [-s server]" | 32 | args=`getopt mpsh:r: $*` || exerr "Usage: `basename -- $0` release [-mps] [-h host] [-r release]" |
33 | 33 | ||
34 | basejail_release= | 34 | basejail_release= |
35 | basejail_server= | 35 | basejail_host= |
36 | basejail_manpages= | 36 | basejail_manpages= |
37 | basejail_ports= | 37 | basejail_ports= |
38 | basejail_sources= | ||
38 | basejail_reldir= | 39 | basejail_reldir= |
39 | 40 | ||
40 | set -- ${args} | 41 | set -- ${args} |
@@ -42,24 +43,24 @@ release) | |||
42 | case ${arg} in | 43 | case ${arg} in |
43 | -m) basejail_manpages=" manpages"; shift;; | 44 | -m) basejail_manpages=" manpages"; shift;; |
44 | -p) basejail_ports=" ports"; shift;; | 45 | -p) basejail_ports=" ports"; shift;; |
46 | -s) basejail_sources=" src"; shift;; | ||
47 | -h) basejail_host="$2"; shift 2;; | ||
45 | -r) basejail_release="$2"; shift 2;; | 48 | -r) basejail_release="$2"; shift 2;; |
46 | -s) basejail_server="$2"; shift 2;; | ||
47 | --) shift; break;; | 49 | --) shift; break;; |
48 | esac | 50 | esac |
49 | done | 51 | done |
50 | 52 | ||
51 | basejail_arch=`uname -p` | 53 | basejail_arch=`uname -p` |
52 | basejail_server=${basejail_server:-"ftp.freebsd.org"} | 54 | basejail_host=${basejail_host:-"ftp.freebsd.org"} |
53 | basejail_server=${basejail_server#ftp://} | 55 | basejail_host=${basejail_host#ftp://} |
54 | basejail_dir=${basejail_server#file://} | 56 | basejail_dir=${basejail_host#file://} |
55 | [ "${basejail_dir%%[!/]*}" ] || basejail_reldir=${PWD} | 57 | [ "${basejail_dir%%[!/]*}" ] || basejail_reldir=${PWD} |
56 | basejail_tmp=${ezjail_jaildir}/tmp | 58 | basejail_tmp=${ezjail_jaildir}/tmp |
57 | basejail_fill="base ${basejail_manpages} ${basejail_ports}" | ||
58 | 59 | ||
59 | # ftp servers normally wont provide CURRENT-builds | 60 | # ftp servers normally wont provide CURRENT-builds |
60 | if [ -z "${basejail_release}" ]; then | 61 | if [ -z "${basejail_release}" ]; then |
61 | basejail_release=`uname -r` | 62 | basejail_release=`uname -r` |
62 | if [ "${basejail_release%CURRENT}" != "${basejail_release}" -a "${basejail_dir}" = "${basejail_server}" ]; then | 63 | if [ "${basejail_release%CURRENT}" != "${basejail_release}" -a "${basejail_dir}" = "${basejail_host}" ]; then |
63 | echo "Your system is ${basejail_release}. Normally FTP-servers don't provide CURRENT-builds." | 64 | echo "Your system is ${basejail_release}. Normally FTP-servers don't provide CURRENT-builds." |
64 | echo -n "Release [ ${basejail_release} ]: " | 65 | echo -n "Release [ ${basejail_release} ]: " |
65 | read release_tmp | 66 | read release_tmp |
@@ -75,14 +76,13 @@ release) | |||
75 | DESTDIR=${ezjail_jailfull} | 76 | DESTDIR=${ezjail_jailfull} |
76 | 77 | ||
77 | rm -rf ${basejail_tmp} | 78 | rm -rf ${basejail_tmp} |
78 | for pkg in ${basejail_fill}; do | 79 | for pkg in base ${basejail_manpages} ${basejail_ports} ${basejail_sources}; do |
79 | if [ "${basejail_dir}" = "${basejail_server}" ]; then | 80 | if [ "${basejail_dir}" = "${basejail_host}" ]; then |
80 | mkdir -p ${basejail_tmp} || exerr "Could not create temporary base jail directory ${basejail_tmp}." | 81 | mkdir -p ${basejail_tmp} || exerr "Could not create temporary base jail directory ${basejail_tmp}." |
81 | cd ${basejail_tmp} | 82 | cd ${basejail_tmp} |
82 | for basejail_path in pub/FreeBSD/releases pub/FreeBSD/snapshot pub/FreeBSD releases snapshots NO; do | 83 | for basejail_path in pub/FreeBSD/releases pub/FreeBSD/snapshot pub/FreeBSD releases snapshots NO; do |
83 | [ "${basejail_path}" = "NO" ] && exerr "Could not fetch ${pkg} from ${basejail_server}." | 84 | [ "${basejail_path}" = "NO" ] && exerr "Could not fetch ${pkg} from ${basejail_host}." |
84 | echo "${basejail_server}:${basejail_path}/${basejail_arch}/${basejail_release}/${pkg}/*" | 85 | ftp "${basejail_host}:${basejail_path}/${basejail_arch}/${basejail_release}/${pkg}/*" && break |
85 | ftp "${basejail_server}:${basejail_path}/${basejail_arch}/${basejail_release}/${pkg}/*" && break | ||
86 | done | 86 | done |
87 | [ -f install.sh ] && yes | . install.sh | 87 | [ -f install.sh ] && yes | . install.sh |
88 | rm -rf ${basejail_tmp} | 88 | rm -rf ${basejail_tmp} |