I wrote a script to pull the latest slint version and check the slint iso
for integrity.  I've verified the script works too.
For this script to work it needs a bsd tag file with slint's valid sha1sum
value in it so integrity checking is possible and that needs to be on the
hard drive first.
I'm sharing this script for two reasons.
First, I solved some problems I didn't think were going to be possible to
solve.
Second, changing the slint iso download item in the script and the name of
the sha1sum file so it matches another on a hard drive the script can be
used to download other files from sourceforge.net and check their
integrity too.
If a bad download happens, the script deletes the bad iso and continues to
try to download a good iso and you get information when the download
starts and when it ends.  There is also a fail count which is always
printed out if any download fails integrity check, you find out how many
times that happened.



--
cut here.
#!/usr/bin/env bash
# file: getslint.sh - download latest slint iso.
# set fail count.
FC=0
    # remove old wget-log file if present.
if [ -f wget-log ];
then
rm wget-log
fi
# set integrity check variable to error value of 1.
IC=1
# enter integrity check loop.
until [ $IC -lt 1 ]; do
# show starting time stamp.
echo "starting download at:"
date -R
    # download latest slint iso.
    wget -bc --tries=inf --max-redirect=10000 --trust-server-names 
https://sourceforge.net/projects/slint/files/latest/download
    # set DL variable to error value 1.
    DL=1
    until [ $DL -lt 1 ]; do
        # allow some time for download.
        sleep 15
        # search file wget-log for saved string.
        grep "saved" wget-log
        # check grep return value for zero value meaning saved line was found.
        if [ $? -lt 1 ]; then
            # clear error value from DL switch.
            let DL-=1
fi
    done
    # do integrity check.
    sha256sum -c slint64-14.2.1.1.sha256sum
    # if return of sha1sum is zero, remove error value from integrity check 
switch.
    if [ $? -lt 1 ]; then
        let IC-=1
        echo -n "fail count: "
        echo $FC
    else
        let FC+=1
        rm slint*.iso
        rm wget-log
                fi
done

cut here.

_______________________________________________
Blinux-list mailing list
Blinux-list@redhat.com
https://www.redhat.com/mailman/listinfo/blinux-list

Reply via email to