-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·75 lines (75 loc) · 2.37 KB
/
install.sh
File metadata and controls
executable file
·75 lines (75 loc) · 2.37 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
set -e
if [ "$EUID" == "0" ]
then
echo "Running as root"
elif [[ "$(which sudo)" != "" ]]
then
echo "Running as sudo"
if [[ "$0" == "bash" ]]; then
exec curl -sSL https://raw.githubusercontent.com/gitdev-bash/piduck/master/install.sh | sudo bash "$@"
else
exec sudo bash "$0" "$@"
fi
exit $?
fi
#if [[ -d "/etc/piduck" ]]
#then
# echo "Seems like piduck is already installed!"
# exit 4
#else
if [[ "$(which git)" != "" ]]
then
echo "Using git!"
git clone https://github.com/gitdev-bash/piduck.git /tmp/piduck
elif [[ "$(which wget)" != "" && "$(which unzip)" != "" ]]
then
echo "Using wget and unzip"
wget -q -O /tmp/piduck.zip https://github.com/gitdev-bash/piduck/zipball/master/
unzip /tmp/piduck.zip /tmp/
rm /tmp/piduck.zip
mkdir /tmp/piduck
mv /tmp/gitdev-bash-piduck-*/* /tmp/piduck/
rm -rf /tmp/gitdev-bash-piduck-*/
elif [[ "$(which curl)" != "" && "$(which unzip)" != "" ]]
then
echo "Using curl and unzip"
curl -sSL -o /tmp/piduck.zip https://github.com/gitdev-bash/piduck/zipball/master/
unzip /tmp/piduck.zip /tmp/
rm /tmp/piduck.zip
mkdir /tmp/piduck
mv /tmp/gitdev-bash-piduck-*/* /tmp/piduck/
rm -rf /tmp/gitdev-bash-piduck-*/
elif [[ "$(which wget)" != "" && "$(which gunzip)" != "" ]]
then
echo "Using wget and gunzip"
wget -q -O /tmp/piduck.tar.gz https://github.com/gitdev-bash/piduck/tarball/master/
tar -xzvf /tmp/piduck.tar.gz
rm /tmp/piduck.tar.gz
mkdir /tmp/piduck
mv /tmp/gitdev-bash-piduck-*/* /tmp/piduck/
rm -rf /tmp/gitdev-bash-piduck-*/
elif [[ "$(which curl)" != "" && "$(which gunzip)" != "" ]]
then
echo "Using curl and gunzip"
curl -sSL -o /tmp/piduck.tar.gz https://github.com/gitdev-bash/piduck/tarball/master/
tar -xzvf /tmp/piduck.tar.gz
rm /tmp/piduck.tar.gz
mkdir /tmp/piduck
mv /tmp/gitdev-bash-piduck-*/* /tmp/piduck/
rm -rf /tmp/gitdev-bash-piduck-*/
else
echo "Ops missing dependencies"
exit 2
fi
mkdir /etc/piduck
mv /tmp/piduck/piduck.py /etc/piduck/piduck.py
mv /tmp/piduck/pd_key_maps /etc/piduck/pd_key_maps
mv /tmp/piduck/requirements.txt /etc/piduck/requirements.txt
chmod 555 /etc/piduck/piduck.py /etc/piduck/pd_key_maps/*
chmod 444 /etc/piduck/pd_key_maps/* /etc/piduck/requirements.txt
rm -rf /tmp/piduck
ln -s /etc/piduck/piduck.py /usr/bin/piduck
#fi
echo "DONE!"
exit 0