forked from huangy10/quick-ca-signer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·57 lines (47 loc) · 1.06 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
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Installer
if [ ! "$(whoami)" == "root" ]; then
echo "Run this script as root"
exit
fi
INSTALL_FROM_LOCAL=
while [ $# -gt 0 ]
do
key="$1"
case $key in
-l|--local)
INSTALL_FROM_LOCAL=true
shift
;;
--uninstall)
if [ -L "/bin/woodyssl" ]; then
rm /bin/woodyssl
fi
if [ -d /var/woodyssl ]; then
rm -rf /var/woodyssl
fi
exit
;;
*)
;;
esac
done
command -v openssl > /dev/null || { echo "openssl is not installed. Install it with 'sudo apt-get install openssl' first"; exit; }
command -v git > /dev/null || { echo "wget is not installed. Install it with sudo 'apt-get install git' first"; exit; }
if [ -d /var/woodyssl ]; then
rm -rf /var/woodyssl
fi
mkdir /var/woodyssl
if [ -z "${INSTALL_FROM_LOCAL}" ]; then
git clone https://github.com/huangy10/quick-ca-signer -s /var/woodyssl
else
if [ -f "./woodyssl" ] && [ -d "./templates" ]; then
cp -r ./* /var/woodyssl
fi
fi
cd /var/woodyssl
rm -rf ./README.md ./.git ./.gitignore
if [ -L "/bin/woodyssl" ]; then
rm /bin/woodyssl
fi
ln -s /var/woodyssl/woodyssl /bin/woodyssl