ink-os/install-config

55 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
#-----------------------------------
# Name: install-dmenu-inkletblot
# Version: 1.0.0
# Author: Solomon Laing
# Description:
# Installs my customisation of dmenu
#-----------------------------------
clear
echo "This script is going to install my dotfiles."
read -r -p "Are you sure you want to continue? [Y/n] " input
case $input in
[nN][oO] | [nN])
exit 0
;;
*)
echo "The program will continue..."
;;
esac
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
if [ ! -d $HOME/.cfg ]; then
git clone --bare https://gitlab.inkletblot.com/inkletblot/config.git $HOME/.cfg
fi
echo "
The script will now attempt to install the configs, if configs have been installed using the method found here: https://www.atlassian.com/git/tutorials/dotfiles, there will be issues.
"
config checkout main
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";
mkdir -p $HOME/.config-backup
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv $HOME/{} $HOME/.config-backup/{}
fi;
config checkout main
config config status.showUntrackedFiles no
config config --global credential.helper store
read -r -p "Remember to identify yourself to git with
config config user.name \"Your Name\" and config config user.email \"Your Email\".
Press [Enter] to continue."