install.sh: add ghproxy support
Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
parent
37d32f521e
commit
9fee83a20d
@ -56,6 +56,11 @@
|
|||||||
sh -c "$(curl -ksS https://raw.githubusercontent.com/sbwml/luci-app-openlist/main/install.sh)"
|
sh -c "$(curl -ksS https://raw.githubusercontent.com/sbwml/luci-app-openlist/main/install.sh)"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# install via ghproxy
|
||||||
|
```shell
|
||||||
|
sh -c "$(curl -ksS https://raw.githubusercontent.com/sbwml/luci-app-openlist/main/install.sh)" _ gh_proxy="https://gh.cooluc.com"
|
||||||
|
```
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||

|

|
||||||
|
22
install.sh
22
install.sh
@ -9,6 +9,21 @@ RESET='\033[0m'
|
|||||||
msg_red() { printf "${RED}%s${RESET}\n" "$*"; }
|
msg_red() { printf "${RED}%s${RESET}\n" "$*"; }
|
||||||
msg_green() { printf "${GREEN}%s${RESET}\n" "$*"; }
|
msg_green() { printf "${GREEN}%s${RESET}\n" "$*"; }
|
||||||
|
|
||||||
|
# Parse gh_proxy from $1 if provided, e.g. gh_proxy="https://gh-proxy.com/"
|
||||||
|
gh_proxy=""
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
case "$1" in
|
||||||
|
gh_proxy=*)
|
||||||
|
gh_proxy="${1#gh_proxy=}"
|
||||||
|
# ensure gh_proxy ends with /
|
||||||
|
[ -n "$gh_proxy" ] && case "$gh_proxy" in
|
||||||
|
*/) : ;;
|
||||||
|
*) gh_proxy="$gh_proxy/" ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if running on OpenWrt
|
# Check if running on OpenWrt
|
||||||
if [ ! -f /etc/openwrt_release ]; then
|
if [ ! -f /etc/openwrt_release ]; then
|
||||||
msg_red "Unknown OpenWrt Version"
|
msg_red "Unknown OpenWrt Version"
|
||||||
@ -101,7 +116,12 @@ fi
|
|||||||
|
|
||||||
# Download the corresponding package archive
|
# Download the corresponding package archive
|
||||||
PKG_FILE="$SDK-$DISTRIB_ARCH.tar.gz"
|
PKG_FILE="$SDK-$DISTRIB_ARCH.tar.gz"
|
||||||
PKG_URL="https://github.com/sbwml/luci-app-openlist/releases/latest/download/$PKG_FILE"
|
BASE_URL="https://github.com/sbwml/luci-app-openlist/releases/latest/download/$PKG_FILE"
|
||||||
|
if [ -n "$gh_proxy" ]; then
|
||||||
|
PKG_URL="${gh_proxy}${BASE_URL}"
|
||||||
|
else
|
||||||
|
PKG_URL="$BASE_URL"
|
||||||
|
fi
|
||||||
|
|
||||||
msg_green "Downloading $PKG_URL ..."
|
msg_green "Downloading $PKG_URL ..."
|
||||||
if ! curl --connect-timeout 5 -m 300 -kLo "$TEMP_DIR/$PKG_FILE" "$PKG_URL"; then
|
if ! curl --connect-timeout 5 -m 300 -kLo "$TEMP_DIR/$PKG_FILE" "$PKG_URL"; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user