Browse Source

Don't automatically install packages in install.sh

Frans Bergman 4 years ago
parent
commit
5ada7b440c
1 changed files with 16 additions and 24 deletions
  1. 16 24
      install.sh

+ 16 - 24
install.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 
 fancy_print() {
-    printf "\033[31m#### $1\033[0m\n"
+    printf "\033[31m#### %s\033[0m\n" "$1"
 }
 
 fancy_print "Linking dotfiles"
@@ -13,38 +13,28 @@ do
         .git) continue ;;
         *.swp) continue ;;
     esac
-    ln -s $(realpath $f) ~/
+    ln -s "$(realpath "$f")" ~/
 done
 
-fancy_print "Installing packages"
-sudo xbps-install -Suy $(cat packages.txt)
-
-fancy_print "Installing optional software"
-
-prompt_install()
+prompt()
 {
     while true
     do
-        echo -n "Install $1? [y/n] "
-        read yn
+        printf "%s [y/n] " "$1"
+        read -r yn
         case $yn in
-            [Yy]* ) xi -y $1; break;;
-            [Nn]* ) break;;
+            [Yy]* ) return 0;;
+            [Nn]* ) return 1;;
             * ) echo "Please answer yes or no.";;
         esac
     done
 }
 
-for line in $(cat optional_packages.txt)
-do
-    prompt_install "$line"
-done
-
 git_make_install()
 {
     (
     mkdir -p "$HOME/git/$1"
-    cd "$HOME/git/$1"
+    cd "$HOME/git/$1" || return
     git clone "$2" .
     make
     sudo make install
@@ -54,11 +44,11 @@ git_make_install()
 fancy_print "Installing Oh My Zsh"
 sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
 # Replace default Oh My Zsh config
-ln -sf $(realpath .zshrc) ~
+ln -sf "$(realpath .zshrc)" ~
 
 fancy_print "Installing Oh My Zsh plugins"
-git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
-git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
+git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"
+git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"
 
 fancy_print "Installing fzf"
 git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
@@ -69,9 +59,11 @@ curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
         https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
 
 fancy_print "Installing suckless forks"
-git_make_install "st" "https://gogs.tankernn.eu/Tankernn/st.git"
-git_make_install "dwm" "https://gogs.tankernn.eu/Tankernn/dwm.git"
-git_make_install "mpv-prescalers" "https://github.com/bjin/mpv-prescalers.git"
+if prompt "Install st and dwm?" ; then
+    git_make_install "st" "https://gogs.tankernn.eu/Tankernn/st.git"
+    git_make_install "dwm" "https://gogs.tankernn.eu/Tankernn/dwm.git"
+fi
+prompt "Install mpv prescalers?" && git_make_install "mpv-prescalers" "https://github.com/bjin/mpv-prescalers.git"
 
 printf "\033[31m"
 figlet "Installation complete!"