-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·51 lines (44 loc) · 1.46 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
#!/bin/bash
#-----------------------------------------------------------------------
# Copyright (c) 2019, Andrew Turpin
# License MIT: https://opensource.org/licenses/MIT
#-----------------------------------------------------------------------
# Installs checkcert.sh to /usr/bin and sets up crontab to check and notify
# a sysadmin if there are certificates about to expire or which have expired.
# This installs the rest of the solution to /var/lib/checkcert and
# the config to /etc/checkcert.conf
function ckcert_install {
echo "Install dependencies ..."
sudo apt install msmtp
sudo cp ./checkcert.sh /usr/bin/checkcert
sudo chmod +x /usr/bin/checkcert
sudo mkdir -p /var/lib/checkcert
sudo cp -r ./* /var/lib/checkcert/.
echo "Installation complete. See /var/lib/checkcert/README.md for instructions."
echo "Run 'checkcert --help' for help"
echo ""
}
function ckcert_uninstall {
echo "Removing checkcert installation..."
sudo rm /usr/bin/checkcert
sudo rm -r /var/lib/checkcert
echo ""
}
# Main
if [ "$1" == "" ]; then
ckcert_install
exit 0;
else
if [ "$1" == "--uninstall" ]; then
ckcert_uninstall
exit 0;
fi
fi
echo "Usage: ./install.sh [OPTION]..."
echo " Installs or uninstalls checkcert from your system."
echo " "
echo " OPTIONS:"
echo " [none] performs normal installation"
echo " --uninstall will completely uninstall the application"
echo ""
exit 1