Support user:group notation by sysusers.generate-pre.sh script

#Type Name       ID                  GECOS              Home directory Shell
u     user_name  uid:gid             "User Description" /home/dir      /path/to/shell

According to: https://www.freedesktop.org/software/systemd/man/sysusers.d.html
This commit is contained in:
Martin Osvald 2022-11-02 14:38:59 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent b3fa8789f9
commit 83301531c0

View File

@ -70,9 +70,12 @@ parse() {
eval "arr=( $line )" eval "arr=( $line )"
case "${arr[0]}" in case "${arr[0]}" in
('u') ('u')
group "${arr[1]}" "${arr[2]}" if [[ "${arr[2]}" == *":"* ]]; then
user "${arr[1]}" "${arr[2]}" "${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}" user "${arr[1]}" "${arr[2]%:*}" "${arr[3]}" "${arr[2]#*:}" "${arr[4]}" "${arr[5]}"
# TODO: user:group support else
group "${arr[1]}" "${arr[2]}"
user "${arr[1]}" "${arr[2]}" "${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}"
fi
;; ;;
('g') ('g')
group "${arr[1]}" "${arr[2]}" group "${arr[1]}" "${arr[2]}"