diff options
author | erdgeist <erdgeist@erdgeist.org> | 2005-11-08 15:11:51 +0000 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2005-11-08 15:11:51 +0000 |
commit | cb9940f7341d63e385d804464fb1939de9a4e6e1 (patch) | |
tree | 28facca25b896e90e93f50faf7967b5e6dd82b9e /ezjail-config.sh | |
parent | 6ca864f1251d64fb0bf647be29cd5a14a88d583e (diff) |
Start of default config sub system
Diffstat (limited to 'ezjail-config.sh')
-rw-r--r-- | ezjail-config.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ezjail-config.sh b/ezjail-config.sh new file mode 100644 index 0000000..0b9d083 --- /dev/null +++ b/ezjail-config.sh | |||
@@ -0,0 +1,43 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if [ -f /etc/ezjail.template ]; then | ||
4 | . /etc/ezjail.template | ||
5 | |||
6 | # we do need to install only once | ||
7 | # rm /etc/ezjail.template | ||
8 | fi | ||
9 | |||
10 | # set defaults | ||
11 | ezjail_template_root=${ezjail_template_root:-"/basejail/config/_JAILNAME_"} | ||
12 | ezjail_template_files=${ezjail_template_files:-""} | ||
13 | ezjail_template_users=${ezjail_template_users:-""} | ||
14 | ezjail_template_packages=${ezjail_template_packages:-""} | ||
15 | |||
16 | # try to create users | ||
17 | for user in $ezjail_template_users; do | ||
18 | TIFS=$IFS; IFS=:; set -- $user; IFS=$TIFS | ||
19 | if [ $# -eq 7 ]; then | ||
20 | name=$1; grouplist=$3; gidlist=$4 | ||
21 | |||
22 | [ $2 ] && uid="-u $2" || uid="" | ||
23 | [ $5 ] && pass=$5 || pass="*" | ||
24 | [ $6 ] && home=$6 | ||
25 | [ $7 ] && shell="-s $7" | ||
26 | |||
27 | [ x$6 = x${6#-} ] && mkhome="-r" || mkhome=""; home=${6#-} | ||
28 | [ $home ] && home="-h $home"; | ||
29 | |||
30 | if [ $grouplist ]; then | ||
31 | gc=1 | ||
32 | for $group in `echo $grouplist | tr "," " "`; do | ||
33 | gid=`echo $gidlist | cut -d , -f $gc`; [ $gid ] && gid="-n $gid" | ||
34 | echo pw groupadd -n $group $gid | ||
35 | gc=(($gc + 1)) | ||
36 | done | ||
37 | endif | ||
38 | if [ $name ]; then | ||
39 | echo pw useradd $name $uid $shell $home $grouplist | ||
40 | fi | ||
41 | fi | ||
42 | |||
43 | done | ||