Add script for adding default user
This commit is contained in:
parent
459f5df08e
commit
2292ff7387
2 changed files with 24 additions and 3 deletions
|
@ -9,6 +9,10 @@ ARCH_LANG="en_US.UTF-8";
|
|||
ARCH_KEYMAP="de_CH-latin1";
|
||||
LOCALE_PATTERN="\(de_CH\|en_US\)";
|
||||
|
||||
USER_NAME="${USER_NAME}";
|
||||
USER_DISPLAYNAME="${USER_DISPLAYNAME}";
|
||||
USER_GROUPS="${USER_GROUPS}";
|
||||
|
||||
projectRoot="$(realpath ../../..)";
|
||||
projectName="$(basename "$projectRoot")";
|
||||
relativeDir="$(realpath --relative-to "$projectRoot" "$(pwd)")";
|
||||
|
@ -33,10 +37,13 @@ echo "KEYMAP=$ARCH_KEYMAP" | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/vconsole.co
|
|||
arch-chroot "$ARCH_MOUNT_ROOT" echo "$ARCH_HOSTNAME" > /etc/hostname;
|
||||
arch-chroot "$ARCH_MOUNT_ROOT" mkinitcpio -P;
|
||||
|
||||
echo "Please choose a password for the user \`root\`";
|
||||
arch-chroot "$ARCH_MOUNT_ROOT" passwd;
|
||||
|
||||
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/../Software/GRUB/install.sh";
|
||||
arch-chroot "$ARCH_MOUNT_ROOT" rm -rf "$tempRoot";
|
||||
|
||||
|
||||
USER_NAME="${USER_NAME}" \
|
||||
USER_DISPLAYNAME="${USER_DISPLAYNAME}" \
|
||||
USER_GROUPS="${USER_GROUPS}" \
|
||||
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/user.sh";
|
||||
|
||||
popd > /dev/null;
|
||||
|
|
14
scripts/Arch/OS/user.sh
Normal file
14
scripts/Arch/OS/user.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
USER_NAME="${USER_NAME}";
|
||||
USER_DISPLAYNAME="${USER_DISPLAYNAME}";
|
||||
USER_GROUPS="${USER_GROUPS}";
|
||||
useradd --create-home --comment "$USER_DISPLAYNAME" --groups wheel "$USER_NAME";
|
||||
usermod -aG wheel "$USER_NAME";
|
||||
|
||||
if [ ! -z "$USER_GROUPS" ]
|
||||
then
|
||||
usermod -aG "$USER_GROUPS" "$USER_NAME";
|
||||
fi;
|
||||
|
||||
echo "Please Choose a New Password for User \`$USER_NAME\`";
|
||||
passwd "$USER_NAME";
|
Loading…
Reference in a new issue