diff --git a/install.sh b/install.sh index 9351a2a..065e29e 100644 --- a/install.sh +++ b/install.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash + export REPO="git@github.com:KevinMidboe/dotfiles" export DOT_CONFIG_FOLDER="$HOME/.config" @@ -7,6 +8,7 @@ echo "Cloning github repo" git clone --depth=1 -b main $REPO $DOT_CONFIG_FOLDER cd $DOT_CONFIG_FOLDER +git pull origin main # create symlinks echo "Creating symlinks" @@ -15,11 +17,21 @@ ln -s $HOME/.config/wakatime.cfg $HOME/.wakatime.cfg # copy script files echo "Copying scripts to /usr/local/bin" -cp scripts/* /usr/local/bin/ +cd scripts +if [ $EUID != 0 ]; then + for script in ./*; do + echo " copying $script" + sudo cp $script /usr/local/bin/ + done + + sudo chmod 755 -R /usr/local/bin/ +fi +cd .. # run install scripts for script in install/*.sh; do + echo "" echo "Running install script $script..." - sh "$script" + bash "$script" done