summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2019-12-15 17:38:10 +0100
committerxengineering <mail2xengineering@protonmail.com>2019-12-15 17:38:10 +0100
commitcc2c8c85984a9e6611bb04544e7010701e4ed4b3 (patch)
treee4a3cc6ee5ffff0ebfaaa600fa9f450f52e14c2a
parent42cc3111a23ae0d2d61dc587acd1eaf21b3817c1 (diff)
downloadarchinstall-cc2c8c85984a9e6611bb04544e7010701e4ed4b3.tar
archinstall-cc2c8c85984a9e6611bb04544e7010701e4ed4b3.tar.zst
archinstall-cc2c8c85984a9e6611bb04544e7010701e4ed4b3.zip
Implemented configuration of default user account (without sudo).
-rw-r--r--archinstall.sh1
-rw-r--r--stages/first_stage.sh1
-rw-r--r--stages/second_stage.sh2
-rw-r--r--util/configure_users.sh12
-rw-r--r--util/write_config.py6
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 <https://www.gnu.org/licenses/>.
-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)