mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-31 11:56:11 +03:00
refactor: update install script generation to use current version tag
This commit is contained in:
105
.github/workflows/build.yml
vendored
105
.github/workflows/build.yml
vendored
@@ -38,106 +38,15 @@ jobs:
|
|||||||
- name: Generate install script
|
- name: Generate install script
|
||||||
run: |
|
run: |
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
cat > "./filtered-bin/install.sh" << 'EOFMARKER'
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
REPO="https://api.github.com/repos/itdoginfo/podkop/releases/tags/v$VERSION"
|
# Replace REPO line with the current version
|
||||||
|
sed -i "s|REPO=\"https://api.github.com/repos/itdoginfo/podkop/releases/latest\"|REPO=\"https://api.github.com/repos/itdoginfo/podkop/releases/tags/v${VERSION}\"|" "install.sh"
|
||||||
|
|
||||||
DOWNLOAD_DIR="/tmp/podkop"
|
# Add and commit the modified install script
|
||||||
COUNT=3
|
git config --local user.email "action@github.com"
|
||||||
|
git config --local user.name "GitHub Action"
|
||||||
rm -rf "$DOWNLOAD_DIR"
|
git commit -m "Change install script for version ${VERSION}"
|
||||||
mkdir -p "$DOWNLOAD_DIR"
|
git push origin "refs/tags/v${VERSION}"
|
||||||
|
|
||||||
main() {
|
|
||||||
check_system
|
|
||||||
|
|
||||||
opkg update
|
|
||||||
|
|
||||||
if [ -f "/etc/init.d/podkop" ]; then
|
|
||||||
echo "Remove current vesrion podkop"
|
|
||||||
opkg remove luci-i18n-podkop-ru luci-app-podkop podkop
|
|
||||||
rm /etc/config/podkop
|
|
||||||
else
|
|
||||||
echo "Installed podkop..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk' | while read -r url; do
|
|
||||||
filename=$(basename "$url")
|
|
||||||
filepath="$DOWNLOAD_DIR/$filename"
|
|
||||||
|
|
||||||
attempt=0
|
|
||||||
while [ $attempt -lt $COUNT ]; do
|
|
||||||
if [ -f "$filepath" ] && [ -s "$filepath" ]; then
|
|
||||||
echo "$filename has already been uploaded"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Download $filename (count $((attempt+1)))..."
|
|
||||||
wget -q -O "$filepath" "$url"
|
|
||||||
|
|
||||||
if [ -s "$filepath" ]; then
|
|
||||||
echo "$filename successfully downloaded"
|
|
||||||
else
|
|
||||||
echo "Download error $filename. Retry..."
|
|
||||||
rm -f "$filepath"
|
|
||||||
fi
|
|
||||||
attempt=$((attempt+1))
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
for pkg in podkop luci-app-podkop; do
|
|
||||||
file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1)
|
|
||||||
if [ -n "$file" ]; then
|
|
||||||
echo "Installing $file"
|
|
||||||
opkg install "$DOWNLOAD_DIR/$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
ru=$(ls "$DOWNLOAD_DIR" | grep "luci-i18n-podkop-ru" | head -n 1)
|
|
||||||
if [ -n "$ru" ]; then
|
|
||||||
printf "\033[32;1mРусский язык интерфейса ставим? y/n (Need a Russian translation?)\033[0m "
|
|
||||||
while true; do
|
|
||||||
read -r -p '' RUS
|
|
||||||
case $RUS in
|
|
||||||
y)
|
|
||||||
opkg install "$DOWNLOAD_DIR/$ru"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
n)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Введите y или n"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
|
|
||||||
}
|
|
||||||
|
|
||||||
check_system() {
|
|
||||||
# Get router model
|
|
||||||
MODEL=$(cat /tmp/sysinfo/model)
|
|
||||||
echo "Router model: $MODEL"
|
|
||||||
|
|
||||||
if ! nslookup google.com >/dev/null 2>&1; then
|
|
||||||
log "DNS not working"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if opkg list-installed | grep -qE "iptables|kmod-iptab"; then
|
|
||||||
printf "\033[31;1mFound incompatible iptables packages. If you're using FriendlyWrt: https://t.me/itdogchat/44512/181082\033[0m\n"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
EOFMARKER
|
|
||||||
# Make the script executable
|
|
||||||
chmod +x "./filtered-bin/install-v${VERSION}.sh"
|
|
||||||
# Replace the VERSION placeholder with actual version
|
|
||||||
sed -i "s/\$VERSION/${VERSION}/g" "./filtered-bin/install-v${VERSION}.sh"
|
|
||||||
|
|
||||||
- name: Remove Docker container
|
- name: Remove Docker container
|
||||||
run: docker rm podkop
|
run: docker rm podkop
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/podkop/refs/heads/mai
|
|||||||
sh <(wget -O - https://github.com/itdoginfo/podkop/releases/download/v0.3.**/install.sh)
|
sh <(wget -O - https://github.com/itdoginfo/podkop/releases/download/v0.3.**/install.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
Аналогично предыдущему скрипту, но нужно указать версии в ссылке.
|
Аналогично предыдущему скрипту, но нужно указать версию в ссылке.
|
||||||
|
|
||||||
## Вручную
|
## Вручную
|
||||||
Сделать `opkg update`, чтоб установились зависимости.
|
Сделать `opkg update`, чтоб установились зависимости.
|
||||||
|
|||||||
Reference in New Issue
Block a user