summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2005-11-17 00:30:15 +0000
committererdgeist <erdgeist@erdgeist.org>2005-11-17 00:30:15 +0000
commit9becc61bb321fc16d3ba5778e2ef5078efd07d22 (patch)
treef35b6cf8c41ea0bc834e83256fa1dd53fdf136fc
parente73cd9344284a5bb99a4977c0e4b6b278f051a2e (diff)
Default PREFIX provided, flavour stuff added
-rwxr-xr-xMakefile10
-rwxr-xr-xezjail-admin14
-rw-r--r--ezjail-config.sh22
3 files changed, 33 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 6d0e141..9618d7d 100755
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,16 @@
1# I know, this is ain't nice but an empty prefix leads to much confusion
2# In most cases ezjail is being installed from ports anyway. If you REALLY REALLY
3# want / as your install location, DO set PREFIX before invoking this Makefile
4
5PREFIX?=/usr/local
6
1all: 7all:
2 8
3install: 9install:
4 mkdir -p ${PREFIX}/etc/ezjail/ ${PREFIX}/man/man1/ ${PREFIX}/man/man5/ ${PREFIX}/etc/rc.d/ ${PREFIX}/bin/ 10 mkdir -p ${PREFIX}/etc/ezjail/ ${PREFIX}/man/man1/ ${PREFIX}/man/man5/ ${PREFIX}/etc/rc.d/ ${PREFIX}/bin/ ${PREFIX}/share/ezjail ${PREFIX}/share/examples/ezjail
5 cp -p ezjail.conf.sample ${PREFIX}/etc/ 11 cp -p ezjail.conf.sample ${PREFIX}/etc/
12 cp -p ezjail-config.sh ${PREFIX}/share/ezjail/
13 cp -p ezjail.flavour.default ${PREFIX}/share/examples/ezjail/
6 sed s:EZJAIL_PREFIX:${PREFIX}: ezjail.sh > ${PREFIX}/etc/rc.d/ezjail.sh 14 sed s:EZJAIL_PREFIX:${PREFIX}: ezjail.sh > ${PREFIX}/etc/rc.d/ezjail.sh
7 sed s:EZJAIL_PREFIX:${PREFIX}: ezjail-admin > ${PREFIX}/bin/ezjail-admin 15 sed s:EZJAIL_PREFIX:${PREFIX}: ezjail-admin > ${PREFIX}/bin/ezjail-admin
8 sed s:EZJAIL_PREFIX:${PREFIX}: man1/ezjail-admin.1 > ${PREFIX}/man/man1/ezjail-admin.1 16 sed s:EZJAIL_PREFIX:${PREFIX}: man1/ezjail-admin.1 > ${PREFIX}/man/man1/ezjail-admin.1
diff --git a/ezjail-admin b/ezjail-admin
index 907a61f..d9fce50 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -3,6 +3,7 @@
3# ugly: this variable is set during port install time 3# ugly: this variable is set during port install time
4ezjail_prefix=EZJAIL_PREFIX 4ezjail_prefix=EZJAIL_PREFIX
5ezjail_etc=${ezjail_prefix}/etc 5ezjail_etc=${ezjail_prefix}/etc
6ezjail_share=${ezjail_prefix}/share
6ezjail_jailcfgs=${ezjail_etc}/ezjail 7ezjail_jailcfgs=${ezjail_etc}/ezjail
7 8
8if [ -f ${ezjail_etc}/ezjail.conf ]; then 9if [ -f ${ezjail_etc}/ezjail.conf ]; then
@@ -95,9 +96,12 @@ create)
95 # if flavour contains a '/', it aint a short name 96 # if flavour contains a '/', it aint a short name
96 if [ ${newjail_flavour} = ${newjail_flavour%/*} -a \ 97 if [ ${newjail_flavour} = ${newjail_flavour%/*} -a \
97 -f ${ezjail_etc}/ezjail.flavour.${newjail_flavour} ]; then 98 -f ${ezjail_etc}/ezjail.flavour.${newjail_flavour} ]; then
98 [ $newjail_flav ] && exerr "Note: flavour ${newjail_flavour} conflicts with file ./${newjail_flavour}" 99 [ "$newjail_flav" ] && exerr "Error: flavour ${newjail_flavour} conflicts with file ./${newjail_flavour}"
99 $newjail_flav=${ezjail_etc}/ezjail.flavour.${newjail_flavour} 100 $newjail_flav=${ezjail_etc}/ezjail.flavour.${newjail_flavour}
100 fi 101 fi
102
103 # Flavour not found
104 [ "$newjail_flav" ] || exerr "Error: Flavour file $newjail_flavour not found"
101 fi 105 fi
102 106
103 # now take a copy of our template jail 107 # now take a copy of our template jail
@@ -126,6 +130,13 @@ create)
126 echo export jail_${newjail_nname}_procfs_enable=\"${ezjail_procfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} 130 echo export jail_${newjail_nname}_procfs_enable=\"${ezjail_procfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname}
127 echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} 131 echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname}
128 132
133 # Final steps for flavour installation
134 if [ "${newjail_flav}" ]; then
135 install -o root -g wheel -m 0755 ${newjail_flav} ${newjail_root}/ezjail.flavour
136 install -o root -g wheel -m 0755 ${ezjail_share}/ezjail-config.sh ${newjail_root}/etc/rc.d/ezjail-config.sh
137 echo "Shell scripts installed, flavourizing on jails first startup"
138 fi
139
129 ;; 140 ;;
130delete) 141delete)
131######################## ezjail-admin DELETE ######################## 142######################## ezjail-admin DELETE ########################
@@ -190,6 +201,7 @@ list)
190 eval jail_rootdir=\"\$jail_${jail}_rootdir\" 201 eval jail_rootdir=\"\$jail_${jail}_rootdir\"
191 printf "%-15s %-28s %s\\n" $jail_ip $jail_hostname $jail_rootdir 202 printf "%-15s %-28s %s\\n" $jail_ip $jail_hostname $jail_rootdir
192 done 203 done
204
193 ;; 205 ;;
194setup|update) 206setup|update)
195######################## ezjail-admin UPDATE ######################## 207######################## ezjail-admin UPDATE ########################
diff --git a/ezjail-config.sh b/ezjail-config.sh
index a84407c..fa02423 100644
--- a/ezjail-config.sh
+++ b/ezjail-config.sh
@@ -2,21 +2,21 @@
2# 2#
3# BEFORE: rcconf 3# BEFORE: rcconf
4 4
5if [ -f /etc/ezjail.template ]; then 5if [ -f /etc/ezjail.flavour ]; then
6 . /etc/ezjail.template 6 . /etc/ezjail.flavour
7 7
8 # we do need to install only once 8 # we do need to install only once
9 # rm -f /etc/ezjail.template 9 # rm -f /etc/ezjail.flavour
10fi 10fi
11 11
12# set defaults 12# set defaults
13ezjail_template_root=${ezjail_template_root:-"/basejail/config/default"} 13ezjail_flavour_root=${ezjail_flavour_root:-"/basejail/config/default"}
14ezjail_template_files=${ezjail_template_files:-""} 14ezjail_flavour_files=${ezjail_flavour_files:-""}
15ezjail_template_users=${ezjail_template_users:-""} 15ezjail_flavour_users=${ezjail_flavour_users:-""}
16ezjail_template_packages=${ezjail_template_packages:-""} 16ezjail_flavour_packages=${ezjail_flavour_packages:-""}
17 17
18# try to create users 18# try to create users
19for user in $ezjail_template_users; do 19for user in $ezjail_flavour_users; do
20 TIFS=$IFS; IFS=:; set -- $user; IFS=$TIFS 20 TIFS=$IFS; IFS=:; set -- $user; IFS=$TIFS
21 21
22 if [ $# -eq 8 ]; then 22 if [ $# -eq 8 ]; then
@@ -45,8 +45,8 @@ for user in $ezjail_template_users; do
45done 45done
46 46
47# try to install files 47# try to install files
48cd $ezjail_template_root 48cd $ezjail_flavour_root
49for file in $ezjail_template_files; do 49for file in $ezjail_flavour_files; do
50 TIFS=$IFS; IFS=:; set -- $file; IFS=$TIFS 50 TIFS=$IFS; IFS=:; set -- $file; IFS=$TIFS
51 51
52 if [ $# -eq 3 -a "$3" ]; then 52 if [ $# -eq 3 -a "$3" ]; then
@@ -60,7 +60,7 @@ done
60 60
61# finally install packages 61# finally install packages
62[ -d /basejail/config/pkg ] && cd /basejail/config/pkg 62[ -d /basejail/config/pkg ] && cd /basejail/config/pkg
63[ $ezjail_template_packages ] && pkg_add $ezjail_template_packages 63[ $ezjail_flavour_packages ] && pkg_add $ezjail_flavour_packages
64 64
65# Get rid off ourself 65# Get rid off ourself
66rm -f /etc/rc.d/ezjail-config.sh 66rm -f /etc/rc.d/ezjail-config.sh