install/install.sh

310 lines
10 KiB
Bash
Raw Normal View History

#!/bin/bash
# Void Linux post-install script
echo "$(tput setaf 3)Starting Void Linux post-install script$(tput sgr 0)"
2020-08-28 12:33:39 +02:00
2020-08-28 19:06:03 +02:00
# Default Answers
cpu="${cpu:-a}"
video="${video:-q}"
2020-09-06 21:53:57 +02:00
shell="${shell:-f}"
2020-08-28 19:06:03 +02:00
pass="${pass:-n}"
wm="${wm:-a}"
2020-09-06 21:53:57 +02:00
term="${term:-s}"
2020-08-28 19:06:03 +02:00
editor="${editor:-m}"
cups="${cups:-y}"
pop="${pop:-y}"
lightdm="${lightdm:-y}"
reboot="${reboot:-n}"
2020-09-06 22:23:34 +02:00
virt="${virt:-y}"
2020-08-28 19:06:03 +02:00
# Ask part
echo "$(tput setaf 1)Which CPU do you use?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "AMD (a) or INTEL (i) [A/i]" -n 1 cpu
2020-08-28 19:26:53 +02:00
cpu="${cpu:-a}"
echo
echo "$(tput setaf 1)Which GPU do you use?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "NVIDIA (n), AMD (a), INTEL (i) or QEMU (q) [n/a/i/Q] " -n 1 video
2020-08-28 19:26:53 +02:00
video="${video:-q}"
echo
2020-08-28 14:48:19 +02:00
if [[ $video = "n" ]]; then
echo "$(tput setaf 1)Do you want to install PCI passthrough?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "NO (n) or YES (y) [N/y]" -n 1 pass
2020-08-28 19:26:53 +02:00
pass="${pass:-n}"
2020-08-28 19:06:03 +02:00
echo
2020-08-28 14:48:19 +02:00
elif [[ $video = "a" ]]; then
echo "$(tput setaf 1)Do you want to install PCI passthrough?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "NO (n) or YES (y) [N/y]" -n 1 pass
2020-08-28 19:26:53 +02:00
pass="${pass:-n}"
2020-08-28 19:06:03 +02:00
echo
2020-08-28 14:48:19 +02:00
elif [[ $video = "i" ]]; then
echo "$(tput setaf 1)Do you want to install PCI passthrough?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "NO (n) or YES (y) [N/y]" -n 1 pass
2020-08-28 19:26:53 +02:00
pass="${pass:-n}"
2020-08-28 19:06:03 +02:00
echo
2020-08-28 14:48:19 +02:00
fi
echo
2020-09-06 21:53:57 +02:00
echo "$(tput setaf 1)Which shell do you want to use?$(tput sgr 0)"
read -p "FISH (f) or BASH (b) or ZSH (z) [F/b/z]" -n 1 shell
shell="${shell:-f}"
echo
echo "$(tput setaf 1)Which window manager do you want to use?$(tput sgr 0)"
2020-08-28 19:06:03 +02:00
read -p "OPENBOX (o) or AWESOME (a) or SOMETHING ELSE (s) [o/A/s]" -n 1 wm
2020-08-28 19:26:53 +02:00
wm="${wm:-a}"
2020-09-06 22:48:15 +02:00
echo
2020-09-06 22:46:16 +02:00
if [[ $wm = "a" ]]; then
echo "$(tput setaf 1)Which terminal emulator do you want to use?$(tput sgr 0)"
read -p "SAKURA (s) or XTERM (x) or TERMINATOR (t) [S/x/t]" -n 1 term
term="${term:-s}"
2020-09-06 22:46:16 +02:00
elif [[ $wm = "o" ]]; then
2020-09-06 22:44:01 +02:00
echo "$(tput setaf 1)Which terminal emulator do you want to use?$(tput sgr 0)"
read -p "SAKURA (s) or XTERM (x) or TERMINATOR (t) [S/x/t]" -n 1 term
term="${term:-s}"
2020-09-06 21:56:26 +02:00
fi
echo
echo "$(tput setaf 1)Which text editor do you want to use?$(tput sgr 0)"
2020-08-28 16:06:01 +02:00
read -p "NANO (n) or MICRO (m) or VIM (v) [n/M/v]" -n 1 editor
2020-08-28 19:26:53 +02:00
editor="${editor:-m}"
echo
echo "$(tput setaf 1)Do you want to install printer support?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "NO (n) or YES (y) [n/Y]" -n 1 cups
2020-08-28 19:26:53 +02:00
cups="${cups:-y}"
echo
echo "$(tput setaf 1)Do you want to share package statistics with void devs?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "NO (n) or YES (y) [n/Y]" -n 1 pop
2020-08-28 19:26:53 +02:00
pop="${pop:-y}"
echo
2020-09-06 22:23:34 +02:00
echo "$(tput setaf 1)Do you want to install virt-manager?$(tput sgr 0)"
read -p "NO (n) or YES (y) [n/Y]" -n 1 virt
virt="${virt:-y}"
echo
# Install packages -----------------------------------------------------------------------------------------
2020-08-28 03:25:21 +02:00
# Nonfree and multilib repos
2020-09-06 22:54:41 +02:00
chmod +x piu
2020-09-06 22:52:41 +02:00
sudo ./piu u
sudo ./piu i $(cat INSTALL/1_repos)
sudo ./piu u
sudo ./piu i $(cat INSTALL/2_base)
2020-08-23 20:41:58 +02:00
2020-08-28 03:25:21 +02:00
# Remember git login information?
#git config --global credential.helper store
# Clone also personal dotfiles from gitlab?
2020-08-27 06:27:28 +02:00
#git clone https://gitlab.com/awesome-void/awesomeVoid ~/bin/dotfiles
# Choose editor -----------------------------------------------------------------------------------------
if [[ $editor = "n" ]]; then
sudo xbps-install -y nano
export EDITOR=nano
2020-08-28 13:44:22 +02:00
echo EDITOR=nano > ~/.bashrc
2020-08-28 13:26:57 +02:00
elif [[ $editor = "m" ]]; then
sudo xbps-install -y micro
export EDITOR=micro
2020-08-28 13:44:22 +02:00
echo EDITOR=micro > ~/.bashrc
2020-08-28 15:28:22 +02:00
elif [[ $editor = "v" ]]; then
2020-08-28 16:06:01 +02:00
export EDITOR=vim
echo EDITOR=vim > ~/.bashrc
fi
2020-08-29 01:45:42 +02:00
# Choose CPU, GPU, pasthrough -----------------------------------------------------------------------------------------
2020-08-28 10:38:22 +02:00
if [[ $cpu = "a" ]]; then
if [[ $video = "n" ]]; then
sudo xbps-install -y $(cat INSTALL/3_nvidia)
2020-08-28 10:38:22 +02:00
sudo nvidia-xconfig
if [[ $pass = "y" ]]; then
modprobe kvm-amd
sudo cp -r OVMF /usr/share/ovmf
chmod +x INSTALL/pass.sh
sudo ./INSTALL/pass.sh
2020-08-28 10:38:22 +02:00
fi
elif [[ $video = "a" ]]; then
sudo xbps-install -y $(cat INSTALL/3_ati)
if [[ $pass = "y" ]]; then
modprobe kvm-amd
sudo cp -r OVMF /usr/share/ovmf
chmod +x INSTALL/pass.sh
sudo ./INSTALL/pass.sh
2020-08-28 10:38:22 +02:00
fi
elif [[ $video = "i" ]]; then
sudo xbps-install -y $(cat INSTALL/3_intel)
if [[ $pass = "y" ]]; then
modprobe kvm-amd
sudo cp -r OVMF /usr/share/ovmf
chmod +x INSTALL/pass.sh
sudo ./INSTALL/pass.sh
2020-08-28 10:38:22 +02:00
fi
elif [[ $video = "q" ]]; then
sudo xbps-install -y $(cat INSTALL/3_qemu)
fi
elif [[ $cpu = "i" ]]; then
if [[ $video = "n" ]]; then
sudo xbps-install -y $(cat INSTALL/3_nvidia)
2020-08-28 10:38:22 +02:00
sudo nvidia-xconfig
if [[ $pass = "y" ]]; then
echo intel nvidia yes
modprobe kvm-intel
sudo cp -r OVMF /usr/share/ovmf
chmod +x INSTALL/pass.sh
sudo ./INSTALL/pass.sh
2020-08-28 10:38:22 +02:00
fi
elif [[ $video = "a" ]]; then
sudo xbps-install -y $(cat INSTALL/3_ati)
if [[ $pass = "y" ]]; then
echo intel amd yes
modprobe kvm-intel
sudo cp -r OVMF /usr/share/ovmf
chmod +x INSTALL/pass.sh
sudo ./INSTALL/pass.sh
2020-08-28 10:38:22 +02:00
fi
elif [[ $video = "i" ]]; then
sudo xbps-install -y $(cat INSTALL/3_intel)
if [[ $pass = "y" ]]; then
echo intel intel yes
modprobe kvm-intel
sudo cp -r OVMF /usr/share/ovmf
chmod +x INSTALL/pass.sh
sudo ./INSTALL/pass.sh
2020-08-28 10:38:22 +02:00
fi
elif [[ $video = "q" ]]; then
sudo xbps-install -y $(cat INSTALL/3_qemu)
fi
fi
2020-09-06 21:53:57 +02:00
# Choose default shell -----------------------------------------------------------------------------------------
read -p "FISH (f) or BASH (b) or ZSH (z) [F/b/z]" -n 1 shell
shell="${shell:-f}"
if [[ $shell = "f" ]]; then
sudo xbps-install -y fish-shell
sudo usermod --shell /bin/fish $USER
elif [[ $shell = "b" ]]; then
sudo xbps-install -y bash-completion
sudo usermod --shell /bin/bash $USER
elif [[ $shell = "z" ]]; then
sudo xbps-install -y $(cat INSTALL/zsh)
sudo usermod --shell /bin/zsh $USER
fi
# Choose terminal emulator --------------------------------------------------------------------------------------
2020-09-06 21:53:57 +02:00
echo
read -p "SAKURA (s) or XTERM (x) or TERMINATOR (t) [S/x/t]" -n 1 term
if [[ $term = "s" ]]; then
sudo xbps-install -y sakura
2020-09-06 21:53:57 +02:00
export TERM=sakura
echo TERM=sakura > ~/.bashrc
elif [[ $term = "x" ]]; then
sudo xbps-install -y xterm
2020-09-06 21:53:57 +02:00
export TERM=xterm
echo TERM=xterm > ~/.bashrc
elif [[ $term = "t" ]]; then
sudo xbps-install -y terminator
export TERM=terminator
echo TERM=terminator > ~/.bashrc
fi
# Choose window manager -----------------------------------------------------------------------------------------
2020-09-06 21:56:26 +02:00
if [[ $wm = "o" ]]; then
sudo xbps-install -y $(cat INSTALL/4_desktop)
sudo xbps-install -y $(cat INSTALL/5_openbox)
-n 1 desk
sudo -u $USER obmenu-generator -p -i -u -d -c
echo "autorandr common &
tint2 &
setxkbmap cz &
nitrogen --restore &
volumeicon &
conky &" >> ~/.config/openbox/autostart
# cp ~/bin/dotfiles/home/zen/.config/openbox/rc.xml ~/.config/openbox
elif [[ $wm = "a" ]]; then
echo awesome
sudo xbps-install -y $(cat INSTALL/4_desktop)
sudo xbps-install -y $(cat INSTALL/5_awesome)
fi
sudo xbps-install -Sy $(cat INSTALL/6_media)
2020-08-23 09:41:59 +02:00
#sudo xbps-install -Sy $(cat INSTALL/7_virtual)
#sudo xbps-install -Sy $(cat INSTALL/8_big)
#sudo xbps-install -Sy $(cat INSTALL/)
# printer support -----------------------------------------------------------------------------------------
2020-09-06 21:56:26 +02:00
if [[ $cups = "y" ]]; then
sudo xbps-install -y $(cat INSTALL/9_print)
sudo ln -s /etc/sv/cupsd /var/service
fi
2020-09-06 22:23:34 +02:00
# Virtualization support -----------------------------------------------------------------------------------------
if [[ $virt = "y" ]]; then
2020-09-06 22:52:41 +02:00
sudo ./piu i virt-manager qemu
2020-09-06 22:23:34 +02:00
sudo ln -s /etc/sv/libvirtd /var/service
sudo ln -s /etc/sv/virtlockd /var/service
sudo ln -s /etc/sv/virtlogd /var/service
2020-09-06 22:25:32 +02:00
sudo usermod -aG kvm $USER
2020-09-06 22:23:34 +02:00
if [[ $cpu = "a" ]]; then
modprobe kvm-amd
elif [[ $cpu = "i" ]]; then
modprobe kvm-intel
fi
fi
# make fish base shell-----------------------------------------------------------------------------------------
2020-08-25 21:50:56 +02:00
#echo ". ~/.config/fish/aliases.fish" >> ~/.config/fish/config.fish
#echo "alias xterm 'sakura'" >> ~/.config/fish/aliases.fish
2020-08-23 20:45:13 +02:00
# socklog-----------------------------------------------------------------------------------------
2020-08-23 20:45:13 +02:00
sudo usermod -a -G socklog $USER
# Language -----------------------------------------------------------------------------------------
echo "$(tput setaf 1)Unncomment desired language(s) $(tput sgr 0)"
sleep 3
sudo $EDITOR /etc/default/libc-locales
2020-08-23 06:29:31 +02:00
sudo xbps-reconfigure -f glibc-locales
# creating bare repository -----------------------------------------------------------------------------------------
2020-08-23 11:52:45 +02:00
mkdir ~/.void
cd ~/.void
2020-08-15 09:36:25 +02:00
git init --bare
# Share packages with void devs -----------------------------------------------------------------------------------------
2020-08-28 10:38:22 +02:00
if [[ $pop = "y" ]]; then
sudo xbps-install -y PopCorn
sudo ln -s /etc/sv/popcorn /var/service/
fi
2020-08-27 01:53:29 +02:00
# Install services -----------------------------------------------------------------------------------------
sudo ln -s /etc/sv/dbus /var/service/
sudo ln -s /etc/sv/elogind /var/service/
#sudo ln -s /etc/sv/acpid /var/service/
sudo ln -s /etc/sv/socklog-unix /var/service/
sudo ln -s /etc/sv/nanoklogd /var/service/
sudo ln -s /etc/sv/crond /var/service/
sudo ln -s /etc/sv/chronyd /var/service/
2020-08-28 19:06:03 +02:00
if [[ $wm = "o" ]]; then
2020-08-28 13:44:22 +02:00
echo "$(tput setaf 1)Do you want to run lightdm now?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "Run lightdm now? NO (n) or YES (y) [n/Y]" -n 1 lightdm
2020-08-28 19:26:53 +02:00
lightdm="${lightdm:-y}"
2020-08-28 13:44:22 +02:00
echo
if [[ $lightdm = "y" ]]; then
sudo ln -s /etc/sv/lightdm /var/service/
else
sudo touch /etc/sv/lightdm/down
sudo ln -s /etc/sv/lightdm /var/service/
2020-08-28 20:00:10 +02:00
echo "$(tput setaf 3)Remove down file after for run Lightdm..$(tput sgr 0)"
echo "$(tput setaf 3)Use 'sudo rm /etc/sv/lightdm/down'$(tput sgr 0)"
2020-08-28 13:44:22 +02:00
fi
2020-08-28 19:06:03 +02:00
elif [[ $wm = "a" ]]; then
2020-08-28 13:44:22 +02:00
echo "$(tput setaf 1)Do you want to run lightdm now?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "Run lightdm now? NO (n) or YES (y) [n/Y]" -n 1 lightdm
2020-08-28 19:26:53 +02:00
lightdm="${lightdm:-y}"
2020-08-28 13:44:22 +02:00
echo
if [[ $lightdm = "y" ]]; then
sudo ln -s /etc/sv/lightdm /var/service/
else
sudo touch /etc/sv/lightdm/down
sudo ln -s /etc/sv/lightdm /var/service/
2020-08-28 20:00:10 +02:00
echo "$(tput setaf 3)Remove down file after for run Lightdm..$(tput sgr 0)"
echo "$(tput setaf 3)Use 'sudo rm /etc/sv/lightdm/down'$(tput sgr 0)"
2020-08-28 13:44:22 +02:00
fi
2020-08-28 13:50:23 +02:00
fi
2020-08-28 14:06:21 +02:00
echo "$(tput setaf 1)Do you want to restart your computer now?$(tput sgr 0)"
2020-08-28 15:28:22 +02:00
read -p "Restart now? NO (n) or YES (y) [N/y]" -n 1 reboot
2020-08-28 19:26:53 +02:00
reboot="${reboot:-n}"
2020-08-28 14:19:34 +02:00
echo
2020-08-28 13:58:35 +02:00
if [[ $reboot = "n" ]]; then
2020-08-28 14:19:34 +02:00
echo "$(tput setaf 3)Enjoy void linux$(tput sgr 0)"
2020-08-28 13:26:57 +02:00
else
2020-08-28 13:58:35 +02:00
sudo reboot
2020-08-28 10:54:27 +02:00
fi