Repository navigation
Expand file tree
/
Copy pathinstaller.sh
More file actions
182 lines (158 loc) · 6.12 KB
/
Copy pathinstaller.sh
File metadata and controls
182 lines (158 loc) · 6.12 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/bash
version='3.0.6'
changelog="\n--Security: removed --no-check-certificate from every wget install/update call\n--Hardened lsConsole and checkskin temp files against local symlink attacks\n--Fixed LCN scan (Order LCN Bouquet) always logging a false error\n--Fixed possible crash reading lcndb/service data with an unexpected mode\n--Fixed commits cache never actually loading (str repr vs JSON mismatch)\n--Fixed crash risk in RTL/Arabic font loading (add_skin_fonts)\n--Removed unused translate_utils.py and duplicate code\n--Updated README.md to v3.0.6"
TMPPATH=/tmp/LinuxsatPanel-install
FILEPATH=/tmp/LinuxsatPanel-main.tar.gz
echo "Starting LinuxsatPanel installation..."
if [ ! -d /usr/lib64 ]; then
PLUGINPATH=/usr/lib/enigma2/python/Plugins/Extensions/LinuxsatPanel
else
PLUGINPATH=/usr/lib64/enigma2/python/Plugins/Extensions/LinuxsatPanel
fi
cleanup() {
echo "Cleaning up temporary files..."
[ -d "$TMPPATH" ] && rm -rf "$TMPPATH"
[ -f "$FILEPATH" ] && rm -f "$FILEPATH"
[ -d "/tmp/LinuxsatPanel-main" ] && rm -rf "/tmp/LinuxsatPanel-main"
}
detect_os() {
if [ -f /var/lib/dpkg/status ]; then
OSTYPE="DreamOs"
STATUS="/var/lib/dpkg/status"
elif [ -f /etc/opkg/opkg.conf ] || [ -f /var/lib/opkg/status ]; then
OSTYPE="OE"
STATUS="/var/lib/opkg/status"
else
OSTYPE="Unknown"
STATUS=""
fi
echo "Detected OS type: $OSTYPE"
}
detect_os
cleanup
mkdir -p "$TMPPATH"
if ! command -v wget >/dev/null 2>&1; then
echo "Installing wget..."
case "$OSTYPE" in
"DreamOs")
apt-get update && apt-get install -y wget || { echo "Failed to install wget"; exit 1; }
;;
"OE")
opkg update && opkg install wget || { echo "Failed to install wget"; exit 1; }
;;
*)
echo "Unsupported OS type. Cannot install wget."
exit 1
;;
esac
fi
if python --version 2>&1 | grep -q '^Python 3\.'; then
echo "Python3 image detected"
Packagerequests="python3-requests"
else
echo "Python2 image detected"
Packagerequests="python-requests"
fi
install_pkg() {
local pkg=$1
if [ -z "$STATUS" ] || ! grep -qs "Package: $pkg" "$STATUS" 2>/dev/null; then
echo "Installing $pkg..."
case "$OSTYPE" in
"DreamOs")
apt-get update && apt-get install -y "$pkg" || { echo "Could not install $pkg, continuing anyway..."; }
;;
"OE")
opkg update && opkg install "$pkg" || { echo "Could not install $pkg, continuing anyway..."; }
;;
*)
echo "Cannot install $pkg on unknown OS type, continuing..."
;;
esac
else
echo "$pkg already installed"
fi
}
install_pkg "$Packagerequests"
echo "Downloading LinuxsatPanel..."
wget 'https://github.com/Belfagor2005/LinuxsatPanel/archive/refs/heads/main.tar.gz' -O "$FILEPATH"
if [ $? -ne 0 ]; then
echo "Failed to download LinuxsatPanel package!"
cleanup
exit 1
fi
echo "Extracting package..."
tar -xzf "$FILEPATH" -C "$TMPPATH"
if [ $? -ne 0 ]; then
echo "Failed to extract LinuxsatPanel package!"
cleanup
exit 1
fi
echo "Installing plugin files..."
mkdir -p "$PLUGINPATH"
if [ -d "$TMPPATH/LinuxsatPanel-main/usr/lib/enigma2/python/Plugins/Extensions/LinuxsatPanel" ]; then
cp -r "$TMPPATH/LinuxsatPanel-main/usr/lib/enigma2/python/Plugins/Extensions/LinuxsatPanel"/* "$PLUGINPATH/" 2>/dev/null
echo "Copied from standard plugin directory"
elif [ -d "$TMPPATH/LinuxsatPanel-main/usr/lib64/enigma2/python/Plugins/Extensions/LinuxsatPanel" ]; then
cp -r "$TMPPATH/LinuxsatPanel-main/usr/lib64/enigma2/python/Plugins/Extensions/LinuxsatPanel"/* "$PLUGINPATH/" 2>/dev/null
echo "Copied from lib64 plugin directory"
elif [ -d "$TMPPATH/LinuxsatPanel-main/usr" ]; then
cp -r "$TMPPATH/LinuxsatPanel-main/usr"/* /usr/ 2>/dev/null
echo "Copied entire usr structure"
else
echo "Could not find plugin files in extracted archive"
echo "Available directories in tmp:"
find "$TMPPATH" -type d | head -10
cleanup
exit 1
fi
sync
echo "Verifying installation..."
if [ -d "$PLUGINPATH" ] && [ -n "$(ls -A "$PLUGINPATH" 2>/dev/null)" ]; then
echo "Plugin directory found and not empty: $PLUGINPATH"
echo "Contents:"
ls -la "$PLUGINPATH/" | head -10
else
echo "Plugin installation failed or directory is empty!"
cleanup
exit 1
fi
cleanup
sync
FILE="/etc/image-version"
box_type=$(sed -n '1p' /etc/hostname 2>/dev/null || echo "Unknown")
# distro_value=$(grep '^distro=' "$FILE" 2>/dev/null | awk -F '=' '{print $2}')
# distro_version=$(grep '^version=' "$FILE" 2>/dev/null | awk -F '=' '{print $2}')
distro_value="Unknown"
distro_version="Unknown"
if [ -r /etc/os-release ]; then
distro_value=$(grep '^NAME=' /etc/os-release 2>/dev/null | cut -d'"' -f2)
distro_version=$(grep '^VERSION_ID=' /etc/os-release 2>/dev/null | cut -d'"' -f2)
elif [ -r /etc/issue ]; then
distro_value=$(head -n 1 /etc/issue 2>/dev/null | awk '{print $1}')
distro_version=$(head -n 1 /etc/issue 2>/dev/null | awk '{print $2}')
elif [ -r /etc/vtiversion.info ]; then
distro_value=$(head -n 1 /etc/vtiversion.info 2>/dev/null)
elif [ -r /etc/issue.net ]; then
distro_value=$(head -n 1 /etc/issue.net 2>/dev/null | awk '{print $1}')
distro_version=$(head -n 1 /etc/issue.net 2>/dev/null | awk '{print $2}')
fi
[ -z "$distro_value" ] && distro_value="Unknown"
[ -z "$distro_version" ] && distro_version="Unknown"
python_vers=$(python --version 2>&1)
cat <<EOF
#########################################################
# LinuxsatPanel $version INSTALLED SUCCESSFULLY #
# developed by LULULLA #
# https://corvoboys.org #
#########################################################
# your Device will RESTART Now #
#########################################################
^^^^^^^^^^Debug information:
BOX MODEL: $box_type
OS SYSTEM: $OSTYPE
PYTHON: $python_vers
IMAGE NAME: ${distro_value:-Unknown}
IMAGE VERSION: ${distro_version:-Unknown}
PLUGIN VERSION: $version
EOF
exit 0