WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Check-Update Script  (Read 5568 times)

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Check-Update Script
« on: June 11, 2009, 03:44:00 AM »
This script downloads new md5.txt files and checks against apps in the tce-directory. Results are
written to /tmp/update-check   (for tinycore_2)

edit: correct test for /tmp/update-check
edit2: add cleanup

Code: [Select]
#!/bin/ash
#### by jpeters for tinycore-2 (current-version 5/11/09)  TESTING  ####

[ -f /tmp/update-check ] && sudo rm  /tmp/update-check

TCEDIR="$(cat /opt/.tce_dir)"
cd $TCEDIR

# Create {tce,tcz} md5.txt lists
TCE="$(ls | grep txt | grep tce | grep -v tcz)"
TCZ="$(ls | grep txt | grep tcz | grep -v tce)"

# Create work directory
[ -d /tmp/md5 ] ||  mkdir /tmp/md5
cd /tmp/md5

# Download md5.txt files from tcz directory
TCZFTP="ftp://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/tcz"

for I in $TCZ
do
sudo wget $TCZFTP/$I  
done

# Download md5.txt files from tce directory

TCEFTP="ftp://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/tce"

for I in $TCE
do
sudo wget $TCEFTP/$I  
done

# md5check: Results in /tmp/update-tce
cd $TCEDIR

for I in $TCE
do
  CK="$(md5sum -c /tmp/md5/$I)"
  echo $CK >>/tmp/update-check
done

# md5Check:  Results in /tmp/update-tcz
for I in $TCZ
do
  CK="$(md5sum -c /tmp/md5/$I)"
  echo $CK >>/tmp/update-check
done


echo "********************************************"
echo "MD5SUM FAILURES...(MISSING OR REQUIRE UPDATE)"
echo "********************************************"
echo "                                            "
cat /tmp/update-check | grep FAILED
 
## cleanup
sudo rm -R /tmp/md5 &>/dev/null

« Last Edit: June 13, 2009, 12:34:28 AM by jpeters »

Offline soundcheck

  • Newbie
  • *
  • Posts: 46
Re: Check-Update Script
« Reply #1 on: June 26, 2009, 02:06:36 AM »

Great stuff.

You should add an option to run the updates automatically.

THX

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: Check-Update Script
« Reply #2 on: June 26, 2009, 02:21:32 AM »
Easily done, but I think they'll be a version out in the next RC that does that.  It wouldn't work for me, though, because it would delete all my tweeked extensions.   :)