add usermanagement

This commit is contained in:
Tobias Powalowski 2024-06-01 13:58:09 +02:00
parent 3092fec026
commit 9942573bea

View file

@ -96,6 +96,7 @@ _set_password() {
} }
_user_management() { _user_management() {
_NEXTITEM=1
while true; do while true; do
_dialog --title " User Management " --no-cancel ${_DEFAULT} --menu "" 10 40 7 \ _dialog --title " User Management " --no-cancel ${_DEFAULT} --menu "" 10 40 7 \
"1" "Set Root Password" \ "1" "Set Root Password" \
@ -105,6 +106,7 @@ _user_management() {
_FILE="$(cat "${_ANSWER}")" _FILE="$(cat "${_ANSWER}")"
if [[ "${_FILE}" = "1" ]]; then if [[ "${_FILE}" = "1" ]]; then
_set_password Root root _set_password Root root
_NEXTITEM=2
elif [[ "${_FILE}" = "2" ]]; then elif [[ "${_FILE}" = "2" ]]; then
_dialog --title " Default Shell " --no-cancel --menu "" 8 45 2 \ _dialog --title " Default Shell " --no-cancel --menu "" 8 45 2 \
"BASH" "Standard Shell" \ "BASH" "Standard Shell" \
@ -132,6 +134,7 @@ _user_management() {
# change default shell # change default shell
sed -i -e "s#^SHELL=.*#SHELL=/usr/bin/${_SHELL}#g" "${_DESTDIR}"/etc/default/useradd sed -i -e "s#^SHELL=.*#SHELL=/usr/bin/${_SHELL}#g" "${_DESTDIR}"/etc/default/useradd
fi fi
_NEXTITEM=3
elif [[ "${_FILE}" = "3" ]]; then elif [[ "${_FILE}" = "3" ]]; then
_USER="" _USER=""
while [[ -z "${_USER}" ]]; do while [[ -z "${_USER}" ]]; do
@ -150,7 +153,9 @@ _user_management() {
done done
chroot "${_DESTDIR}" useradd -c "${_FN}" -m "${_USER}" chroot "${_DESTDIR}" useradd -c "${_FN}" -m "${_USER}"
_set_password User ${_USER} _set_password User ${_USER}
_NEXTITEM=4
elif [[ "${_FILE}" = "4" ]]; then elif [[ "${_FILE}" = "4" ]]; then
_NEXTITEM=3
break break
fi fi
done done