forked from PasteUs/PasteMeFrontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.sh
30 lines (29 loc) · 1017 Bytes
/
installer.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
#!/usr/bin/env bash
if [[ ${#} != 1 ]]; then
echo "Usage: ${0} <install|uninstall|upgrade>"
else
set -x
if [[ ${1} == "install" ]]; then
/usr/bin/env bash "${0}" uninstall && \
git clone --depth=1 https://github.com/LucienShui/PasteMeFrontend.git -b build /usr/local/pasteme && \
cd /usr/local/pasteme && \
mkdir -p /etc/pasteme && \
if ! ln -s "${PWD}"/usr "${PWD}"/conf.d /etc/pasteme
then
echo -e "\033[31mInstallation failed\033[0m"
else
echo -e "\033[32mInstallation finished\033[0m"
echo "Config file: /etc/pasteme/config.json"
echo "Nginx config file: /etc/pasteme/conf.d/nginx.conf"
fi
elif [[ ${1} == "uninstall" ]]; then
rm -rf /usr/local/pasteme
rm -rf /etc/pasteme
echo "uninstall finished"
elif [[ ${1} == "upgrade" ]]; then
cd /usr/local/pasteme && \
git pull
else
echo "[ERROR] unsupported operation: ${1}"
fi
fi