-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·52 lines (37 loc) · 1.17 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·52 lines (37 loc) · 1.17 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
install_dir=$HOME
echo -e "Installing xp-mode to <$install_dir>\n"
file="xp-mode.sh"
url="https://raw.githubusercontent.com/ben-biddington/xp-mode/master/xp-mode.sh"
home=$HOME/.xp-mode
people_file=$home/people
filename=$install_dir/xp-mode.sh
profile=$HOME/.bash_profile
if [ ! -d "$home" ]; then
mkdir "$home"
fi
if [ -z $SKIP_DOWNLOAD ]; then
if [ -f "$filename" ]; then
echo -e "Deleting file at <$filename>\n"
rm "$filename"
fi
upstreamHash=$(curl -s $url | md5sum - | awk '{ print $1 }')
echo -e "Downloading <$url> to <$filename>\n"
echo -e "Hash for <$url> is:\n\n\t$upstreamHash\n"
curl -s $url > "$filename"
localHash=$(md5sum "$filename" | awk '{ print $1 }')
echo -e "Hash for <$filename> is:$localHash\n\n\t\n"
else
cp xp-mode.sh "$filename"
fi
touch "$profile"
if [[ $(grep -Eir "# xp-mode" "$profile" | wc -l) -eq 0 ]]; then
echo "source "$filename" # xp-mode" >> "$profile"
echo "Updated <$profile>"
fi
if [ ! -f "$people_file" ]; then
touch "$people_file"
echo "People file created at <$people_file>"
else
echo "People file already exists at <$people_file>, leaving it alone"
fi