mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-08 12:36:50 +03:00
fix(install): correct continue logic for existing package files
This commit is contained in:
23
install.sh
23
install.sh
@@ -43,30 +43,41 @@ main() {
|
|||||||
add_tunnel
|
add_tunnel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk' | while read -r url; do
|
download_success=0
|
||||||
|
while read -r url; do
|
||||||
filename=$(basename "$url")
|
filename=$(basename "$url")
|
||||||
filepath="$DOWNLOAD_DIR/$filename"
|
filepath="$DOWNLOAD_DIR/$filename"
|
||||||
|
|
||||||
if [ -f "$filepath" ] && [ -s "$filepath" ]; then
|
if [ -f "$filepath" ] && [ -s "$filepath" ]; then
|
||||||
echo "$filename has already been uploaded"
|
echo "$filename has already been uploaded"
|
||||||
|
download_success=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
attempt=0
|
attempt=0
|
||||||
while [ $attempt -lt $COUNT ]; do
|
while [ $attempt -lt $COUNT ]; do
|
||||||
echo "Download $filename (count $((attempt+1)))..."
|
echo "Download $filename (count $((attempt+1)))..."
|
||||||
wget -q -O "$filepath" "$url"
|
if wget -q -O "$filepath" "$url"; then
|
||||||
|
|
||||||
if [ -s "$filepath" ]; then
|
if [ -s "$filepath" ]; then
|
||||||
echo "$filename successfully downloaded"
|
echo "$filename successfully downloaded"
|
||||||
|
download_success=1
|
||||||
break
|
break
|
||||||
else
|
fi
|
||||||
|
fi
|
||||||
echo "Download error $filename. Retry..."
|
echo "Download error $filename. Retry..."
|
||||||
rm -f "$filepath"
|
rm -f "$filepath"
|
||||||
attempt=$((attempt+1))
|
attempt=$((attempt+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $attempt -eq $COUNT ]; then
|
||||||
|
echo "Failed to download $filename after $COUNT attempts"
|
||||||
|
fi
|
||||||
|
done < <(wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk')
|
||||||
|
|
||||||
|
if [ $download_success -eq 0 ]; then
|
||||||
|
echo "No packages were downloaded successfully"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
for pkg in podkop luci-app-podkop; do
|
for pkg in podkop luci-app-podkop; do
|
||||||
file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1)
|
file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user