From cc2c8c85984a9e6611bb04544e7010701e4ed4b3 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 15 Dec 2019 17:38:10 +0100 Subject: Implemented configuration of default user account (without sudo). --- archinstall.sh | 1 + stages/first_stage.sh | 1 + stages/second_stage.sh | 2 +- util/configure_users.sh | 12 +++++++++++- util/write_config.py | 6 ++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/archinstall.sh b/archinstall.sh index 2dd55a7..1e17ab6 100644 --- a/archinstall.sh +++ b/archinstall.sh @@ -37,6 +37,7 @@ export REPOSITORY_PATH="/opt/archinstall" export BRANCH_OR_COMMIT="master" # select another branch name or commit hash if needed export LOG_FILE_PATH="/var/log/archinstall.log" export CONFIG_FILE_PATH="/etc/archinstall/config.json" +export DEFAULT_PASSWORD="archinstall" # PATH expansion diff --git a/stages/first_stage.sh b/stages/first_stage.sh index c257946..1226de0 100644 --- a/stages/first_stage.sh +++ b/stages/first_stage.sh @@ -36,6 +36,7 @@ export boot_partition_path="${disk_path}1" export root_partition_path="${disk_path}2" export hostname=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "hostname") export desktop=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "desktop") +export admin_username=$(python $REPOSITORY_PATH/util/read_config_string.py $CONFIG_FILE_PATH "admin_username") bash confirm_installation.sh $disk diff --git a/stages/second_stage.sh b/stages/second_stage.sh index f4b867e..7020b6b 100644 --- a/stages/second_stage.sh +++ b/stages/second_stage.sh @@ -29,7 +29,7 @@ bash configure_timezone.sh /usr/share/zoneinfo/Europe/Berlin bash configure_network.sh $hostname -bash configure_users.sh +bash configure_users.sh $admin_username $DEFAULT_PASSWORD bash install_bootloader.sh $boot_partition_path diff --git a/util/configure_users.sh b/util/configure_users.sh index b6eba0b..3c2fcc4 100644 --- a/util/configure_users.sh +++ b/util/configure_users.sh @@ -18,6 +18,16 @@ # along with this program. If not, see . -echo "root:root" | chpasswd +admin_username=$1 +default_password=$2 + + +echo "root:$default_password" | chpasswd + +useradd -m $admin_username +usermod -aG wheel $admin_username +echo "$admin_username:$default_password" | chpasswd + +# passwd -l root # lock the root account if changing /etc/sudoers is implemented echo "Configured users - OK" diff --git a/util/write_config.py b/util/write_config.py index 72c1c34..8f9dae9 100644 --- a/util/write_config.py +++ b/util/write_config.py @@ -52,6 +52,12 @@ else: config["desktop"] = "no" +# Admin account + +print("Please select your username (like 'paul' or 'alice'):") +config["admin_username"] = input() + + # Write config to json file config_json = json.dumps(config, indent=4) -- cgit v1.2.3-70-g09d2