Update deploy.sh

This commit is contained in:
Marko Korhonen 2020-11-21 15:36:35 +02:00
parent e43d577871
commit 5dee29be70

87
deploy.sh Normal file → Executable file
View file

@ -1,18 +1,19 @@
#!/bin/bash #!/bin/zsh
# to run this, execute # This is a script that should be ran once
# bash <(curl -sL git.reekynet.com/ReekyMarko/dotfiles/raw/branch/master/deploy.sh) # on a new system. Dotdrop will take it from there.
# It is higly tailored to my own needs and
# you (the random person on the internet) should probably not run it
# Run this to install my dotfiles on a fresh Arch Linux installation. export DOTREPO="$HOME/git/dotfiles"
# This should work on any Arch Linux install with an internet connection DISTRO="$(lsb_release -ds | sed 's/"//g')"
# and sudo rights
# When asked a hostname, make sure it's already in the dotrop config, PKGLIST=""
# otherwise dotdrop won't install anything
export DOTREPO="$HOME/Git/dotfiles" if [ -d $DOTREPO ]; then
export HOSTNAME="$(hostnamectl | head -n 1 | sed 's/ //g' | cut -d':' -f2-)" print "Dotfile repository already exists, exiting..."
export DISTRO="$(lsb_release -ds | sed 's/"//g')" exit 1
fi
if [ "$DISTRO" -ne "Arch Linux" ]; then if [ "$DISTRO" -ne "Arch Linux" ]; then
print "Not running on Arch Linux" print "Not running on Arch Linux"
@ -20,31 +21,51 @@ if [ "$DISTRO" -ne "Arch Linux" ]; then
exit 1 exit 1
fi fi
read -p "Hostname [$HOSTNAME]: " -i $HOSTNAME NEWHOSTNAME # install neovim if not installed
if [ "$HOSTNAME -ne $NEWHOSTNAME" ]; then if ! [ -x "$(command -v nvim)" ]; then
sudo hostnamectl set-hostname $NEWHOSTNAME read -p "Install neovim? [Y/n] " -i "y" INVIM
fi if [ "$(tr '[:upper:]' ':lower:' $INVIM)" -eq "y" ]; then
HOSTNAME=$NEWHOSTNAME print "Installing neovim"
PKGLIST=$PKGLIST + " neovim neovim-dropin"
# install yay
if ! [ -x "$(command -v yay)" ]; then
read -p "Install yay? [Y/n] " -i "y" IYAY
if [ "$(tr '[:upper:]' ':lower:' $IYAY)" -eq "y" ]; then
print "Installing yay"
fi fi
sudo pacman -Syu --needed --noconfirm git wget base-devel
cd
wget https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz
tar xfv yay.tar.gz
cd yay
makepkg -si --noconfirm
cd ..
rm -r yay*
fi fi
mkdir ~/Git # install zsh if not installed
git clone https://git.reekynet.com/ReekyMarko/dotfiles.git $DOTREPO if ! [ -x "$(command -v zsh)" ]; then
cd ~/Git/dotfiles read -p "Install zsh? [Y/n] " -i "y" IZSH
if [ "$(tr '[:upper:]' ':lower:' $INVIM)" -eq "y" ]; then
print "Installing zsh"
PKGLIST=$PKGLIST + " zsh"
fi
fi
# install paru if not installed
if ! [ -x "$(command -v paru)" ]; then
read -p "Install paru? [Y/n] " -i "y" IYAY
if [ "$(tr '[:upper:]' ':lower:' $IYAY)" -eq "y" ]; then
print "Installing paru"
sudo pacman -Syu --needed --noconfirm git wget base-devel
cd
wget https://aur.archlinux.org/cgit/aur.git/snapshot/paru-bin.tar.gz
tar xfv paru.tar.gz
cd paru
makepkg -si --noconfirm
cd ..
rm -r paru*
fi
fi
if [ $PKGLIST -ne "" ]
if ! [ -x "$(command -v paru)" ]; then
print "Can't continue without paru"
paru -S $PKGLIST
fi
fi
mkdir ~/git
git clone https://git.korhonen.cc/ReekyMarko/dotfiles.git $DOTREPO
cd ~/git/dotfiles
git submodule init git submodule init
git submodule update git submodule update
$DOTREPO/dotdrop.sh --cfg=$DOTREPO/config-home.yaml install $DOTREPO/dotdrop.sh --cfg=$DOTREPO/config-home.yaml install