debian: 旧版 adduser 使用 --gecos

fixes #672
This commit is contained in:
bin456789
2026-09-23 22:13:20 +08:00
parent cab470fdec
commit 2bcbc96100
+9 -2
View File
@@ -4671,11 +4671,18 @@ add_user_if_need() {
chroot "$os_dir" adduser --help 2>&1 | grep -Fq -- BusyBox; then
chroot "$os_dir" adduser --disabled-password "$username"
# debian/ubuntu
# 新版 debian/ubuntu
elif is_have_cmd_on_disk "$os_dir" adduser &&
chroot "$os_dir" adduser --help 2>&1 | grep -Fq -- '--disabled-password'; then
chroot "$os_dir" adduser --help 2>&1 | grep -Fq -- '--disabled-password' &&
chroot "$os_dir" adduser --help 2>&1 | grep -Fq -- '--comment'; then
chroot "$os_dir" adduser --disabled-password --comment '' "$username"
# 旧版 debian/ubuntu
elif is_have_cmd_on_disk "$os_dir" adduser &&
chroot "$os_dir" adduser --help 2>&1 | grep -Fq -- '--disabled-password' &&
chroot "$os_dir" adduser --help 2>&1 | grep -Fq -- '--gecos'; then
chroot "$os_dir" adduser --disabled-password --gecos '' "$username"
# el
elif is_have_cmd_on_disk "$os_dir" adduser &&
chroot "$os_dir" adduser --help 2>&1 | grep -Fq -- '--password'; then