summaryrefslogtreecommitdiff
path: root/ezjail-admin
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2005-09-22 11:45:47 +0000
committererdgeist <erdgeist@erdgeist.org>2005-09-22 11:45:47 +0000
commit668c4dfc58490d61398ea3acdf1290f0579b8485 (patch)
tree5554bd6c484f62b364178495595acf24bb35dbdf /ezjail-admin
parent2e8a290b5d0baf1d9cd73671710b107d7d311c94 (diff)
First test in live system yielded several problems :)
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-xezjail-admin38
1 files changed, 20 insertions, 18 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 649fde1..ac12f18 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -43,7 +43,8 @@ create)
43 newjail_softlink= 43 newjail_softlink=
44 newjail_fill="YES" 44 newjail_fill="YES"
45 45
46 for arg in args; do 46 set -- $args
47 for arg do
47 case $arg in 48 case $arg in
48 -x) newjail_fill="NO"; shift;; 49 -x) newjail_fill="NO"; shift;;
49 -r) newjail_root="$2"; shift 2;; 50 -r) newjail_root="$2"; shift 2;;
@@ -58,7 +59,7 @@ create)
58 fi 59 fi
59 60
60 # relative paths don't make sense in rc.scripts 61 # relative paths don't make sense in rc.scripts
61 if [ "${ezjail_jaildir#/}" == "${ezjail_jaildir}" ]; then 62 if [ ${ezjail_jaildir#/} = ${ezjail_jaildir} ]; then
62 echo Error: Need an absolute path in ezjail_jaildir, it is currently set to: $ezjail_jaildir 63 echo Error: Need an absolute path in ezjail_jaildir, it is currently set to: $ezjail_jaildir
63 exit 1; 64 exit 1;
64 fi 65 fi
@@ -73,7 +74,7 @@ create)
73 74
74 # if jail root specified on command line is not absolute, 75 # if jail root specified on command line is not absolute,
75 # make it absolute inside our jail directory 76 # make it absolute inside our jail directory
76 if [ "${newjail_root#/}" = "${newjail_root}" ]; then 77 if [ ${newjail_root#/} = ${newjail_root} ]; then
77 newjail_root=$ezjail_jaildir/$newjail_root 78 newjail_root=$ezjail_jaildir/$newjail_root
78 fi 79 fi
79 80
@@ -100,22 +101,20 @@ create)
100 101
101 # if the automount feature is not disabled, create an 102 # if the automount feature is not disabled, create an
102 # fstab entry for new jail 103 # fstab entry for new jail
103 echo $ezjail_jailbase $newjail_root/basejail nullfs ro 0 0 > /etc/fstab.$newjail_name 104 echo $ezjail_jailbase $newjail_root/basejail nullfs ro 0 0 > /etc/fstab.$newjail_nname
104 105
105 # now, where everything seems to have gone right, 106 # now, where everything seems to have gone right,
106 # create control file in ezjails config dir 107 # create control file in ezjails config dir
107 mkdir -p $ezjail_jailcfgs 108 mkdir -p $ezjail_jailcfgs
108 echo \ 109 echo export jail_${newjail_nname}_hostname=\"${newjail_name}\" >> ${ezjail_jailcfgs}/${newjail_nname}
109 jail_${newjail_nname}_hostname=\"${newjail_name}\" \n \ 110 echo export jail_${newjail_nname}_ip=\"${newjail_ip}\" >> ${ezjail_jailcfgs}/${newjail_nname}
110 jail_${newjail_nname}_ip=\"${newjail_ip}\" \n \ 111 echo export jail_${newjail_nname}_rootdir=\"${newjail_root}\" >> ${ezjail_jailcfgs}/${newjail_nname}
111 jail_${newjail_nname}_rootdir=\"${newjail_root}\" \n \ 112 echo export jail_${newjail_nname}_exec=\"/bin/sh /etc/rc\" >> ${ezjail_jailcfgs}/${newjail_nname}
112 jail_${newjail_nname}_exec=\"/bin/sh /etc/rc\" 113 echo export jail_${newjail_nname}_mount_enable=\"${ezjail_mount_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname}
113 jail_${newjail_nname}_mount_enable=\"${ezjail_mount_enable}\" \n \ 114 echo export jail_${newjail_nname}_devfs_enable=\"${ezjail_devfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname}
114 jail_${newjail_nname}_devfs_enable=\"${ezjail_devfs_enable}\" \n \ 115 echo export jail_${newjail_nname}_devfs_ruleset=\"devfsrules_jail\" >> ${ezjail_jailcfgs}/${newjail_nname}
115 jail_${newjail_nname}_devfs_ruleset="devfsrules_jail" 116 echo export jail_${newjail_nname}_procfs_enable=\"${ezjail_procfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname}
116 jail_${newjail_nname}_procfs_enable=\"${ezjail_procfs_enable}\" \n \ 117 echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname}
117 jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" \n \
118 > ${ezail_jailcfgs}/newjail_nname
119 118
120 ;; 119 ;;
121delete) 120delete)
@@ -132,11 +131,12 @@ update)
132 exit 1; 131 exit 1;
133 fi 132 fi
134 133
135 updatejail_installaction=world 134 updatejail_installaction="world"
136 135
137 for arg in args; do 136 set -- $args
137 for arg do
138 case $arg in 138 case $arg in
139 -i) updatejail_installaction=installworld; shift;; 139 -i) updatejail_installaction="installworld"; shift;;
140 -s) ezjail_sourcetree="$2"; shift 2;; 140 -s) ezjail_sourcetree="$2"; shift 2;;
141 --) shift; break;; 141 --) shift; break;;
142 esac 142 esac
@@ -158,8 +158,10 @@ update)
158 chflags -R noschg ${a}; rm -r ${a}; ln -s /basejail/${a} ${a} 158 chflags -R noschg ${a}; rm -r ${a}; ln -s /basejail/${a} ${a}
159 done 159 done
160 mkdir basejail 160 mkdir basejail
161 ln -s /basejail/usr/ports usr/ports
161 162
162 if [ -d ${ezjail_jailtemplate} ]; then 163 if [ -d ${ezjail_jailtemplate} ]; then
164 rm -rf ${ezjail_jailtemplate}_old
163 mv ${ezjail_jailtemplate} ${ezjail_jailtemplate}_old 165 mv ${ezjail_jailtemplate} ${ezjail_jailtemplate}_old
164 fi 166 fi
165 mv ${ezjail_jailfull} ${ezjail_jailtemplate} 167 mv ${ezjail_jailfull} ${ezjail_jailtemplate}