debian minor: use "adduser" instead of "useradd"
Create the kurento user as non-login user. The "--disabled-password"
flag causes the user's shell to be set as "/bin/false" in /etc/passwd
#!/usr/bin/env bash
+# File checked with ShellCheck (https://www.shellcheck.net/)
-# NOTE: Code here must match with
+# NOTE: This file must have the same contents than
# kurento-media-server/debian/kurento-media-server.postinst
@@ -27,7 +28,11 @@ HOME_DIR="/var/lib/kurento"
# -----------------------
if ! id kurento >/dev/null 2>&1; then
- useradd --home-dir "$HOME_DIR" --system kurento
+ adduser \
+ --system --group \
+ --home "$HOME_DIR" \
+ --disabled-password \
+ kurento
fi
@@ -43,7 +48,7 @@ chmod 777 "$HOME_DIR"
# keep it as a symlink to avoid breaking user's setups,
# but delete this code once releasing next major version of Kurento
HOME_DIR_OLD="/var/kurento"
-if [ -d "$HOME_DIR_OLD" -a ! -L "$HOME_DIR_OLD" ]; then
+if [[ -d "$HOME_DIR_OLD" && ! -L "$HOME_DIR_OLD" ]]; then
mv "$HOME_DIR_OLD"/* "$HOME_DIR_OLD"/.* "$HOME_DIR"/ 2>/dev/null || true
rmdir "$HOME_DIR_OLD"
ln -s -T "$HOME_DIR" "$HOME_DIR_OLD"
