install/install.sh

308 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-09-07 00:48:42 +02:00
# Default Answers ------------------------------------------------------------------------------------------------
2020-08-28 19:06:03 +02:00
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
2020-09-07 00:48:42 +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}"
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 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 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 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-07 01:20:10 +02:00
sudo ./piu u -y
sudo ./piu i -y $(cat INSTALL/01_repos)
2020-09-07 01:20:10 +02:00
sudo ./piu u -y
sudo ./piu i -y $(cat INSTALL/02_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
2020-09-06 23:05:49 +02:00
sudo ./piu i -y nano
2020-09-07 00:48:42 +02:00
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
2020-09-06 23:05:49 +02:00
sudo ./piu i -y micro
2020-09-07 00:48:42 +02:00
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-09-07 00:48:42 +02:00
export EDITOR="vim"
2020-08-28 16:06:01 +02:00
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 ./piu i -y $(cat INSTALL/03_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 ./piu i -y $(cat INSTALL/03_ati)
2020-08-28 10:38:22 +02:00
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 ./piu i -y $(cat INSTALL/03_intel)
2020-08-28 10:38:22 +02:00
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 ./piu i -y $(cat INSTALL/03_qemu)
2020-08-28 10:38:22 +02:00
fi
elif [[ $cpu = "i" ]]; then
if [[ $video = "n" ]]; then
sudo ./piu i -y $(cat INSTALL/03_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 ./piu i -y $(cat INSTALL/03_ati)
2020-08-28 10:38:22 +02:00
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 ./piu i -y $(cat INSTALL/03_intel)
2020-08-28 10:38:22 +02:00
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 ./piu i -y $(cat INSTALL/03_qemu)
2020-08-28 10:38:22 +02:00
fi
fi
2020-09-06 21:53:57 +02:00
# Choose default shell -----------------------------------------------------------------------------------------
if [[ $shell = "f" ]]; then
2020-09-06 23:05:49 +02:00
sudo ./piu i -y fish-shell
2020-09-06 21:53:57 +02:00
sudo usermod --shell /bin/fish $USER
elif [[ $shell = "b" ]]; then
2020-09-06 23:05:49 +02:00
sudo ./piu i -y bash-completion
2020-09-06 21:53:57 +02:00
sudo usermod --shell /bin/bash $USER
elif [[ $shell = "z" ]]; then
sudo ./piu i -y zsh zsh-autosuggestions zsh-completions zsh-history-substring-search zsh-syntax-highlighting
2020-09-06 21:53:57 +02:00
sudo usermod --shell /bin/zsh $USER
fi
# Choose terminal emulator --------------------------------------------------------------------------------------
if [[ $term = "s" ]]; then
2020-09-06 23:05:49 +02:00
sudo ./piu i -y sakura
2020-09-07 00:48:42 +02:00
export TERMINAL="sakura"
2020-09-07 07:17:05 +02:00
echo TERM="sakura" > ~/.bashrc
2020-09-06 21:53:57 +02:00
elif [[ $term = "x" ]]; then
2020-09-06 23:05:49 +02:00
sudo ./piu i -y xterm
2020-09-07 00:48:42 +02:00
export TERMINAL="xterm"
2020-09-07 07:17:05 +02:00
echo TERM="xterm" > ~/.bashrc
2020-09-06 21:53:57 +02:00
elif [[ $term = "t" ]]; then
2020-09-06 23:05:49 +02:00
sudo ./piu i -y terminator
2020-09-07 00:48:42 +02:00
export TERMINAL="terminator"
2020-09-07 07:17:05 +02:00
echo TERM="terminator" > ~/.bashrc
fi
# Choose window manager -----------------------------------------------------------------------------------------
2020-09-06 21:56:26 +02:00
if [[ $wm = "o" ]]; then
sudo ./piu i -y $(cat INSTALL/04_desktop)
sudo ./piu i -y $(cat INSTALL/05_openbox)
2020-09-06 21:56:26 +02:00
sudo -u $USER obmenu-generator -p -i -u -d -c
echo "tint2 &
2020-09-06 21:56:26 +02:00
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 ./piu i -y $(cat INSTALL/04_desktop)
sudo ./piu i -y $(cat INSTALL/05_awesome)
2020-09-07 00:21:56 +02:00
cp -r /etc/xdg/awesome ~/.config
2020-09-07 03:37:35 +02:00
if [[ $term = "s" ]]; then
sed -i 's/xterm/sakura/g' ~/.config/awesome/rc.lua
elif [[ $term = "t" ]]; then
sed -i 's/xterm/terminator/g' ~/.config/awesome/rc.lua
fi
2020-09-06 21:56:26 +02:00
fi
2020-09-06 23:57:00 +02:00
sudo ./piu i -y $(cat INSTALL/06_media)
#sudo xbps-install -Sy $(cat INSTALL/07_virtual)
#sudo xbps-install -Sy $(cat INSTALL/08_big)
#sudo xbps-install -Sy $(cat INSTALL/)
# printer support -----------------------------------------------------------------------------------------
2020-09-06 21:56:26 +02:00
if [[ $cups = "y" ]]; then
sudo ./piu i -y $(cat INSTALL/09_print)
2020-09-06 21:56:26 +02:00
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-07 01:20:10 +02:00
sudo ./piu i -y $(cat INSTALL/07_virtual)
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 -----------------------------------------------------------------------------------------
2020-09-06 23:57:00 +02:00
echo "$(tput setaf 1)Uncomment 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
2020-09-07 01:20:10 +02:00
cd ~/bin/install
# Share packages with void devs -----------------------------------------------------------------------------------------
2020-08-28 10:38:22 +02:00
if [[ $pop = "y" ]]; then
2020-09-06 23:05:49 +02:00
sudo ./piu i -y PopCorn
2020-08-28 10:38:22 +02:00
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
2020-09-07 00:48:42 +02:00
# Enjoy Void linux ----------------------------------------------------------------------------------------------------------------