carbs

Cem's Auto Rice Bootstrapping Scripts
git clone git://git.ckyln.com/carbs.git
Log | Files | Refs | README | LICENSE

commit 0539a28d0bdfa85d8b5b90a719b24b782b97ca4c
parent 3d0694e517ea6f80e7eff8b688d8ba9553d91a0c
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon, 23 Sep 2019 15:17:04 +0300

Rewritten

Diffstat:
Mcarbs | 567++++++++++++++++++++++---------------------------------------------------------
1 file changed, 153 insertions(+), 414 deletions(-)

diff --git a/carbs b/carbs @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ## CARBS, Cem's Auto-Rice Bootstrapping Script ## Copyright (C) 2019 Cem Keylan <cem@ckyln.com> @@ -17,428 +17,167 @@ ## along with this program. If not, see <https://www.gnu.org/licenses/>. -#Default Values -export WALLPAPER=${WALLPAPER-TRUE} -export I3=${I3-TRUE} -export EXECUTE=${EXECUTE-FALSE} -export DM=${DM-FALSE} -export COMBINED=${COMBINED-FALSE} # Does not ask to restart display manager if combined with another script -export DEFAULTS=${DEFAULTS-FALSE} -export ZSHINST=${ZSHINST-FALSE} +# Messages below are taken from Arch scripts +out() { printf "$1 $2\n" "${@:3}"; } +error() { out "==> ERROR:" "$@"; } >&2 +warning() { out "==> WARNING:" "$@"; } >&2 +msg() { out "==>" "$@"; } +msg2() { out " ->" "$@";} +die() { error "$@"; exit 1; } -case $1 in - --dry-run) - if [ -e $HOME/fakehome ] - then - rm -r -f $HOME/fakehome - fi - mkdir $HOME/fakehome - TEST=1 - pacman="pacman -T" - HOME=$HOME/fakehome - ;; - *) - pacman="pacman -T" - TEST=0 - ;; -esac -mkdir $HOME/carbsinstall -CARBHOME=$HOME/carbsinstall -# Script Colors -YELLOW='\033[1;33m' -BLUE='\033[1;36m' -RED='\033[1;31m' -GREEN='\033[0;32m' -ORANGE='\033[0;33m' -NC='\033[0m' # No Color +[ $EUID = 0 ] && die 'Please run this script without root priviliges' -errorhandler() {\ - echo -e "${RED}Error: $1${NC}" | tee -a $CARBHOME/log &&\ - exit 1 +BASE="$PWD" + +usage() { + cat <<EOF +usage: ${0##*/} [options] + + Options: + -p <progs.csv> Use an alternative progs.csv file (must be local) + -r <repo url> Use an alternative dotfiles repo + -d <location> Specify another place to install dotfiles + -n Run the script noninteractively + -h/--help Print this help message + +CARBS installs a functional desktop environment. + +EOF } -[ $EUID = 0 ] && errorhandler 'You cannot run this script as the root user' -UN=$USER +if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then + usage + exit +fi -while : -do - if [ $EXECUTE = TRUE ] - then - break - fi - clear - printf "${BLUE}==================================================\n=== ====== ===== === ===== ==\n== === ==== ==== ==== == === === ==== =\n= ========= == === ==== == ==== == ==== =\n= ======== ==== == === == === ==== ======\n= ======== ==== == ==== ======= ====\n= ======== == ==== == === ======== ==\n= ======== ==== == ==== == ==== == ==== =\n== === == ==== == ==== == === === ==== =\n=== === ==== == ==== == ===== ==\n==================================================\n" - printf "${BLUE}Welcome to Cem's Auto-Rice Bootstrapping Script!\n\nPlease make sure -that this is a brand new installation of Arch Linux, Manjaro Linux, or Anarchy Linux.\n\n\nHere are your options:\n\n" - if [ $(uname -m) != "x86_64" ] - then - printf "${RED}Warning! Your architechture does not seem to be 64-bit. \nIf you are using an ARM Processor, this script will not work as some of the requirements cannot be built in ARMv8 architechture.\nIf you have 32-bit architechture, installation will be fine, however, there are problems in the way compton works (it doesn't).${BLUE}" - fi - echo -e "Key Option Current" - echo -e " ${YELLOW}w) Default Wallpapers $WALLPAPER" - echo -e " ${YELLOW}i) Tiling Desktop $I3" - echo -e " ${YELLOW}d) Display Manager (sddm) $DM" - echo -e " ${YELLOW}z) Make Zsh Default Shell $ZSHINST" - echo -e " ${YELLOW}n) Install Defaults ONLY $DEFAULTS" - echo -e " ${YELLOW}e) Start Script" - echo -e " ${YELLOW}q) Exit Program" - printf "\nType your answer: " - read answer - case $answer in - w) - if [ $WALLPAPER = TRUE ] - then - WALLPAPER=FALSE - else - WALLPAPER=TRUE - fi - ;; - i) - if [ $I3 = TRUE ] - then - I3=FALSE - else - I3=TRUE - fi - ;; - d) - if [ $DM = TRUE ] - then - DM=FALSE - else - DM=TRUE - fi - ;; - z) - if [ $ZSHINST = TRUE ] - then - ZSHINST=FALSE - else - ZSHINST=TRUE - fi - ;; - n) - if [ $DEFAULTS = TRUE ] - then - DEFAULTS=FALSE - else - DEFAULTS=TRUE - fi - ;; - e) - if [ $WALLPAPER = FALSE ] && [ $I3 = FALSE ] - then - echo "No option selected, quitting" - exit - fi - EXECUTE=TRUE - ;; - q) - exit - ;; - *) - echo That is not a valid option - ;; +while getopts ':p::d::r:n' flag; do + case $flag in + p) [ -e $OPTARG ] && progs=$OPTARG || die 'Could not find progs.csv file' ;; + r) git ls-remote $OPTARG >/dev/null 2>&1 && dotfiles=$OPTARG || die 'Could not find repo' ;; + d) [ -d $OPTARG ] && targetdir=$OPTARG || die 'Target location %s does not exist or is not a directory' "$OPTARG" ;; + n) sudo -V >/dev/null 2>&1 && interactive=0 || die 'Sudo must be installed in order to have a non interactive installation' ;; + :) die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG" ;; + ?) die '%s: invalid option -- '\''%s'\' "${0##*/}" "$OPTARG" ;; esac done -echo "Setting the installation of wallpapers to $WALLPAPER" >> $CARBHOME/log -echo "Setting the installation of ZSH to $ZSHINST" >> $CARBHOME/log -echo "Setting the installation of display manager to $DM" >> $CARBHOME/log -echo "Setting the installation of tiling desktop to $I3" >> $CARBHOME/log -clear -echo -e "${GREEN}Starting Script${NC}" | tee -a $CARBHOME/log -if [ -n "$(pacman -T git)" ] -then - if [ -n "$(pacman -T sudo)" ] - then - if [ $I3 = TRUE ] || [ $DM =TRUE ] - then - printf "Enter root password\n" - su -c "pacman -Sy && pacman -S base-devel --noconfirm && printf '$UN ALL=(ALL) NOPASSWD: ALL\n' > /etc/sudoers.d/new" - else - printf "Enter root password\n" - fi - su -c "pacman -Sy && pacman -S --noconfirm git" - else - sudo pacman -S --noconfirm git - fi -fi -if [ $WALLPAPER = TRUE ] -then - mkdir -p $HOME/Pictures/Wallpapers && \ - echo -e "${GREEN}Created a folder to the path $HOME/Pictures/Wallpapers${NC}" &&\ - cd $HOME/Pictures && echo -e "${YELLOW}Downloading Wallpapers" &&\ - git clone https://git.ckyln.com/Wallpapers && echo -e "${GREEN}Downloaded Wallpapers successfully${NC}" || errorhandler "Could not download wallpapers\nYou might want to download those directly.\nPlace those in $HOME/Pictures/Wallpapers" -fi -if [ $DM = TRUE ] -then - [ -n "$(pacman -T sudo)" ] && printf "Installing base-devel\n\nPlease enter root password\n" && su -c "pacman -Sy && pacman -S base-devel --noconfirm && printf '$UN ALL=(ALL) NOPASSWD: ALL\n' > /etc/sudoers.d/new" - echo -e "${YELLOW}Installing Simple Display Desktop Mnaager" | tee -a $CARBHOME/log && sleep 1 - sudo pacman -S --noconfirm sddm && sudo systemctl enable sddm || errorhandler "There was an error installing SDDM, do you already have a Display Manager enabled?" -fi -if [ $ZSHINST = TRUE ] -then - echo -e "${YELLOW}Installing ZSH" | tee -a $CARBHOME/log - [ -n "$(pacman -T sudo)" ] && printf "Installing sudo\n\nPlease enter root password\n" && su -c "pacman -Sy && pacman -S sudo --noconfirm && printf '$UN ALL=(ALL) NOPASSWD: ALL\n' > /etc/sudoers.d/new" - pacman -T zsh | xargs -r sudo pacman -S --noconfirm - sudo chsh -s /usr/bin/zsh $USER -fi -if [ $I3 = TRUE ] -then - echo -e "${YELLOW}Installing Mandatory Packages" | tee -a $CARBHOME/log && sleep 1 - printf "These are:\n* compton\n* feh (wallpaper handler)\n* polybar\n* mpd (music player daemon)\n* xorg-xbacklight (screen brightness controller\n* material icons (bar icons)\n* i3-gaps tiling window manager\n\n" - sleep 1 - [ -n "$(pacman -T sudo)" ] && printf "Installing base-devel\n\nPlease enter root password\n" && su -c "pacman -Sy && pacman -S base-devel --noconfirm && printf '$UN ALL=(ALL) NOPASSWD: ALL\n' > /etc/sudoers.d/new" - if [ $TEST = 0 ] && [ $DM = FALSE ] - then - sudo pacman -Sy || errorhandler "Could not refresh repository cache, is your keyring up to date? Are you sure you are connected to the internet?" - fi - [ -n "$(pacman -T fakeroot)" ] && sudo pacman -S --noconfirm base-devel - if [ $(pacman -T yay) = "yay" ] - then - git clone https://aur.archlinux.org/yay-bin.git - cd yay-bin - makepkg -si --noconfirm - fi - if [ "$(pacman -Q i3-wm 2>/dev/null | awk '{print $1}')" = "i3-wm" ] - then - sudo pacman -R i3-wm || errorhandler "Could not remove i3-wm" - fi - yay -T clipit ttf-material-icons-git | xargs -r yay -S --noconfirm - pacman -T i3-gaps rofi dunst neovim unclutter polkit-gnome ttf-bitstream-vera jq ttf-dejavu ttf-droid ttf-inconsolata ttf-indic-otf ttf-liberation mpc entr xautolock compton zathura zathura-pdf-mupdf feh sxiv mpd xorg-xbacklight | xargs -r sudo pacman -S --noconfirm | tee -a $CARBHOME/log || errorhandler "Could not install some of the packages, check the logs at $CARBHOME/log for more information." - yay -T polybar | xargs -r yay -S --noconfirm || errorhandler "Could not install polybar" - yay -T sxlock-git | xargs -r yay -S --noconfirm || errorhandler "Could not install sxlock-git" - yay -T st-ckyln-git | xargs -r yay -S --noconfirm || errorhandler "Could not install st" - cd .. - echo -e "${GREEN}Installed Mandatory Packages" | tee -a $CARBHOME/log - sleep 2 - printf "Downloading configuration files\n" | tee -a $CARBHOME/log - cd $CARBHOME && git clone https://git.ckyln.com/dotfiles && cd $CARBHOME/dotfiles && mkdir -p $HOME/.config/i3 && mkdir -p $HOME/.config/polybar && mkdir -p $HOME/.config/terminator &&\ - cp -v $PWD/.config/i3/config $HOME/.config/i3/config && cp -v $PWD/.config/polybar/config $HOME/.config/polybar/config && cp -v $PWD/.config/terminator/config $HOME/.config/terminator/config && cp -v $PWD/.config/dunstrc $HOME/.config/dunstrc && cp -r -v $PWD/.config/calcurse $HOME/.config && cp -r -v $PWD/.config/rofi $HOME/.config && cp -r -v $PWD/.config/mpd $HOME/.config && cp -r -v $PWD/.config/nvim $HOME/.config && printf "${GREEN}Sucessfully placed configuration files\n" | tee -a $CARBHOME/log - printf "Installing vim-plug\n" && curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | tee -a $CARBHOME/log - printf "Running PlugInstall\n" && nvim -c "PlugInstall | :q | :q" | tee -a $CARBHOME/log - printf "${YELLOW}Installing binaries to $HOME/bin" | tee -a $CARBHOME/log - mkdir -p $HOME/bin - cp $PWD/bin/* $HOME/bin/ && printf " ${GREEN} Done\n" | tee -a $CARBHOME/log - echo -e "${YELLOW}Downloading dmenu from repository" | tee -a $CARBHOME/log - cd $CARBHOME && git clone https://git.ckyln.com/dmenu && cd dmenu || errorhandler "Could not clone dmenu" - while : - do - clear - if [ $DEFAULTS = FALSE ] - then - printf "${BLUE}Would you like to configure dmenu?\n(y/n) " - read answer - else - answer=y - fi - case $answer in - y) - ${EDITOR-nano} $PWD/config.h - break - ;; - n) - break - ;; - *) - echo This is not a valid option - sleep 2 - ;; - esac - done - echo -e "${YELLOW}Compiling and installing dmenu" >> $CARBHOME/log - if [ $TEST = 0 ] - then - make && sudo make install && echo -e "${GREEN}Successfully installed dmenu" | tee -a $CARBHOME/log && sleep 2 || "Could not install dmenu" - else - make && echo Skipping Installation because of dry run | tee -a $CARBHOME/log - fi - while : - do - clear - if [ $DEFAULTS = FALSE ] - then - printf "${RED}Should I install bashrc? This is dangerous if this is not a fresh system\n(y/n) " - read answer - else - answer=y - fi - case $answer in - y) - cp -f $CARBHOME/dotfiles/.bashrc $HOME/.bashrc && printf "${GREEN}Successfully installed BashRC" | tee -a $CARBSHOME/log - cp -f $CARBHOME/dotfiles/.aliases $HOME/.aliases - break - ;; - n) - break - ;; - *) - echo -e "${RED}This is not a valid option" - sleep 2 - ;; - esac - done - while : + +[ -z $dotfiles ] && dotfiles="https://git.ckyln.com/dotfiles" +[ -z $targetdir ] && targetdir="$HOME" +[ -z $progs ] && curl -sLo /tmp/progs.csv git.ckyln.com/carbs/plain/progs.csv && progs="/tmp/progs.csv" +[ -z $interactive ] && interactive=1 + +welcomepage() { + clear + cat <<EOF +================================================== +=== ====== ===== === ===== == +== === ==== ==== ==== == === === ==== = += ========= == === ==== == ==== == ==== = += ======== ==== == === == === ==== ====== += ======== ==== == ==== ======= ==== += ======== == ==== == === ======== == += ======== ==== == ==== == ==== == ==== = +== === == ==== == ==== == === === ==== = +=== === ==== == ==== == ===== == +================================================== + +Welcome to Cem's Auto-Rice Bootstrapping Script! + +Please make sure that this is a brand new installation +of Arch Linux, Manjaro Linux, or Anarchy Linux. + +WARNING: Carbs will alter your home directory ($HOME), so you might +want to backup in case you have important files on your home directory +EOF +printf "Proceed? (y/N) " +read ans +[ "$ans" = "y" ] || die 'User exited' +} + +makeinstall() { + cd /tmp + dir="$(mktemp -d)" + git clone $1 $dir || die 'Could not clone git repo' + cd $dir + make || die 'Could not build %s' "$1" + sudo make install || die 'Could not install %s' "$1" +} + +installcsv() {\ + [ -e $BASE/progs.csv ] || curl -Lo $BASE/progs.csv https://git.ckyln.com/carbs/plain/progs.csv + [ -e $BASE/progs.csv ] || die 'Could not retrieve progs.csv' + while IFS=, read -r src name do - clear - if [$DEFAULTS = FALSE ] - then - printf "${YELLOW}Should I install zsh?\n(y/n) " - read answer - else - answer=y - fi - case $answer in + case $src in y) - pacman -T zsh | xargs -r sudo pacman -S --noconfirm || errorhandler 'Could not install Z-shell' - cp -f $CARBHOME/dotfiles/.zshrc $HOME/.zshrc && printf "${GREEN}Successfully install Z-Shell RC\n" | tee -a $CARBSHOME/log - break - ;; - n) - break ;; - *) - echo -e "${RED}This is not a valid option" - sleep 2 - ;; - esac - done - while : - do - clear - echo BROWSER INSTALLATION >> $CARBHOME/log - if [ $DEFAULT = FALSE ] - then - printf "${BLUE}What would you prefer as your browser:\n\n${YELLOW}1) Firefox (recommended if you are not familiar to vim)\n2) qutebrowser (a browser with vim-like controls)\n3) midori (a lightweight browser that I use on my ancient netbook)\n\nPlease choose: ${GREEN}" - read answer - else - answer=2 - fi - printf "${YELLOW}" - case $answer in - 1) - echo Installing FIREFOX | tee -a $CARBHOME/log - sudo $pacman firefox | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install Firefox" - BROWSER=firefox - printf "\n# Web Browser \nset \$brow firefox" >> $HOME/.config/i3/config - break - ;; - 2) - echo Installing QUTEBROWSER | tee -a $CARBHOME/log - sudo $pacman qutebrowser | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install qutebrowser" - BROWSER=qutebrowser - printf "\n# Web Browser \nset \$brow qutebrowser" >> $HOME/.config/i3/config - break - ;; - 3) - echo Installing MIDORI | tee -a $CARBHOME/log - sudo $pacman midori | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install Midori" - BROWSER=midori - printf "\n# Web Browser \nset \$brow midori" >> $HOME/.config/i3/config - break - ;; - *) - echo -e "${RED}This is not a valid option" - sleep 2 - ;; - esac - done - while : - do - clear - echo MUSIC PLAYER INSTALLATION >> $CARBHOME/log - if [ $DEFAULT = FALSE ] - then - printf "${BLUE}What would you prefer as your Music Player:\n\n${YELLOW}1) ncmpcpp (Ncurses music player that runs off mpd (Music Player Daemon)\n2) mocp (Terminal-based music player)\n3) Ario\nn) None, I will install and configure it on my own\n\nPlease choose: ${GREEN}" - read answer - else - answer=1 - fi - printf "${YELLOW}" - case $answer in - 1) - echo Installing NCMPCPP | tee -a $CARBHOME/log - sudo $pacman ncmpcpp | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install ncmpcpp" - printf "\n#Music Player \nset \$music terminator -e \"ncmpcpp --port 6601 && exit\"\n" >> $HOME/.config/i3/config - break - ;; - 2) - echo Installing MOCP | tee -a $CARBHOME/log - sudo $pacman moc | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install MOCP" - printf "\n#Music Player \nset \$music terminator -e \"mocp && exit\"\n" >> $HOME/.config/i3/config - break - ;; - 3) - echo Installing Ario | tee -a $CARBHOME/log - sudo $pacman ario | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install MOCP" - printf "\n#Music Player \nset \$music ario\n" >> $HOME/.config/i3/config - break - ;; - n) - echo -e "$USER opted out of music player" >> $CARBHOME/log - break - ;; - *) - echo -e "${RED}This is not a valid option" - sleep 2 - ;; - esac - done - while : - do - clear - if [ $DEFAULT = FALSE ] - then - printf "${BLUE}What would you prefer as your File Manager:\n\n${YELLOW}1) lf (Terminal-based file manager)\n2) Nemo (qt file manager)\n3) Dolphin\nn)None, I don't want a file manager\n\nPlease choose: ${GREEN}" - read answer - else - answer=1 - fi - printf "${YELLOW}" - case $answer in - 1) - echo Installing lf | tee -a $CARBHOME/log - yay -T lf-bin | xargs -r yay -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install lf" - printf "\n# File Manager \nset \$fm terminator -e \"lf && exit\"\n" >> $HOME/.config/i3/config - break - ;; - 2) - echo Installing Nemo | tee -a $CARBHOME/log - sudo $pacman nemo | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install Nemo File Manager" - printf "\n# File Manager \nset \$fm nemo\n" >> $HOME/.config/i3/config - break - ;; - 3) - echo Installing Dolphin | tee -a $CARBHOME/log - sudo $pacman dolphin | xargs -r sudo pacman -S --noconfirm && echo -e "${GREEN}Installed successfully" | tee -a $CARBHOME/log || errorhandler "Could not install Dolphin File Manager" - printf "\n# File Manager \nset \$fm dolphin\n" >> $HOME/.config/i3/config - break - ;; - n) - break - ;; + out 'Installing %s' "$name" + yay -S --noconfirm --needed $name >/dev/null || die 'Could not install %s' "$name" + msg 'Installed %s' "$name" ;; + g) + out 'Installing %s' "$name" + makeinstall $name || die 'Could not install %s' "$name" + msg 'Installed %s' "$name" ;; *) - echo -e "${RED}This is not a valid option" - sleep 2 - ;; + out 'Installing %s' "$name" + sudo pacman -S --noconfirm --needed $name >/dev/null || die 'Could not install %s' "$name" + msg 'Installed %s' "$name" ;; esac - done - printf "Installing Documentation, License, and README to /usr/share/doc/carbs\n" && sudo mkdir /usr/share/doc/carbs && sudo curl -o /usr/share/doc/carbs/DOCUMENTATION.pdf https://cemkeylan.com/files/carbs.pdf && sudo curl -o /usr/share/doc/carbs/README.md https://git.ckyln.com/carbs/plain/README.md && sudo curl -o /usr/share/doc/carbs/LICENSE https://git.ckyln.com/carbs/plain/LICENSE && sudo chmod 644 /usr/share/doc/carbs/* - if [ $TEST = 0 ] && [ $COMBINED = FALSE ] - then - clear - printf "${GREEN}IMPORTANT NOTE:\nYou should restart your display-manager after the first time you launch i3\n\nThe script is finished, should I restart your display manager?\n(yes/no) " - read answer - case $answer in - yes) - sudo systemctl restart display-manager || errorhandler "The script was successful, however, display manager could not be restarted, exiting..." - ;; - *) - echo Exiting - exit - ;; - esac - else - echo Exiting - fi -fi + done < $progs +} +installyay() {\ + sudo pacman -S --noconfirm --needed base-devel + cd /tmp + dir=$(mktemp -d) + cd $dir + curl -Lo $dir/PKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yay-bin" + makepkg --noconfirm -si || die 'Could not install yay' +} + +sudouser() {\ + warning "You don't seem to have sudo installed\nCarbs will now install sudo and add you\nto sudoers" + su -c "pacman -S sudo --noconfirm && \ + printf '$1 ALL=(ALL) NOPASSWD: ALL\n' > /etc/sudoers.d/new" +} + +dotfilesinstall() { + cd /tmp + dir="$(mktemp -d)" + git clone $1 $dir/repo + cp -rfT $dir/repo $targetdir + rm $targetdir/README.md $targetdir/LICENSE $targetdir/.git -rf $targetdir/screenshots +} + +neovimconfig() { + out 'Installing nvim plugins' + curl -fLo $targetdir/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim || error 'Could not download plug.vim' + [ $targetdir = $HOME ] && nvim -c "PlugInstall | :q | :q" && msg 'Installed vim plugs' +} + +wallpaperinstall() { + out ' Installing wallpapers' + mkdir -p $targetdir/Pictures + git clone https://git.ckyln.com/Wallpapers $targetdir/Pictures/Wallpapers && msg 'Downloaded Wallpapers' || error 'Could not install wallpapers' +} + +finalize() { + clear + cat <<EOF +Carbs is finished, it is best to do a reboot + +EOF +} + + + +if [ $interactive = 1 ]; then + welcomepage + sudo -V >/dev/null 2>&1 || sudouser $USER +fi +yay -V >/dev/null 2>&1 || installyay +installcsv +dotfilesinstall $dotfiles +nvim -v >/dev/null 2>&1 && neovimconfig || warning 'Not installing nvim plugins' +sudo chsh -s /usr/bin/zsh $USER +wallpaperinstall +finalize