-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·44 lines (36 loc) · 1.1 KB
/
install.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
38
39
40
41
42
43
44
#!/bin/sh
# Installs FWSYNC release.
VERSION="v0.0.1-8"
OS=$(uname -s | tr -d '\n')
ARCH=$(uname -m | tr -d '\n')
RELEASE=https://github.com/jharshman/fwsync/releases/download/${VERSION}/fwsync_${OS}_${ARCH}.tar.gz
# delete any existing archives otherwise noop
rm -f fwsync_${OS}_${ARCH}.tar.gz* || :
which wget > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo "FATAL missing wget"
exit 1
fi
# install
mkdir -p $HOME/.local/bin
wget -q $RELEASE
tar -C $HOME/.local/bin/ --exclude README.md -zxvf fwsync_${OS}_${ARCH}.tar.gz
chmod +x $HOME/.local/bin/fwsync
rcfile="$HOME/.zshrc"
if [[ $SHELL == "/bin/bash" ]]; then
rcfile="$HOME/.bashrc"
fi
# update PATH if required.
if ! grep -q '# ADDED BY FWSYNC' $rcfile; then
echo ""
echo "export PATH=\$HOME/.local/bin:\$PATH # ADDED BY FWSYNC" >> $rcfile
fi
cat <<EOM
********************************************************
* FWSYNC has been installed at $HOME/.local/bin/fwsync
*
* Your PATH has been updated in $rcfile
* Restart your Terminal for the changes to take effect.
********************************************************
EOM
rm -f fwsync_${OS}_${ARCH}.tar.gz