From dd6bc312a19a78649731284cbc375fa47b81690c Mon Sep 17 00:00:00 2001 From: Yigit Colakoglu Date: Thu, 8 Apr 2021 18:14:36 +0300 Subject: [PATCH] Cleaning up the work tree? --- .gitignore | 8 -- .gitmodules | 32 ------- install.sh | 249 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 249 insertions(+), 40 deletions(-) delete mode 100644 .gitignore delete mode 100644 .gitmodules create mode 100755 install.sh diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0dd5286c..00000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.otf -*.ttf - -*.otf* -*.ttf* - -.ccls-cache -.ccls-cache/** diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1174a211..00000000 --- a/.gitmodules +++ /dev/null @@ -1,32 +0,0 @@ -[submodule "misc/ranger/plugins/devicons2"] - path = misc/ranger/plugins/devicons2 - url = https://github.com/cdump/ranger-devicons2.git - shallow = true -[submodule "misc/ranger/plugins/devicons"] - path = misc/ranger/plugins/devicons - url = https://github.com/cdump/ranger-devicons2 - shallow = true -[submodule "gtk/Tela-icon-theme"] - path = theming/Tela-icon-theme - url = https://github.com/vinceliuice/Tela-icon-theme.git - shallow = true -[submodule "gtk/themes/material-ocean"] - path = theming/themes/material-ocean - url = https://github.com/material-ocean/Gtk-Theme.git - shallow = true -[submodule "local/share/icons/Tela-Icons"] - path = local/share/icons/Tela-Icons - url = https://github.com/vinceliuice/Tela-icon-theme.git - shallow = true -[submodule "local/share/themes/Material-Ocean"] - path = local/share/themes/Material-Ocean - url = https://github.com/material-ocean/Gtk-Theme - shallow = true -[submodule "local/share/themes/material-ocean"] - path = local/share/themes/material-ocean - url = https://github.com/material-ocean/Gtk-Theme - shallow = true -[submodule "config/ranger/plugins/devicons"] - path = config/ranger/plugins/devicons - url = https://github.com/cdump/ranger-devicons2.git - shallow = true diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..5cf132f4 --- /dev/null +++ b/install.sh @@ -0,0 +1,249 @@ +#!/bin/bash + +source ~/.dotfiles/profile + +username=$(whoami) + +mvie(){ + if [ -e "$1" ];then + rm -rf "$2" + mv "$1" "$2" + fi +} + +# Configuring for your username +if [ ! "$username" = "yigit" ]; then + echo "Setting up the dotfiles according to your username" + find . -type f -exec sed -i "s/\/home\/yigit/\/home\/$username/g" "{}" + +fi + +# Don't prompt for a password for the rest of the script +sudo bash -c 'echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwd' + +# Install packages +echo -n "Would you like to install all the necessary packages, not doing so might break most of the functionality?(Y/n): " +read deps +if [ ! "$deps" = "n" ]; then + echo "Running update" + yay -S --needed --noconfirm $(cat ~/.dotfiles/arch-setup/packages.rice) && exit 1 +fi + +rm -rf ~/.dotfiles_backup +mkdir -p ~/.dotfiles_backup + +# Link XDG Directories + +# Config +mvie ~/.config ~/.dotfiles_backup +ln -s ~/.dotfiles/config ~/.config +for d in ~/.dotfiles_backup/config/* ; do + mv $d ~/.config 2> /dev/null +done + +#Local +mkdir -p ~/.dotfiles_backup/local +mkdir -p ~/.local + +## Local/Share +mvie ~/.local/share ~/.dotfiles_backup/local/share +ln -s ~/.dotfiles/local/share ~/.local/share +for d in ~/.dotfiles_backup/local/share/* ; do + mv $d ~/.local/share 2> /dev/null +done + +## Local/Bin +mvie ~/.local/bin ~/.dotfiles_backup/local/bin +ln -s ~/.dotfiles/local/bin ~/.local/bin +for d in ~/.dotfiles_backup/local/bin/* ; do + mv $d ~/.local/bin 2> /dev/null +done + +## Local/Backgrounds +mvie ~/.local/backgrounds ~/.dotfiles_backup/local/backgrounds +ln -s ~/.dotfiles/local/backgrounds ~/.local/backgrounds +for d in ~/.dotfiles_backup/local/backgrounds/* ; do + mv $d ~/.local/backgrounds 2> /dev/null +done + +## Local/Src +mvie ~/.local/src ~/.dotfiles_backup/local/src +ln -s ~/.dotfiles/suckless ~/.local/src + +## Theme and Icon Folders +mvie ~/.themes ~/.dotfiles_backup/themes +ln -s ~/.dotfiles/local/share/themes ~/.themes +mvie ~/.icons ~/.dotfiles_backup/icons +ln -s ~/.dotfiles/local/share/icons ~/.icons + +# Create individual files +echo 'ZDOTDIR=$HOME/.config/zsh' > $HOME/.zshenv +chmod +x $HOME/.zshenv + +mvie ~/.profile ~/.dotfiles_backup/profile +ln -sf ~/.dotfiles/profile ~/.profile + +cp ~/.dotfiles/config.env.def ~/.config.env + +# Downloading assets +##Fonts +echo "Downloading assets" +prev=$(pwd) + +curl https://minio.yigitcolakoglu.com/dotfiles/tools/mc > "$HOME/.local/bin/mc" +chmod +x "$HOME/.local/bin/mc" +$HOME/.local/bin/mc alias set fr1nge-dots https://minio.yigitcolakoglu.com "" "" +mc cp -r fr1nge-dots/dotfiles/fonts/ ~/.local/share/fonts/ +fc-cache + +## Backgrounds +mc cp -r fr1nge-dots/dotfiles/backgrounds/ ~/.local/backgrounds/ + +# Setup Crontab +if [ ! -f "/var/spool/cron/$username" ]; then + sudo touch "/var/spool/cron/$username" + sudo chown $username:$username "/var/spool/cron/$username" + sudo chmod 0644 "/var/spool/cron/$username" + echo "*/8 * * * * /home/$username/.local/bin/mailsync" > /var/spool/cron/$username + echo "*/15 * * * * /home/$username/.local/bin/nextcloud-sync" >> /var/spool/cron/$username + echo "0 * * * * /home/$username/.local/bin/check-updates" >> /var/spool/cron/$username + echo "*/30 * * * * /home/$username/.local/bin/firefox-sync" >> /var/spool/cron/$username + echo "*/30 * * * * calcurse-caldav" >> /var/spool/cron/$username + echo "*/30 * * * * vdirsyncer sync" >> /var/spool/cron/$username +else + echo -n "An existing cron file is detected, would you like to overwrite it?(Y/n): " + read cron + if [ ! "$cron" = "n" ]; then + cp /var/spool/cron/$username ~/.dotfiles_backup/crontab + echo "*/8 * * * * /home/$username/.local/bin/mailsync" > /var/spool/cron/$username + echo "*/15 * * * * /home/$username/.local/bin/nextcloud-sync" >> /var/spool/cron/$username + echo "0 * * * * /home/$username/.local/bin/check-updates" >> /var/spool/cron/$username + echo "*/30 * * * * /home/$username/.local/bin/firefox-sync" >> /var/spool/cron/$username + echo "*/30 * * * * calcurse-caldav" >> /var/spool/cron/$username + echo "*/30 * * * * vdirsyncer sync" >> /var/spool/cron/$username + fi +fi + +# Create necessary folders +mkdir -p "$HOME/.local/share/ncmpcpp/lyrics" +mkdir -p "$HOME/.local/share/calcurse" +mkdir -p "$CARGO_HOME" +mkdir -p "$GOPATH" +mkdir -p "$ANDROID_HOME" +mkdir -p "$FLUTTER_HOME" +mkdir -p "$LEIN_HOME" +mkdir -p "$NVM_DIR" +mkdir -p "$GNUPGHOME" +mkdir -p "$WEECHAT_HOME" +mkdir -p "$JUPYTER_CONFIG_DIR" +mkdir -p "$PYLINTHOME" +mkdir -p "$HOME/.local/share/zsh" +mkdir -p "$XDG_DATA_HOME/mail" +mkdir -p "$XDG_CONFIG_HOME/git" +mkdir -p "$XDG_CACHE_HOME/surf" +mkdir -p "$HOME/.ssh" +echo "AddKeysToAgent yes" > "$HOME/.ssh/config" + +chmod 700 "$GNUPGHOME" +touch "$XDG_CONFIG_HOME/git/config" +touch "$_Z_DATA" + +# Root Files and Directories +sudo mkdir -p /usr/share/xsessions +sudo mkdir -p /etc/security +sudo cp ~/.dotfiles/root/dwm.desktop /usr/share/xsessions +sudo cp ~/.dotfiles/root/pam_env.conf /etc/security/pam_env.conf +sudo cp ~/.dotfiles/root/issue /etc/issue +sudo cp ~/.dotfiles/root/motd /etc/motd +sudo cp ~/.dotfiles/root/nancyj.flf /usr/share/figlet/fonts +if [ "$(grep artix < $(uname -a))" = "" ]; then + sudo cp ~/.dotfiles/root/quark /etc/init.d + sudo rc-update add quark +else + sudo cp ~/.dotfiles/root/quark.service /usr/lib/systemd/system + sudo systemctl enable quark +fi +sudo cp ~/.dotfiles/root/kdialog /usr/local/bin/kdialog +sudo cp ~/.dotfiles/root/udevil.conf /etc/udevil/udevil.conf +sudo chmod +x /usr/local/bin/kdialog +sudo systemctl daemon-reload +sudo groupadd nogroup + +if [ "$username" = "yigit" ]; then + ~/.dotfiles/arch-setup/fetch_keys.sh # Fetch keys (For personal use, this is not for you) + mkdir -p "$XDG_DATA_HOME/mail/yigitcolakoglu@hotmail.com" + git config --global user.email "yigitcolakoglu@hotmail.com" + git config --global user.name "Yigit Colakoglu" +fi + +# Setup for pam-gnupg +sudo cat << EOF >> /etc/pam.d/system-local-login + +session optional pam_env.so user_readenv=1 +auth optional pam_gnupg.so store-only +session optional pam_gnupg.so +EOF + +echo "allow-preset-passphrase" >> $GNUPGHOME/gpg-agent.conf +echo "max-cache-ttl 172800" >> $GNUPGHOME/gpg-agent.conf + +# Build and Install Everything +## Suckless utilities +echo "Installing suckless utilities" +(cd ~/.dotfiles/suckless; ~/.dotfiles/suckless/build.sh > /dev/null 2> /dev/null) + +## Tela Icons +echo "Installing Icons" +~/.dotfiles/local/share/icons/Tela-Icons/install.sh > /dev/null 2> /dev/null + +## Start page +echo "Setting up start page" +prev=$(pwd) +cd ~/.dotfiles/browser/startpage +sudo npm install -g parcel-bundler +npm install > /dev/null 2> /dev/null +npm run build > /dev/null 2> /dev/null +cd $prev + +# Vim and tmux plugins +mkdir -p ~/.tmux/plugins +vim +PlugInstall +qall +cd ~/.config/coc/extensions +yarn +cd $prev + +# Install mconnect +echo "Installing mconnect" +git clone https://github.com/theFr1nge/mconnect.git /tmp/mconnect.git > /dev/null 2> /dev/null +cd /tmp/mconnect.git +mkdir -p build +cd build +meson .. > /dev/null 2> /dev/null +ninja > /dev/null 2> /dev/null +sudo ninja install > /dev/null 2> /dev/null +cd $prev +mkdir -p ~/Downloads/mconnect + +## Bitwarden Dmenu +echo "Installing bitwardedn-dmenu" +sudo git clone https://github.com/theFr1nge/bitwarden-dmenu.git /usr/share/bwdmenu > /dev/null 2> /dev/null +cd /usr/share/bwdmenu +sudo npm install > /dev/null 2> /dev/null +sudo npm i -g > /dev/null 2> /dev/null +cd $prev + +## Simcrop +echo "Installing simcrop" +git clone https://github.com/theFr1nge/simcrop.git /tmp/simcrop > /dev/null 2> /dev/null +cd /tmp/simcrop +sudo make install > /dev/null 2> /dev/null +cd $prev + +# Do a cleanup and delete some problematic files +rm -rf ~/.fzf* +rm -rf ~/.bash_profile +rm -rf ~/.dotfiles/yarn.lock +rm -rf ~/.dotfiles/.git/hooks/* +sudo rm -rf /etc/urlview/system.urlview + + +sudo rm -rf /etc/sudoers.d/nopwd