arch-maride-flavour/flavours/user.flavour/install.sh
2017-09-04 16:39:53 +02:00

37 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
echo "~> Changing password for root account."
arch-chroot /mnt passwd root
echo -n "~> Do you want to create an user account? (Y/n) "
read answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
amf_return=0
else
echo -n " Name of your new user? "
read name
export username=$name
arch-chroot /mnt useradd -m $name
arch-chroot /mnt passwd $name
# If group "sudo" exists (=> sudo.flavour was installed), ask if the user should be added
if [ $(arch-chroot /mnt getent group sudo) ]; then
echo -n "~> Do you want to add $name to sudoers? (Y/n) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
arch-chroot /mnt usermod -a -G sudo $name
fi
fi
echo -n " Set up zsh with ohmyzsh for $name? (Y/n) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
pacstrap /mnt zsh git
arch-chroot /mnt git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git /home/$name/.oh-my-zsh
wget https://git.darknebu.la/maride/config/raw/master/zshrc -O /mnt/home/$name/.zshrc
fi
amf_return=0
fi