-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathinstall.sh
executable file
·59 lines (49 loc) · 1.5 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
58
59
#!/bin/bash
# Install files and scripts for [email protected]
PRE_SCRIPT_FILE="wwan_preup.sh"
POST_SCRIPT_FILE="wwan_postdown.sh"
SCRIPT_PATH="/etc/simcom_wwan"
SERVICE_PATH="/lib/systemd/system"
SERVICE_FILE="[email protected]"
IFACE="wwan0"
SERVICE="simcom_wwan@$IFACE.service"
if [ "$EUID" -ne 0 ]
then echo "[!] Please run as root"
exit 1
fi
if [[ -d "$SCRIPT_PATH" ]]; then
echo "[-] $SCRIPT_PATH already exists"
else
echo "[+] Creating directory $SCRIPT_PATH"
mkdir "$SCRIPT_PATH"
fi
echo "[+] Copying $PRE_SCRIPT_FILE to $SCRIPT_PATH"
if (cp "./$PRE_SCRIPT_FILE" "$SCRIPT_PATH"); then
echo "[+] Successfully copied $PRE_SCRIPT_FILE to $SCRIPT_PATH"
else
echo "[!] Failed to copy $PRE_SCRIPT_FILE to $SCRIPT_PATH"
exit 1
fi
echo "[+] Copying $POST_SCRIPT_FILE to $SCRIPT_PATH"
if (cp "./$POST_SCRIPT_FILE" "$SCRIPT_PATH"); then
echo "[+] Successfully copied $POST_SCRIPT_FILE to $SCRIPT_PATH"
else
echo "[!] Failed to copy $POST_SCRIPT_FILE to $SCRIPT_PATH"
exit 1
fi
echo "[+] Copying $SERVICE_FILE to $SERVICE_PATH"
if (cp "./$SERVICE_FILE" "$SERVICE_PATH"); then
echo "[+] Successfully copied $SERVICE_FILE to $SERVICE_PATH"
else
echo "[!] Failed to copy $SERVICE_FILE to $SERVICE_PATH"
exit 1
fi
echo "[+] Reloading systemd manager configuration"
if (systemctl daemon-reload); then
echo "[+] Successfully installed $SERVICE_FILE!"
echo "[+] To start, run: $ sudo systemctl start simcom_wwan@$IFACE.service"
else
echo "[!] Reloading systemd manager configuration failed"
exit 1
fi
exit 0