Ajout : etc/user.d/ .
[lhc/ateliers.git] / vm_hosted
index c019315..f80192c 100755 (executable)
--- a/vm_hosted
+++ b/vm_hosted
@@ -1462,13 +1462,12 @@ rule_unbound_configure () {
        sudo service unbound restart
  }
 rule_user_add () { # SYNTAX: $user
-       rule user_configure
-       local user=$1
-       rule adduser "$user" --disabled-password
+       local user="$1"; shift
+       rule adduser "$user" --disabled-password "$@"
                # NOTE: le mot-de-passe doit être initialisé par l'utilisateur à l'aide de passwd-init .
        eval local home\; home="~$user"
        sudo adduser "$user" users
-       sudo install -m 640 -o root -g root \
+       sudo install -m 640 -o "$user" -g "$user" \
         "$tool"/var/pub/ssh/"$user".key \
         "$home"/etc/ssh/authorized_keys
        local key; local -; set +f
@@ -1496,7 +1495,9 @@ rule_user_configure () {
                LAST_UID=29999
                LETTERHOMES=no
                NAME_REGEX="^[a-z][-a-z0-9_]*\$"
-               QUOTAUSER="" # TODO: init
+               QUOTAUSER=""
+               # TODO: configure a template user (with edquota or setquota)
+               # and indicate their user name in the QUOTAUSER variable.
                SETGID_HOME=no
                SKEL=/etc/skel
                SKEL_IGNORE_REGEX="dpkg-(old|new|dist|save)"
@@ -1545,6 +1546,12 @@ rule_user_configure () {
        sudo install -m 644 -o root -g root \
         "$tool"/etc/screenrc \
                /etc/screenrc
+       local sh; local -; set +f
+       for sh in "$tool"/etc/user.d/*/configure.sh
+        do sh=${sh#"$tool"/etc/user.d/}
+               local user="${sh%/configure.sh}"
+               . "$tool"/etc/user.d/"$sh"
+        done
  }
 rule_user_admin_add () { # SYNTAX: $user
        rule user_configure