arch-maride-flavour/flavours/user.flavour/install.sh

38 lines
1.2 KiB
Bash
Raw Normal View History

2017-08-06 15:38:48 +00:00
#!/bin/sh
2017-08-10 15:03:32 +00:00
echo "~> Changing password for root account."
arch-chroot /mnt passwd root
2017-08-06 15:38:48 +00:00
echo -n "~> Do you want to create an user account? (Y/n) "
read answer
2017-08-07 16:02:57 +00:00
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
amf_return=0
2017-08-06 15:38:48 +00:00
else
2017-08-07 14:25:59 +00:00
echo -n " Name of your new user? "
2017-08-06 15:38:48 +00:00
read name
2017-08-07 16:16:05 +00:00
export username=$name
2017-08-06 15:38:48 +00:00
arch-chroot /mnt useradd -m $name
2017-09-02 14:55:17 +00:00
arch-chroot /mnt passwd $name
# If group "sudo" exists (=> sudo.flavour was installed), ask if the user should be added
2017-09-02 15:16:26 +00:00
if [ $(arch-chroot /mnt getent group sudo) ]; then
2017-09-02 14:55:17 +00:00
echo -n "~> Do you want to add $name to sudoers? (Y/n) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
2017-09-02 23:46:37 +00:00
arch-chroot /mnt usermod -a -G sudo $name
2017-09-02 14:55:17 +00:00
fi
fi
2017-09-02 23:45:48 +00:00
echo -n " Set up zsh with ohmyzsh for $name? (Y/n) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
pacstrap /mnt zsh git
2017-09-04 14:39:53 +00:00
arch-chroot /mnt git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git /home/$name/.oh-my-zsh
2017-09-02 23:45:48 +00:00
wget https://git.darknebu.la/maride/config/raw/master/zshrc -O /mnt/home/$name/.zshrc
2017-09-13 13:40:15 +00:00
arch-chroot /mnt chsh -s /bin/zsh $name
2017-09-02 23:45:48 +00:00
fi
amf_return=0
2017-08-06 15:38:48 +00:00
fi