Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
7.5 KiB

  1. #!/bin/bash
  2. source ~/.dotfiles/profile
  3. username=$(whoami)
  4. mvie(){
  5. if [ -e "$1" ];then
  6. rm -rf "$2"
  7. mv "$1" "$2"
  8. fi
  9. }
  10. # Configuring for your username
  11. if [ ! "$username" = "yigit" ]; then
  12. echo "Setting up the dotfiles according to your username"
  13. find . -type f -exec sed -i "s/\/home\/yigit/\/home\/$username/g" "{}" +
  14. fi
  15. # Don't prompt for a password for the rest of the script
  16. sudo bash -c 'echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd'
  17. # Install packages
  18. echo -n "Would you like to install all the necessary packages, not doing so might break most of the functionality?(Y/n): "
  19. read deps
  20. if [ ! "$deps" = "n" ]; then
  21. echo "Running update"
  22. yay -S --needed --noconfirm $(cat ~/.dotfiles/arch-setup/packages.rice) && exit 1
  23. fi
  24. rm -rf ~/.dotfiles_backup
  25. mkdir -p ~/.dotfiles_backup
  26. # Link XDG Directories
  27. # Config
  28. mvie ~/.config ~/.dotfiles_backup
  29. ln -s ~/.dotfiles/config ~/.config
  30. for d in ~/.dotfiles_backup/config/* ; do
  31. mv $d ~/.config 2> /dev/null
  32. done
  33. #Local
  34. mkdir -p ~/.dotfiles_backup/local
  35. mkdir -p ~/.local
  36. ## Local/Share
  37. mvie ~/.local/share ~/.dotfiles_backup/local/share
  38. ln -s ~/.dotfiles/local/share ~/.local/share
  39. for d in ~/.dotfiles_backup/local/share/* ; do
  40. mv $d ~/.local/share 2> /dev/null
  41. done
  42. ## Local/Bin
  43. mvie ~/.local/bin ~/.dotfiles_backup/local/bin
  44. ln -s ~/.dotfiles/local/bin ~/.local/bin
  45. for d in ~/.dotfiles_backup/local/bin/* ; do
  46. mv $d ~/.local/bin 2> /dev/null
  47. done
  48. ## Local/Backgrounds
  49. mvie ~/.local/backgrounds ~/.dotfiles_backup/local/backgrounds
  50. ln -s ~/.dotfiles/local/backgrounds ~/.local/backgrounds
  51. for d in ~/.dotfiles_backup/local/backgrounds/* ; do
  52. mv $d ~/.local/backgrounds 2> /dev/null
  53. done
  54. ## Local/Src
  55. mvie ~/.local/src ~/.dotfiles_backup/local/src
  56. ln -s ~/.dotfiles/suckless ~/.local/src
  57. ## Theme and Icon Folders
  58. mvie ~/.themes ~/.dotfiles_backup/themes
  59. ln -s ~/.dotfiles/local/share/themes ~/.themes
  60. mvie ~/.icons ~/.dotfiles_backup/icons
  61. ln -s ~/.dotfiles/local/share/icons ~/.icons
  62. # Create individual files
  63. echo 'ZDOTDIR=$HOME/.config/zsh' > $HOME/.zshenv
  64. chmod +x $HOME/.zshenv
  65. mvie ~/.profile ~/.dotfiles_backup/profile
  66. ln -sf ~/.dotfiles/profile ~/.profile
  67. cp ~/.dotfiles/config.env.def ~/.config.env
  68. # Downloading assets
  69. ##Fonts
  70. echo "Downloading assets"
  71. prev=$(pwd)
  72. curl https://minio.yigitcolakoglu.com/dotfiles/tools/mc > "$HOME/.local/bin/mc"
  73. chmod +x "$HOME/.local/bin/mc"
  74. $HOME/.local/bin/mc alias set fr1nge-dots https://minio.yigitcolakoglu.com "" ""
  75. mc cp -r fr1nge-dots/dotfiles/fonts/ ~/.local/share/fonts/
  76. fc-cache
  77. ## Backgrounds
  78. mc cp -r fr1nge-dots/dotfiles/backgrounds/ ~/.local/backgrounds/
  79. # Setup Crontab
  80. if [ ! -f "/var/spool/cron/$username" ]; then
  81. sudo touch "/var/spool/cron/$username"
  82. sudo chown $username:$username "/var/spool/cron/$username"
  83. sudo chmod 0644 "/var/spool/cron/$username"
  84. echo "*/8 * * * * /home/$username/.local/bin/mailsync" > /var/spool/cron/$username
  85. echo "*/15 * * * * /home/$username/.local/bin/nextcloud-sync" >> /var/spool/cron/$username
  86. echo "0 * * * * /home/$username/.local/bin/check-updates" >> /var/spool/cron/$username
  87. echo "*/30 * * * * /home/$username/.local/bin/firefox-sync" >> /var/spool/cron/$username
  88. echo "*/30 * * * * calcurse-caldav" >> /var/spool/cron/$username
  89. echo "*/30 * * * * vdirsyncer sync" >> /var/spool/cron/$username
  90. else
  91. echo -n "An existing cron file is detected, would you like to overwrite it?(Y/n): "
  92. read cron
  93. if [ ! "$cron" = "n" ]; then
  94. cp /var/spool/cron/$username ~/.dotfiles_backup/crontab
  95. echo "*/8 * * * * /home/$username/.local/bin/mailsync" > /var/spool/cron/$username
  96. echo "*/15 * * * * /home/$username/.local/bin/nextcloud-sync" >> /var/spool/cron/$username
  97. echo "0 * * * * /home/$username/.local/bin/check-updates" >> /var/spool/cron/$username
  98. echo "*/30 * * * * /home/$username/.local/bin/firefox-sync" >> /var/spool/cron/$username
  99. echo "*/30 * * * * calcurse-caldav" >> /var/spool/cron/$username
  100. echo "*/30 * * * * vdirsyncer sync" >> /var/spool/cron/$username
  101. fi
  102. fi
  103. # Create necessary folders
  104. mkdir -p "$HOME/.local/share/ncmpcpp/lyrics"
  105. mkdir -p "$HOME/.local/share/calcurse"
  106. mkdir -p "$CARGO_HOME"
  107. mkdir -p "$GOPATH"
  108. mkdir -p "$ANDROID_HOME"
  109. mkdir -p "$FLUTTER_HOME"
  110. mkdir -p "$LEIN_HOME"
  111. mkdir -p "$NVM_DIR"
  112. mkdir -p "$GNUPGHOME"
  113. mkdir -p "$WEECHAT_HOME"
  114. mkdir -p "$JUPYTER_CONFIG_DIR"
  115. mkdir -p "$PYLINTHOME"
  116. mkdir -p "$HOME/.local/share/zsh"
  117. mkdir -p "$XDG_DATA_HOME/mail"
  118. mkdir -p "$XDG_CONFIG_HOME/git"
  119. mkdir -p "$XDG_CACHE_HOME/surf"
  120. mkdir -p "$HOME/.ssh"
  121. echo "AddKeysToAgent yes" > "$HOME/.ssh/config"
  122. chmod 700 "$GNUPGHOME"
  123. touch "$XDG_CONFIG_HOME/git/config"
  124. touch "$_Z_DATA"
  125. # Root Files and Directories
  126. sudo mkdir -p /usr/share/xsessions
  127. sudo mkdir -p /etc/security
  128. sudo cp ~/.dotfiles/root/dwm.desktop /usr/share/xsessions
  129. sudo cp ~/.dotfiles/root/pam_env.conf /etc/security/pam_env.conf
  130. sudo cp ~/.dotfiles/root/issue /etc/issue
  131. sudo cp ~/.dotfiles/root/motd /etc/motd
  132. sudo cp ~/.dotfiles/root/nancyj.flf /usr/share/figlet/fonts
  133. if [ "$(grep artix < $(uname -a))" = "" ]; then
  134. sudo cp ~/.dotfiles/root/quark /etc/init.d
  135. sudo rc-update add quark
  136. else
  137. sudo cp ~/.dotfiles/root/quark.service /usr/lib/systemd/system
  138. sudo systemctl enable quark
  139. fi
  140. sudo cp ~/.dotfiles/root/kdialog /usr/local/bin/kdialog
  141. sudo cp ~/.dotfiles/root/udevil.conf /etc/udevil/udevil.conf
  142. sudo chmod +x /usr/local/bin/kdialog
  143. sudo systemctl daemon-reload
  144. sudo groupadd nogroup
  145. if [ "$username" = "yigit" ]; then
  146. ~/.dotfiles/arch-setup/fetch_keys.sh # Fetch keys (For personal use, this is not for you)
  147. mkdir -p "$XDG_DATA_HOME/mail/yigitcolakoglu@hotmail.com"
  148. git config --global user.email "yigitcolakoglu@hotmail.com"
  149. git config --global user.name "Yigit Colakoglu"
  150. fi
  151. # Setup for pam-gnupg
  152. sudo cat << EOF >> /etc/pam.d/system-local-login
  153. session optional pam_env.so user_readenv=1
  154. auth optional pam_gnupg.so store-only
  155. session optional pam_gnupg.so
  156. EOF
  157. echo "allow-preset-passphrase" >> $GNUPGHOME/gpg-agent.conf
  158. echo "max-cache-ttl 172800" >> $GNUPGHOME/gpg-agent.conf
  159. # Build and Install Everything
  160. ## Suckless utilities
  161. echo "Installing suckless utilities"
  162. (cd ~/.dotfiles/suckless; ~/.dotfiles/suckless/build.sh > /dev/null 2> /dev/null)
  163. ## Tela Icons
  164. echo "Installing Icons"
  165. ~/.dotfiles/local/share/icons/Tela-Icons/install.sh > /dev/null 2> /dev/null
  166. ## Start page
  167. echo "Setting up start page"
  168. prev=$(pwd)
  169. cd ~/.dotfiles/browser/startpage
  170. sudo npm install -g parcel-bundler
  171. npm install > /dev/null 2> /dev/null
  172. npm run build > /dev/null 2> /dev/null
  173. cd $prev
  174. # Vim and tmux plugins
  175. mkdir -p ~/.tmux/plugins
  176. vim +PlugInstall +qall
  177. cd ~/.config/coc/extensions
  178. yarn
  179. cd $prev
  180. # Install mconnect
  181. echo "Installing mconnect"
  182. git clone https://github.com/theFr1nge/mconnect.git /tmp/mconnect.git > /dev/null 2> /dev/null
  183. cd /tmp/mconnect.git
  184. mkdir -p build
  185. cd build
  186. meson .. > /dev/null 2> /dev/null
  187. ninja > /dev/null 2> /dev/null
  188. sudo ninja install > /dev/null 2> /dev/null
  189. cd $prev
  190. mkdir -p ~/Downloads/mconnect
  191. ## Bitwarden Dmenu
  192. echo "Installing bitwardedn-dmenu"
  193. sudo git clone https://github.com/theFr1nge/bitwarden-dmenu.git /usr/share/bwdmenu > /dev/null 2> /dev/null
  194. cd /usr/share/bwdmenu
  195. sudo npm install > /dev/null 2> /dev/null
  196. sudo npm i -g > /dev/null 2> /dev/null
  197. cd $prev
  198. ## Simcrop
  199. echo "Installing simcrop"
  200. git clone https://github.com/theFr1nge/simcrop.git /tmp/simcrop > /dev/null 2> /dev/null
  201. cd /tmp/simcrop
  202. sudo make install > /dev/null 2> /dev/null
  203. cd $prev
  204. # Do a cleanup and delete some problematic files
  205. rm -rf ~/.fzf*
  206. rm -rf ~/.bash_profile
  207. rm -rf ~/.dotfiles/yarn.lock
  208. rm -rf ~/.dotfiles/.git/hooks/*
  209. sudo rm -rf /etc/urlview/system.urlview
  210. sudo rm -rf /etc/sudoers.d/nopwd