summaryrefslogtreecommitdiff
path: root/ezjail-config.sh
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2006-02-07 14:41:10 +0000
committererdgeist <erdgeist@erdgeist.org>2006-02-07 14:41:10 +0000
commit05e763eb61b5e037ec65ec752f3b322de1ea7d57 (patch)
tree1ffa473d5aca28f17be51ff3f7c10577f75e72b5 /ezjail-config.sh
parentfba1ca82f1b96feb5b4e62b85cf195ed727c7990 (diff)
Cosmetics.
Diffstat (limited to 'ezjail-config.sh')
-rw-r--r--ezjail-config.sh26
1 files changed, 13 insertions, 13 deletions
diff --git a/ezjail-config.sh b/ezjail-config.sh
index 927ab23..3a1d8ea 100644
--- a/ezjail-config.sh
+++ b/ezjail-config.sh
@@ -14,8 +14,8 @@ ezjail_flavour_users=${ezjail_flavour_users:-""}
14ezjail_flavour_files=${ezjail_flavour_files:-""} 14ezjail_flavour_files=${ezjail_flavour_files:-""}
15 15
16# try to create users 16# try to create users
17for user in $ezjail_flavour_users; do 17for user in ${ezjail_flavour_users}; do
18 TIFS=$IFS; IFS=:; set -- $user; IFS=$TIFS 18 TIFS=${IFS}; IFS=:; set -- ${user}; IFS=${TIFS}
19 if [ $# -eq 8 ]; then 19 if [ $# -eq 8 ]; then
20 gc=1; name=$1; grouplist=$3; gidlist=$4; home=$7 20 gc=1; name=$1; grouplist=$3; gidlist=$4; home=$7
21 21
@@ -24,31 +24,31 @@ for user in $ezjail_flavour_users; do
24 [ $6 ] && pass="$6" || pass="*" 24 [ $6 ] && pass="$6" || pass="*"
25 [ $8 ] && shell="-s $8" || shell="" 25 [ $8 ] && shell="-s $8" || shell=""
26 26
27 [ "$home" = "${home#-}" ] && mkhome="-m" || mkhome="" 27 [ "${home}" = "${home#-}" ] && mkhome="-m" || mkhome=""
28 [ ${home#-} ] && home="-d ${home#-}" || home="" 28 [ ${home#-} ] && home="-d ${home#-}" || home=""
29 29
30 # ensure all groups 30 # ensure all groups
31 if [ $grouplist ]; then 31 if [ ${grouplist} ]; then
32 for group in `echo $grouplist | tr "," " "`; do 32 for group in `echo -n ${grouplist} | tr "," " "`; do
33 gid=`echo $gidlist | cut -d , -f $gc`; [ $gid ] && gid="-g $gid" 33 gid=`echo ${gidlist} | cut -d , -f ${gc}`; [ "${gid}" ] && gid="-g ${gid}"
34 pw groupadd -n $group $gid 34 pw groupadd -n ${group} ${gid}
35 gc=$((1+$gc)) 35 gc=$((1+${gc}))
36 done 36 done
37 fi 37 fi
38 # create user 38 # create user
39 [ $grouplist ] && grouplist="-G $grouplist" 39 [ "${grouplist}" ] && grouplist="-G ${grouplist}"
40 [ $name ] && echo "$pass" | pw useradd -n $name $uid $shell $mkhome $home $grouplist "`echo $comment | tr = ' '`" -H 0 40 [ "${name}" ] && echo "${pass}" | pw useradd -n ${name} ${uid} ${shell} ${mkhome} ${home} ${grouplist} "`echo -n${comment} | tr = ' '`" -H 0
41 fi 41 fi
42done 42done
43 43
44# chmod all files not belonging to root 44# chmod all files not belonging to root
45for file in $ezjail_flavour_files; do 45for file in ${ezjail_flavour_files}; do
46 TIFS=$IFS; IFS=:; set -- $file; IFS=$TIFS 46 TIFS=${IFS}; IFS=:; set -- ${file}; IFS=${TIFS}
47 set +o noglob 47 set +o noglob
48 if [ $# -eq 3 -a "$3" ]; then 48 if [ $# -eq 3 -a "$3" ]; then
49 owner=$1; [ $2 ] && owner="$1:$2" 49 owner=$1; [ $2 ] && owner="$1:$2"
50 for file in ./$3; do 50 for file in ./$3; do
51 chown -R $owner /$file 51 chown -R ${owner} /${file}
52 done 52 done
53 fi 53 fi
54 set -o noglob 54 set -o noglob