-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstaller.sh
executable file
·35 lines (30 loc) · 1011 Bytes
/
installer.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
#!/usr/bin/env bash
# sudo cp ./giterminal.sh /usr/local/bin/giterminal #I don't like using sudo
# sudo cp -r ./helpers/ /usr/local/bin/
mainDirectory=".giterminal"
function copyFiles {
cp ./giterminal.sh ~/$mainDirectory/
mv ~/$mainDirectory/giterminal.sh ~/$mainDirectory/giterminal
cp ./updater.sh ~/$mainDirectory/
mv ~/$mainDirectory/updater.sh ~/$mainDirectory/updater
cp -r ./helpers ~/$mainDirectory/
}
rcFile=~/".bashrc"
if bash --version | grep -q darwin
then
rcFile=~/".bash_profile"
fi
mainAlias="alias giterminal='~/$mainDirectory/giterminal'"
updaterAlias="alias giterminalUpdater='~/$mainDirectory/updater'"
aliasFound=$(cat $rcFile | grep giterminal=)
if [ "$aliasFound" == "$mainAlias" ]; then
echo "Updating from local files. For a repo update, use giterminalUpdater command"
copyFiles
else
echo $mainAlias >> $rcFile
echo $updaterAlias >> $rcFile
mkdir ~/.giterminal
copyFiles
echo "giterminal installed successfully"
exec bash
fi