-
Notifications
You must be signed in to change notification settings - Fork 9
/
ghINSTALL.sh
executable file
·37 lines (33 loc) · 1.02 KB
/
ghINSTALL.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Install GITHELP
if [[ -d ~/GitHelp ]]; then
CURRENT_VERSION=`~/GitHelp/ghVERSION.sh`
NEW_VERSION=`./GitHelp/ghVERSION.sh`
printf "\nUpgrade GitHelp?\n"
printf " From $CURRENT_VERSION\n"
printf " To $NEW_VERSION\n\n"
printf " GitHelp repository configurations will be preserved.\n"
else
printf "\nInstall GitHelp?\n"
fi
read -p "Are you sure? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
printf "\nOperation canceled.\n\n"
exit 1
fi
if [[ -a ~/.bash_profile ]]; then
BACKUP_NAME=".bash_profile-"`date '+%Y-%m-%d-%R'`
cp ~/.bash_profile ~/$BACKUP_NAME
printf "\nYour current .bash_profile has been backed up to $BACKUP_NAME\n\n"
cat ~/$BACKUP_NAME | sed '/#===== GitHelp - START =====/,$d' > ~/.bash_profile
cat GitHelp/bash_profile >> ~/.bash_profile
else
cp GitHelp/bash_profile ~/.bash_profile
fi
if [[ -d ~/GitHelp ]]; then
rm -rf ~/GitHelp
fi
cp -rf GitHelp ~/
printf "WARNING:\n Close all existing bash windows and reopen.\n\n"