Skip to content

Commit 74067ad

Browse files
authored
Create install.sh
1 parent b5726e0 commit 74067ad

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

install.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
# Function to install a theme from a GitHub repository
4+
install_theme() {
5+
local REPO_NAME=$1
6+
local THEME_NAME=$2
7+
8+
echo "Processing $THEME_NAME..."
9+
10+
# GitHub repository URL and package name
11+
LATEST_RELEASE_URL="https://api.github.com/repos/peditx/$REPO_NAME/releases/latest"
12+
IPK_URL=$(curl -s "$LATEST_RELEASE_URL" | grep "browser_download_url.*ipk" | cut -d '"' -f 4)
13+
14+
# Check if the download link is found
15+
if [ -z "$IPK_URL" ]; then
16+
echo "Download link for the .ipk file of $THEME_NAME not found."
17+
return 1
18+
fi
19+
20+
# Download the .ipk package
21+
echo "Downloading the latest version of $THEME_NAME..."
22+
wget -q "$IPK_URL" -O "/tmp/$THEME_NAME.ipk"
23+
24+
# Install the .ipk package
25+
echo "Installing $THEME_NAME..."
26+
opkg install "/tmp/$THEME_NAME.ipk"
27+
28+
# Clean up the downloaded file
29+
rm "/tmp/$THEME_NAME.ipk"
30+
31+
echo "$THEME_NAME installed successfully."
32+
}
33+
34+
# Install luci-theme-peditx
35+
install_theme "luci-theme-peditx" "luci-theme-peditx"
36+
37+
# Remove the default theme
38+
opkg remove luci-theme-bootstrap --force-depends
39+
40+
# Restart the web service to apply the changes
41+
echo "Restarting uhttpd service to apply changes..."
42+
/etc/init.d/uhttpd restart
43+
44+
echo "Done."

0 commit comments

Comments
 (0)