From 2cd81ede4a0a6b540cf370c4ef222277b8b867a6 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Mon, 5 Sep 2022 17:32:24 +0200 Subject: Updated archSetup.sh --- archSetup.sh | 140 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 102 insertions(+), 38 deletions(-) (limited to 'archSetup.sh') diff --git a/archSetup.sh b/archSetup.sh index 0c6ba91..c058d2d 100755 --- a/archSetup.sh +++ b/archSetup.sh @@ -2,49 +2,103 @@ # Sets up a custom environment in an Arch installation +getPackageGroup() { + + packagesFile="$HOME/repos/privconfigs/packages.txt" + [ -f "$packagesFile" ] || exit 1 + group="$1" + + sed -n "/^# ${group}/,/^# /p" "$packagesFile" | + sed '/^#/d;/^\s*$/d;s/\s*#.*$//' + +} + +installPackageGroup() { + getPackageGroup "$1" | sudo pacman -S - +} + +prompt() { + echo "$1" + shift + read answer + echo "$answer" | grep -E -q '^[yY]' && "$@" +} + # Initialization -packagesFile="$HOME/repos/configs/packages.txt" +server="taamas@taamas.xyz" +installAudio="" +installGraphic="" # Setup is done from the $HOME directory cd -# Stop the satanic bell -sudo echo 'blacklist pcspkr' >/etc/modprobe.d/nobeep.conf +# Directory structure +mkdir -p "$HOME/downloads/videos" +mkdir -p "$HOME/downloads/audios" +mkdir -p "$HOME/images/screenshots" +mkdir -p "$HOME/images/wallpapers/shufs/current" +mkdir "$HOME/repos" -# Pacman config -echo "Adding color and candy to /etc/pacman.conf" -grep -q 'ILoveCandy' /etc/pacman.conf || - sudo sed -i 's/^#Color.*$/Color\nILoveCandy/' /etc/pacman.conf +# Connect to server +sshKey="$HOME/.ssh/id_rsa_$(hostnamectl hostname)ForXyz" +ssh-keygen -f "$sshKey" || exit 1 +ssh-copy-id -i "$sshKey" "$server" || exit 1 # Install git to get needed repos if ! type git; then echo "Installing git" type git || sudo pacman -S git - echo "Setting up git config." - git config --global user.name "InigoGutierrez" - git config --global user.email "inigogf.95@gmail.com" + gitName="InigoGutierrez" + gitEmail="inigogf.95@gmail.com" + echo "Setting up git config" + echo "Name: $gitName" + echo "mail: $gitEmail" + git config --global user.name "$gitName" + git config --global user.email "$gitEmail" echo "" fi -mkdir "repos" - # Clone scripts and configs repos if [ ! -d "scripts" ]; then echo "Cloning scripts repo" - git clone https://github.com/InigoGutierrez/scripts + git clone gitea@git.taamas.xyz/Taamas/scripts.git echo "" fi if [ ! -d "repos/configs" ]; then echo "Cloning configs repo" ( cd repos - git clone https://github.com/InigoGutierrez/configs + git clone gitea@git.taamas.xyz/Taamas/configs.git + echo "" + ) +fi +if [ ! -d "repos/privconfigs" ]; then + echo "Cloning private configs repo" + ( + cd repos + git clone taamas@taamas.xyz:~/repos/remotes/privconfigs echo "" ) fi +# Stop the satanic bell +sudo echo 'blacklist pcspkr' >/etc/modprobe.d/nobeep.conf + +# Pacman config +echo "Adding color and candy to /etc/pacman.conf" +grep -q 'ILoveCandy' /etc/pacman.conf || + sudo sed -i 's/^#Color.*$/Color\nILoveCandy/' /etc/pacman.conf + # Read programs to install from file -sed -n '/^# pacman/,/^# yay/p' "$packagesFile" | sed '/^#/d' | sudo pacman -S - +installPackageGroup base + +echo "Heavy packages are:" +getPackageGroup heavy +prompt "Install heavy packages? [y/N]" installPackageGroup heavy +prompt "Install audio packages? [y/N]" installAudio="y" +prompt "Install graphic packages? [y/N]" installGraphic="y" +[ -z "$installAudio" ] || installPackageGroup audio +[ -z "$installGraphic" ] || installPackageGroup graphic # Clone specific programs sources to be compiled and installed later ( @@ -57,8 +111,32 @@ cd "$HOME/repos" # Put config files in place echo "Putting config files in place" ( -cd "$HOME/repos/configs" -sh setup.sh +cd "$HOME/repos/configs/stow" +stow -t "$HOME" calcurse +stow -t "$HOME" neofetch +stow -t "$HOME" newsboat +stow -t "$HOME" nvim +stow -t "$HOME" pandoc +stow -t "$HOME" ranger +stow -t "$HOME" rcs +stow -t "$HOME" tmux +stow -t "$HOME" vim +if ! [ -z "$installAudio" ]; then + stow -t "$HOME" cmus +fi +if ! [ -z "$installGraphic" ]; then + stow -t "$HOME" bspwm + stow -t "$HOME" colorschemes + stow -t "$HOME" dunst + stow -t "$HOME" emoji + stow -t "$HOME" mpv + stow -t "$HOME" picom + stow -t "$HOME" qutebrowser + stow -t "$HOME" sxhkd + stow -t "$HOME" sxiv + stow -t "$HOME" XserverDotfiles + stow -t "$HOME" zathura +fi echo "" ) @@ -70,6 +148,9 @@ cd "$HOME/repos" if ! type dmenu; then ( cd dmenu + git remote add xyz "${server}:~/repos/remotes/dmenu" + git checkout -b taamas + git pull xyz taamas make sudo make install make clean @@ -95,35 +176,18 @@ echo "" ) # Install programs with yay -sed -n '/^# yay/,$p' "$packagesFile" | sed '/^#/d' | yay -S - - -# Directory structure -mkdir -p "$HOME/downloads/videos" -mkdir -p "$HOME/downloads/audios" -mkdir -p "$HOME/images/screenshots" -mkdir -p "$HOME/images/wallpapers/shufs/current" +getPackageGroup "yay" | yay -S - # Mainpage ( cd "$HOME/repos" -git clone "https://github.com/InigoGutierrez/mainpage.git" +git clone "https://git.taamas.xyz/Taamas/mainpage" cp -r "mainpage" "$HOME/.mainpage" rm -rf "$HOME/.mainpage/.git" ) -# Set up nvim (as in nvim-from-vim) -mkdir -p "$HOME/.config/nvim" -echo "set runtimepath^=~/.vim runtimepath+=~/.vim/after -let &packpath = &runtimepath -source ~/.vimrc" >"$HOME/.config/nvim/init.vim" - -# vim-plug -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - # Remove default .bash_profile as it avoids .profile execution if [ -f ".bash_profile" ]; then - echo "Remove .bash_profile? It prevents .profile from being executed. [y/N]" - read answer - echo "$answer" | grep -E -q '^[yY]' && rm .bash_profile + prompt "Remove .bash_profile? It prevents .profile from being executed. [y/N]" \ + rm .bash_profile fi -- cgit v1.2.1