install/install.sh

236 lines
7.9 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}"
pass="${pass:-n}"
wm="${wm:-a}"
editor="${editor:-m}"
cups="${cups:-y}"
pop="${pop:-y}"
lightdm="${lightdm:-y}"
reboot="${reboot:-n}"
# 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
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
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: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: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:06:03 +02:00
echo
2020-08-28 14:48:19 +02:00
fi
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
echo
echo "$(tput setaf 1)Which test 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
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
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
echo
# Install packages -----------------------------------------------------------------------------------------
2020-08-28 03:25:21 +02:00
# Nonfree and multilib repos
sudo xbps-install -y $(cat INSTALL/1_repos)
2020-08-23 20:50:47 +02:00
sudo xbps-install -Sy $(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
# Choose cpu -----------------------------------------------------------------------------------------
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
# Choose window manager -----------------------------------------------------------------------------------------
2020-08-28 19:06:03 +02:00
if [[ $wm = "o" ]]; then
2020-08-28 03:25:21 +02:00
sudo xbps-install -y $(cat INSTALL/4_desktop)
sudo xbps-install -y $(cat INSTALL/5_openbox)
2020-08-28 13:44:22 +02:00
-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
2020-08-23 23:12:09 +02:00
# cp ~/bin/dotfiles/home/zen/.config/openbox/rc.xml ~/.config/openbox
2020-08-28 19:06:03 +02:00
elif [[ $wm = "a" ]]; then
echo awesome
2020-08-28 03:25:21 +02:00
sudo xbps-install -y $(cat INSTALL/4_desktop)
sudo xbps-install -y $(cat INSTALL/5_awesome)
fi
2020-08-23 11:42:14 +02:00
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 -----------------------------------------------------------------------------------------
if [[ $cups = "y" ]]; then
2020-08-28 03:25:21 +02:00
sudo xbps-install -y $(cat INSTALL/9_print)
sudo ln -s /etc/sv/cupsd /var/service
fi
# make fish base shell-----------------------------------------------------------------------------------------
2020-08-28 03:25:21 +02:00
sudo usermod --shell /bin/fish $USER
2020-08-28 11:52:17 +02:00
export TERMINAL=sakura
2020-08-28 13:44:22 +02:00
echo TERMINAL=sakura > ~/.bashrc
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 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 13:58:35 +02:00
echo "$(tput setaf 1)Remove down file after for run Lightdm..$(tput sgr 0)"
2020-08-28 13:44:22 +02:00
echo "$(tput setaf 1)Use 'sudo rm /etc/sv/lightdm/down'$(tput sgr 0)"
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 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 14:39:40 +02:00
echo "$(tput setaf 1)Remove down file after for run Lightdm..$(tput sgr 0)"
2020-08-28 13:44:22 +02:00
echo "$(tput setaf 1)Use 'sudo rm /etc/sv/lightdm/down'$(tput sgr 0)"
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 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