-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·45 lines (37 loc) · 1.18 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
#!/bin/bash
install_script_path=`echo -e "$0" | rev | cut -d/ -f2- | rev;`;
le_script_name="check-letsencrypt-certs";
destination="/etc/letsencrypt/scripts";
link="false";
if ! [[ -z "$1" ]]; then
if [[ "$1" == "--link" ]]; then
link="true";
fi
fi
sudo="";
if ! [[ "$USER" == "root" ]]; then
sudo="sudo ";
fi
echo ""
echo -e "Installing \e[38;5;33mBlueKnight\e[0m's $le_script_name script";
if ! [[ -d "$destination" ]]; then
${sudo}mkdir --parents --verbose "$destination"
if ! [[ -d "$destination" ]]; then
echo -e "\e[38;5;160mError 1\e[0m: Failed to make $destination";
exit 1;
fi
fi
if ! [[ -f "${install_script_path}/${le_script_name}.sh" ]]; then
echo -e "\e[38;5;160mError 2\e[0m: can not locate script in the installer's directory.";
exit 2;
fi
if [[ "$link" == "true" ]]; then
echo "Linking ${destination}/${le_script_name}.sh to local file.";
${sudo}ln --symbolic --verbose "${PWD}/${le_script_name}.sh" "${destination}/${le_script_name}.sh";
else
echo "Copying script to ${destination}";
${sudo}cp --update --verbose "${install_script_path}/${le_script_name}.sh" "${destination}";
fi
echo -e "-- \e[38;5;40mInstall Complete\e[0m --";
echo "";
exit 0;