forked from biko-73/AjPanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.sh
81 lines (72 loc) · 3.1 KB
/
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
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
# ============================================================================================================
# SCRIPT : DOWNLOAD AND INSTALL AJPANEL
# Command: wget https://raw.githubusercontent.com/biko-73/AjPanel/main/installer.sh -O - | /bin/sh
# ============================================================================================================
# Server Parameters
AJP_URL="https://raw.githubusercontent.com/biko-73/AjPanel/main/" # Custom URL
VER_FILE_NAME='version' # Version File Name on Server
# Header
SEP="********************************************************************"
echo -e "\n$SEP"
echo "** **"
echo "** AJPanel Installation **"
echo "** **"
echo "** Uploaded by: Biko_73 **"
echo "** Support: https://www.tunisia-sat.com/forums/threads/4165512/ **"
echo "** **"
echo -e "$SEP\n"
# Check Version
# Download "version" file to /tmp/version
echo 'Checking Server Version ...'
AJP_VER_TMP="/tmp/"$VER_FILE_NAME
rm -f $AJP_VER_TMP > /dev/null 2>&1
wget --no-check-certificate -q -T 2 -O "/tmp/"$VER_FILE_NAME $AJP_URL$VER_FILE_NAME
# Download/Install
RES=1
if [ -f $AJP_VER_TMP ]; then
# Get version from "/tmp/version" file
AJP_VERSION=$(cat $AJP_VER_TMP | grep version);
AJP_VERSION=$(cut -d "=" -f2- <<< "$AJP_VERSION");
rm -f $AJP_VER_TMP > /dev/null 2>&1 # Del "/tmp/version"
# Check Version
if [ -z "$AJP_VERSION" ]; then
echo -e '.... Installation failed ! Cannot read version ....\n'
else
AJP_VERSION="v"$AJP_VERSION
echo -e '... Found AJPanel '$AJP_VERSION'\n'
# Package File Name
if which dpkg > /dev/null 2>&1; then EXT="deb"; else EXT="ipk"; fi
AJP_FILE="enigma2-plugin-extensions-ajpanel_"$AJP_VERSION"_all."$EXT # E.g. : enigma2-plugin-extensions-ajpanel_v5.3.0_all.ipk
# Download ipk file
echo "Downloading AJPanel $AJP_VERSION ($AJP_FILE) ..."
AJP_PKG_FILE="/tmp/"$AJP_FILE
wget --no-check-certificate -q -T 2 -O $AJP_PKG_FILE $AJP_URL$AJP_FILE
# Install
if [ -f $AJP_PKG_FILE ]; then
echo -e ".... Download success.\n\nStarting installation ..."
if which dpkg > /dev/null 2>&1; then
dpkg -i --force-overwrite $AJP_PKG_FILE
RES=$?
else
opkg install --force-overwrite $AJP_PKG_FILE # "--force-reinstall" was not OK on OpenBH v5 (Python-3)
if ! [ $? -eq 0 ]; then echo -e ".... Method-1 failed ....\n"; opkg install --force-reinstall $AJP_PKG_FILE; fi
RES=$?
if ! [ $RES -eq 0 ]; then echo -e ".... Method-2 failed ....\n"; fi
fi
rm -f $AJP_PKG_FILE > /dev/null 2>&1 # Remove Installation file
else
echo -e ".... Cannot download "$AJP_FILE"\n"
fi
fi
else
echo ".... Cannot get version file from server !"
fi
# Footer
if [ $RES -eq 0 ]; then
echo -e "\n$SEP\n** SUCCESSFUL **\n$SEP\n"
exit 0
else
echo -e "\n$SEP\n** INSTALLATION FAILED **\n$SEP\n"
exit 1
fi