installer.sh.in: add user account dialog
Unified · Split
| @@ -32,6 +32,8 @@ KEYBOARD_DONE= · 31 unmodified lines | |||
| 32 | LOCALE_DONE= | 32 | LOCALE_DONE= |
| 33 | TIMEZONE_DONE= | 33 | TIMEZONE_DONE= |
| 34 | ROOTPASSWORD_DONE= | 34 | ROOTPASSWORD_DONE= |
| 35 | USERNAME_DONE= | ||
| 36 | USERPASSWORD_DONE= | ||
| 35 | BOOTLOADER_DONE= | 37 | BOOTLOADER_DONE= |
| 36 | PARTITIONS_DONE= | 38 | PARTITIONS_DONE= |
| 37 | NETWORK_DONE= | 39 | NETWORK_DONE= |
| @@ -421,6 +423,55 @@ set_rootpassword() { · 383 unmodified lines | |||
| 421 | echo "root:$(get_option ROOTPASSWORD)" | chpasswd -R $TARGETDIR -c SHA512 | 423 | echo "root:$(get_option ROOTPASSWORD)" | chpasswd -R $TARGETDIR -c SHA512 |
| 422 | } | 424 | } |
| 423 | 425 | ||
| 426 | menu_useraccount() { | ||
| 427 | local _firstpass= _secondpass= _desc= | ||
| 428 | |||
| 429 | while true; do | ||
| 430 | DIALOG --inputbox "Select primary user name:" ${INPUTSIZE} "void" | ||
| 431 | if [ $? -eq 0 ]; then | ||
| 432 | set_option USERNAME "$(cat $ANSWER)" | ||
| 433 | USERNAME_DONE=1 | ||
| 434 | break | ||
| 435 | else | ||
| 436 | return | ||
| 437 | fi | ||
| 438 | done | ||
| 439 | |||
| 440 | while true; do | ||
| 441 | if [ -n "${_firstpass}" ]; then | ||
| 442 | _desc="Enter the password for '$(get_option USERNAME)' again (password won't be displayed)" | ||
| 443 | else | ||
| 444 | _desc="Enter the password for '$(get_option USERNAME)' (password won't be displayed)" | ||
| 445 | fi | ||
| 446 | DIALOG --passwordbox "${_desc}" ${MSGBOXSIZE} | ||
| 447 | if [ $? -eq 0 ]; then | ||
| 448 | if [ -z "${_firstpass}" ]; then | ||
| 449 | _firstpass="$(cat $ANSWER)" | ||
| 450 | else | ||
| 451 | _secondpass="$(cat $ANSWER)" | ||
| 452 | fi | ||
| 453 | if [ -n "${_firstpass}" -a -n "${_secondpass}" ]; then | ||
| 454 | if [ "${_firstpass}" != "${_secondpass}" ]; then | ||
| 455 | DIALOG --infobox "Passwords do not match! please reenter it again" 6 80 | ||
| 456 | unset _firstpass _secondpass | ||
| 457 | sleep 2 && continue | ||
| 458 | fi | ||
| 459 | set_option USERPASSWORD "${_firstpass}" | ||
| 460 | USERPASSWORD_DONE=1 | ||
| 461 | break | ||
| 462 | fi | ||
| 463 | else | ||
| 464 | return | ||
| 465 | fi | ||
| 466 | done | ||
| 467 | } | ||
| 468 | |||
| 469 | set_useraccount() { | ||
| 470 | useradd -R $TARGETDIR -m -G wheel,audio,video,floppy,cdrom,optical,kvm,xbuilder \ | ||
| 471 | "$(get_option USERNAME)" | ||
| 472 | echo "$(get_option USERNAME):$(get_option USERPASSWORD)" | chpasswd -R $TARGETDIR -c SHA512 | ||
| 473 | } | ||
| 474 | |||
| 424 | menu_bootloader() { | 475 | menu_bootloader() { |
| 425 | while true; do | 476 | while true; do |
| 426 | DIALOG --title " Select the disk to install the bootloader" \ | 477 | DIALOG --title " Select the disk to install the bootloader" \ |
| @@ -476,7 +527,7 @@ configure_wifi() { · 49 unmodified lines | |||
| 476 | 527 | ||
| 477 | DIALOG --form "Wireless configuration for ${dev}\n(encryption type: wep or wpa)" 0 0 0 \ | 528 | DIALOG --form "Wireless configuration for ${dev}\n(encryption type: wep or wpa)" 0 0 0 \ |
| 478 | "SSID:" 1 1 "" 1 16 30 0 \ | 529 | "SSID:" 1 1 "" 1 16 30 0 \ |
| 479 | "Encryption:" 2 1 "" 2 16 3 0 \ | 530 | "Encryption:" 2 1 "" 2 16 4 3 \ |
| 480 | "Password:" 3 1 "" 3 16 50 0 || return 1 | 531 | "Password:" 3 1 "" 3 16 50 0 || return 1 |
| 481 | set -- $(cat $ANSWER) | 532 | set -- $(cat $ANSWER) |
| 482 | ssid="$1"; enc="$2"; pass="$3"; | 533 | ssid="$1"; enc="$2"; pass="$3"; |
| @@ -889,6 +940,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return · 406 unmodified lines | |||
| 889 | set_timezone | 940 | set_timezone |
| 890 | set_hostname | 941 | set_hostname |
| 891 | set_rootpassword | 942 | set_rootpassword |
| 943 | set_useraccount | ||
| 892 | 944 | ||
| 893 | # Copy /etc/skel files for root. | 945 | # Copy /etc/skel files for root. |
| 894 | cp $TARGETDIR/etc/skel/.[bix]* $TARGETDIR/root | 946 | cp $TARGETDIR/etc/skel/.[bix]* $TARGETDIR/root |
| @@ -973,6 +1025,7 @@ menu() { · 78 unmodified lines | |||
| 973 | "Locale" "Set system locale" \ | 1025 | "Locale" "Set system locale" \ |
| 974 | "Timezone" "Set system time zone" \ | 1026 | "Timezone" "Set system time zone" \ |
| 975 | "RootPassword" "Set system root password" \ | 1027 | "RootPassword" "Set system root password" \ |
| 1028 | "UserAccount" "Set primary user name and password" \ | ||
| 976 | "BootLoader" "Set disk to install bootloader" \ | 1029 | "BootLoader" "Set disk to install bootloader" \ |
| 977 | "Partition" "Partition disk(s)" \ | 1030 | "Partition" "Partition disk(s)" \ |
| 978 | "Filesystems" "Configure filesystems and mount points" \ | 1031 | "Filesystems" "Configure filesystems and mount points" \ |
| @@ -995,7 +1048,9 @@ menu() { · 16 unmodified lines | |||
| 995 | "Hostname") menu_hostname && [ -n "$HOSTNAME_DONE" ] && DEFITEM="Locale";; | 1048 | "Hostname") menu_hostname && [ -n "$HOSTNAME_DONE" ] && DEFITEM="Locale";; |
| 996 | "Locale") menu_locale && [ -n "$LOCALE_DONE" ] && DEFITEM="Timezone";; | 1049 | "Locale") menu_locale && [ -n "$LOCALE_DONE" ] && DEFITEM="Timezone";; |
| 997 | "Timezone") menu_timezone && [ -n "$TIMEZONE_DONE" ] && DEFITEM="RootPassword";; | 1050 | "Timezone") menu_timezone && [ -n "$TIMEZONE_DONE" ] && DEFITEM="RootPassword";; |
| 998 | "RootPassword") menu_rootpassword && [ -n "$ROOTPASSWORD_DONE" ] && DEFITEM="BootLoader";; | 1051 | "RootPassword") menu_rootpassword && [ -n "$ROOTPASSWORD_DONE" ] && DEFITEM="UserAccount";; |
| 1052 | "UserAccount") menu_useraccount && [ -n "$USERNAME_DONE" ] && [ -n "$USERPASSWORD_DONE" ] \ | ||
| 1053 | && DEFITEM="BootLoader";; | ||
| 999 | "BootLoader") menu_bootloader && [ -n "$BOOTLOADER_DONE" ] && DEFITEM="Partition";; | 1054 | "BootLoader") menu_bootloader && [ -n "$BOOTLOADER_DONE" ] && DEFITEM="Partition";; |
| 1000 | "Partition") menu_partitions && [ -n "$PARTITIONS_DONE" ] && DEFITEM="Filesystems";; | 1055 | "Partition") menu_partitions && [ -n "$PARTITIONS_DONE" ] && DEFITEM="Filesystems";; |
| 1001 | "Filesystems") menu_filesystems && [ -n "$FILESYSTEMS_DONE" ] && DEFITEM="Install";; | 1056 | "Filesystems") menu_filesystems && [ -n "$FILESYSTEMS_DONE" ] && DEFITEM="Install";; |