diff options
author | erdgeist <erdgeist@erdgeist.org> | 2006-02-09 00:44:49 +0000 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2006-02-09 00:44:49 +0000 |
commit | c270955ae0294666d25984244588456723579b38 (patch) | |
tree | e1d810b2fa734daf76aa39d6b0fb284cfba2a798 /ezjail-config.sh | |
parent | ea7235c93e6bf0a241a6767301a7a2de4675d913 (diff) |
Radical change of what an ezjail flavour is. The old way got me stuck.
Diffstat (limited to 'ezjail-config.sh')
-rw-r--r-- | ezjail-config.sh | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/ezjail-config.sh b/ezjail-config.sh deleted file mode 100644 index 71080e2..0000000 --- a/ezjail-config.sh +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | set -o noglob | ||
4 | if [ -f /ezjail.flavour ]; then | ||
5 | . /ezjail.flavour | ||
6 | |||
7 | # we do need to install only once delete here to avoid errors | ||
8 | # in this script to prevent jail startup forever | ||
9 | rm -f /ezjail.flavour | ||
10 | fi | ||
11 | |||
12 | # set defaults | ||
13 | ezjail_flavour_users=${ezjail_flavour_users:-""} | ||
14 | ezjail_flavour_files=${ezjail_flavour_files:-""} | ||
15 | |||
16 | # try to create users, variables named after pw useradd params | ||
17 | for user in ${ezjail_flavour_users}; do | ||
18 | TIFS=${IFS}; IFS=:; set -- ${user}; IFS=${TIFS} | ||
19 | if [ $# -eq 8 ]; then | ||
20 | u=${2:+-u$2}; G=$3; gs=$4; c=${5:+-c$5}; p=${6:-*}; d=${7#-}; m=${7%%[!-]*}; s=${8:+-s$8}; | ||
21 | |||
22 | # ensure all groups | ||
23 | gc=1; for n in `echo -n ${G} | tr , ' '`; do | ||
24 | g=`echo -n ${gs} | cut -d , -f ${gc}` | ||
25 | pw groupadd -q -n ${n} ${g:+-g${g}} | ||
26 | gc=$((1+${gc})) | ||
27 | done | ||
28 | |||
29 | # create user | ||
30 | [ $1 ] && echo ${p} | pw useradd -n $1 ${u} ${s} ${m:+-m} ${d:+-d${d}} ${G:+-G${G}} "`echo -n ${c} | tr = ' '`" -H 0 | ||
31 | fi | ||
32 | done | ||
33 | set +o noglob | ||
34 | |||
35 | # chmod all files not belonging to root | ||
36 | for file in ${ezjail_flavour_files}; do | ||
37 | TIFS=${IFS}; IFS=:; set -- ${file}; IFS=${TIFS} | ||
38 | [ $# -gt 2 ] && owner="$1:$2" && shift 2 && chown -R ${owner} $* | ||
39 | done | ||
40 | |||
41 | # install packages | ||
42 | [ -d /pkg ] && PACKAGESITE=file:// pkg_add -r /pkg/* | ||
43 | |||
44 | # source post install script | ||
45 | [ -d /ezjail.postinstall ] && . /ezjail.postinstall | ||
46 | |||
47 | # Get rid off ourself | ||
48 | rm -rf /pkg /etc/rc.d/ezjail-config.sh /ezjail.postinstall | ||