Hi
i have written the following shell script it will download the latest nightly build from the mirror url
When i run from the terminal it is showing download progress but when executed from .config/autostart.sh it only show the printf statement context in startup screen but will it be possible to see the progress in the startup screen Please help with this
script---->.config/autostart.sh
Bash
#!/bin/bash
# Function to check internet connectivity
check_internet() {
if ping -q -c 1 -W 1 google.com > /dev/null; then
return 0 # Internet is reachable
else
return 1 # Internet is not reachable
fi
}
# Check internet connectivity
if check_internet; then
printf "Internet is available.\n"
else
printf "Internet is not available. Exiting without download.\n"
exit 1
fi
# URL of the page containing the list of .img.gz files
URL="https://test.libreelec.tv/13.0/RPi/RPi4/"
# Get the webpage content and extract .img.gz file links
CURRENT_VERSION=$(cat /etc/os-release | grep VERSION= | awk -F '"' '{print $2}')
LATEST_FILE=$(curl -s "$URL" | grep -o 'href="[^"]*\.img\.gz' | sed 's/href="//' | sort -r | head -n 1)
LATEST_VERSION=$(curl -s "$URL" | grep -o 'href="[^"]*\.img\.gz' | sed 's/href="//' | sort -r | head -n 1 | cut -d'-' -f4-6 | sed 's/.img.gz//')
# Check if a file link was found
if [ "$CURRENT_VERSION" == "$LATEST_VERSION" ]; then
printf "Your system is up to date ....\n"
else
# Download the latest file with progress bar
curl -# -o /storage/.update/"$LATEST_FILE" "$URL$LATEST_FILE"
#watch "wget /storage/.update "$URL$LATEST_FILE""
# Check if the download was successful
if [ $? -eq 0 ]; then
printf "unziping the tar file....\n\e[1m"
gzip -d /storage/.update/*
printf "Download successful. Restarting LibreELEC...\n"
reboot
else
printf "Download failed. Please check the URL or your network connection.\n"
fi
fi
Display More