install-on-arch.sh 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #!/bin/bash
  2. # Config created by Keyitdev https://www.github.com/keyitdev/dotfiles
  3. # Copyright (C) 2022 Keyitdev
  4. config_directory="$HOME/.config"
  5. fonts_directory="/usr/share/fonts"
  6. scripts_directory="/usr/local/bin"
  7. gtk_theme_directory="/usr/share/themes"
  8. green='\033[0;32m'
  9. no_color='\033[0m'
  10. date=$(date +%s)
  11. sudo pacman --noconfirm --needed -Sy dialog
  12. system_update(){
  13. echo -e "${green}[*] Doing a system update, cause stuff may break if it's not the latest version...${no_color}"
  14. sudo pacman -Sy --noconfirm archlinux-keyring
  15. sudo pacman --noconfirm -Syu
  16. sudo pacman -S --noconfirm --needed base-devel wget git curl
  17. }
  18. install_aur_helper(){
  19. if ! command -v "$aurhelper" &> /dev/null
  20. then
  21. echo -e "${green}[*] It seems that you don't have $aurhelper installed, I'll install that for you before continuing.${no_color}"
  22. git clone https://aur.archlinux.org/"$aurhelper".git $HOME/.srcs/"$aurhelper"
  23. (cd $HOME/.srcs/"$aurhelper"/ && makepkg -si)
  24. else
  25. echo -e "${green}[*] It seems that you already have $aurhelper installed, skipping.${no_color}"
  26. fi
  27. }
  28. install_pkgs(){
  29. echo -e "${green}[*] Installing packages with pacman.${no_color}"
  30. sudo pacman -S --noconfirm --needed acpi alsa-utils base-devel curl git pulseaudio pulseaudio-alsa xorg xorg-xinit alacritty btop code dunst feh firefox i3-gaps libnotify light mpc mpd ncmpcpp nemo neofetch neovim pacman-contrib papirus-icon-theme picom polybar ranger rofi scrot slop xclip zathura zathura-pdf-mupdf zsh
  31. }
  32. install_aur_pkgs(){
  33. echo -e "${green}[*] Installing packages with $aurhelper.${no_color}"
  34. "$aurhelper" -S --noconfirm --needed i3lock-color i3-resurrect ffcast oh-my-zsh-git
  35. }
  36. create_default_directories(){
  37. echo -e "${green}[*] Copying configs to $config_directory.${no_color}"
  38. mkdir -p "$HOME"/.config
  39. sudo mkdir -p /usr/local/bin
  40. sudo mkdir -p /usr/share/themes
  41. mkdir -p "$HOME"/Pictures/wallpapers
  42. }
  43. create_backup(){
  44. echo -e "${green}[*] Creating backup of existing configs.${no_color}"
  45. [ -d "$config_directory"/alacritty ] && mv "$config_directory"/alacritty "$config_directory"/alacritty_$date && echo "alacritty configs detected, backing up."
  46. [ -d "$config_directory"/btop ] && mv "$config_directory"/btop "$config_directory"/btop_$date && echo "btop configs detected, backing up."
  47. [ -d "$config_directory"/dunst ] && mv "$config_directory"/dunst "$config_directory"/dunst_$date && echo "dunst configs detected, backing up."
  48. [ -d "$config_directory"/gtk-3.0 ] && mv "$config_directory"/gtk-3.0 "$config_directory"/gtk-3.0_$date && echo "gtk-3.0 configs detected, backing up."
  49. [ -d "$config_directory"/i3 ] && mv "$config_directory"/i3 "$config_directory"/i3_$date && echo "i3 configs detected, backing up."
  50. [ -d "$config_directory"/mpd ] && mv "$config_directory"/mpd "$config_directory"/mpd_$date && echo "mpd configs detected, backing up."
  51. [ -d "$config_directory"/ncmpcpp ] && mv "$config_directory"/ncmpcpp "$config_directory"/ncmpcpp_$date && echo "ncmpcpp configs detected, backing up."
  52. [ -d "$config_directory"/neofetch ] && mv "$config_directory"/neofetch "$config_directory"/neofetch_$date && echo "neofetch configs detected, backing up."
  53. [ -d "$config_directory"/nvim ] && mv "$config_directory"/nvim "$config_directory"/nvim_$date && echo "nvim configs detected, backing up."
  54. [ -d "$config_directory"/picom ] && mv "$config_directory"/picom "$config_directory"/picom_$date && echo "picom configs detected, backing up."
  55. [ -d "$config_directory"/polybar ] && mv "$config_directory"/polybar "$config_directory"/polybar_$date && echo "polybar configs detected, backing up."
  56. [ -d "$config_directory"/ranger ] && mv "$config_directory"/ranger "$config_directory"/ranger_$date && echo "ranger configs detected, backing up."
  57. [ -d "$config_directory"/rofi ] && mv "$config_directory"/rofi "$config_directory"/rofi_$date && echo "rofi configs detected, backing up."
  58. [ -d "$config_directory"/zathura ] && mv "$config_directory"/zathura "$config_directory"/zathura_$date && echo "zathura configs detected, backing up."
  59. [ -d "$scripts_directory" ] && sudo mv "$scripts_directory" "$scripts_directory"_$date && echo "scripts ($scripts_directory) detected, backing up."
  60. [ -f "$config_directory"/Code\ -\ OSS/User/settings.json ] && mv "$config_directory"/Code\ -\ OSS/User/settings.json "$config_directory"/Code\ -\ OSS/User/settings.json_$date && echo "Vsc configs detected, backing up."
  61. [ -f /etc/fonts/local.conf ] && sudo mv /etc/fonts/local.conf /etc/fonts/local.conf_$date && echo "Fonts configs detected, backing up."
  62. }
  63. copy_configs(){
  64. echo -e "${green}[*] Copying configs to $config_directory.${no_color}"
  65. cp -r ./config/* "$config_directory"
  66. }
  67. copy_scripts(){
  68. echo -e "${green}[*] Copying scripts to $scripts_directory.${no_color}"
  69. sudo cp -r ./scripts/* "$scripts_directory"
  70. }
  71. copy_fonts(){
  72. echo -e "${green}[*] Copying fonts to $fonts_directory.${no_color}"
  73. sudo cp -r ./fonts/* "$fonts_directory"
  74. fc-cache -fv
  75. }
  76. copy_other_configs(){
  77. echo -e "${green}[*] Copying gtk theme to /usr/share/themes.${no_color}"
  78. sudo cp -r ./tokyonight_gtk /usr/share/themes
  79. echo -e "${green}[*] Copying wallpapers to "$HOME"/Pictures/wallpapers.${no_color}"
  80. cp -r ./wallpapers/* "$HOME"/Pictures/wallpapers
  81. echo -e "${green}[*] Copying vsc configs.${no_color}"
  82. cp -r ./vsc/* "$HOME"/.vscode-oss/extensions
  83. cp ./vsc/settings.json "$HOME"/.config/Code\ -\ OSS/User
  84. echo -e "${green}[*] Copying zsh configs.${no_color}"
  85. sudo cp ./keyitdev.zsh-theme /usr/share/oh-my-zsh/custom/themes
  86. cp ./.zshrc "$HOME"
  87. }
  88. install_additional_pkgs(){
  89. echo -e "${green}[*] Installing additional packages with $aurhelper.${no_color}"
  90. "$aurhelper" -S --noconfirm --needed dhcpcd gimp iwd libreoffice ntfs-3g ntp pulsemixer vnstat
  91. }
  92. install_emoji_fonts(){
  93. echo -e "${green}[*] Installing emoji fonts with $aurhelper.${no_color}"
  94. "$aurhelper" -S --noconfirm --needed noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra
  95. sudo cp -f ./local.conf /etc/fonts
  96. fc-cache -fv
  97. }
  98. install_sddm(){
  99. echo -e "${green}[*] Installing sddm theme.${no_color}"
  100. "$aurhelper" -S --noconfirm --needed qt5-graphicaleffects qt5-quickcontrols2 qt5-svg sddm
  101. sudo systemctl enable sddm.service
  102. sudo git clone https://github.com/keyitdev/sddm-flower-theme.git /usr/share/sddm/themes/sddm-flower-theme
  103. sudo cp /usr/share/sddm/themes/sddm-flower-theme/Fonts/* /usr/share/fonts/
  104. echo "[Theme]
  105. Current=sddm-flower-theme" | sudo tee /etc/sddm.conf
  106. }
  107. finishing(){
  108. echo -e "${green}[*] Chmoding light.${no_color}"
  109. sudo chmod +s /usr/bin/light
  110. echo -e "${green}[*] Setting Zsh as default shell.${no_color}"
  111. chsh -s /bin/zsh
  112. sudo chsh -s /bin/zsh
  113. echo -e "${green}[*] Updating nvim extensions.${no_color}"
  114. nvim +PackerSync
  115. }
  116. cmd=(dialog --clear --title "Aur helper" --menu "Firstly, select the aur helper you want to install (or have already installed)." 10 50 16)
  117. options=(1 "yay" 2 "paru")
  118. choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
  119. case $choices in
  120. 1) aurhelper="yay";;
  121. 2) aurhelper="paru";;
  122. esac
  123. cmd=(dialog --clear --separate-output --checklist "Select (with space) what script should do.\\nChecked options are required for proper installation, do not uncheck them if you do not know what you are doing." 26 86 16)
  124. options=(1 "System update" on
  125. 2 "Install aur helper" on
  126. 3 "Install basic packages" on
  127. 4 "Install basic packages (aur)" on
  128. 5 "Create default directories" on
  129. 6 "Create backup of existing configs (to prevent overwritting)" on
  130. 7 "Copy configs" on
  131. 8 "Copy scripts" on
  132. 9 "Copy fonts" on
  133. 10 "Copy other configs (gtk theme, wallpaper, vsc configs, zsh configs)" on
  134. 11 "Install additional packages" off
  135. 12 "Install emoji fonts" off
  136. 13 "Install sddm with flower theme" off
  137. 14 "Make Light executable, set zsh as default shell, update nvim extensions." on)
  138. choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
  139. clear
  140. for choice in $choices
  141. do
  142. case $choice in
  143. 1) system_update;;
  144. 2) install_aur_helper;;
  145. 3) install_pkgs;;
  146. 4) install_aur_pkgs;;
  147. 5) create_default_directories;;
  148. 6) create_backup;;
  149. 7) copy_configs;;
  150. 8) copy_scripts;;
  151. 9) copy_fonts;;
  152. 10) copy_other_configs;;
  153. 11) install_additional_pkgs;;
  154. 12) install_emoji_fonts;;
  155. 13) install_sddm;;
  156. 14) finishing;;
  157. esac
  158. done