File user of Package jeos-firstboot-module-user

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Copyright 2023 Richard Brown

user_jeos_config()
{
    d --inputbox $"Enter username" 0 0
    firstuser="$result"
    while true; do
        d --insecure --passwordbox $"Enter password" 0 0
        userpass="$result"
        d --insecure --passwordbox $"Confirm password" 0 0
    if [ "$userpass" != "$result" ]; then
        d --msgbox $"Entered passwords don't match" 5 40
        continue
    fi
    if [ -z "$userpass" ]; then
        d --msgbox $"You must set a password" 5 40
        continue
    fi
    break
    done
    run useradd $firstuser &>/dev/null
    run echo "$firstuser:$userpass" | run /usr/sbin/chpasswd
    if dialog --defaultno --yesno $"Enable autologin for this user?" 0 0; then
         mkdir -p /etc/systemd/system/getty@tty1.service.d
         cat << EOF > /etc/systemd/system/getty@tty1.service.d/autologin.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty -a $firstuser %I \$TERM
EOF
    fi
}

user_systemd_firstboot()
{
     user_jeos_config
}

openSUSE Build Service is sponsored by