On Monday 01 June 2009 14:03:47 Joseph Rawson wrote: > Hi! -snip- > > I don't know if it will help or not, but I took the liberty of modifying > the script-update script in the tools/ directory to use the new svn > repository. Feel free to modify it according to your tastes. Errors aren't > handled very well yet, and I don't know how you would want to tread errors > in the script, so I refrained from attempting to handle them. I used svn > export on the assumption that the scripts directory may not be a working > copy, although it should work fine, even if it is.
I found a couple of problems with the original patch, the new patch that I'm attaching should fix them. The new patch will also only download a new script if svn info returns a different checksum than the local file, so it will only download the scripts that are actually different in the repository. I have just finished upgrading to 4.8, and I'm in the process of using it to install a machine. I haven't yet changed the config.pl to use the postgresql database. -- Thanks: Joseph Rawson
Index: install/tools/script-update =================================================================== --- install/tools/script-update (revision 2986) +++ install/tools/script-update (working copy) @@ -2,23 +2,19 @@ # # This script updates your script files from the official -# unattended cvs repository. +# unattended subversion repository. # # This scripts crawles through your script directory, and -# tries to update every found file from the cvs. You can +# tries to update every found file from the repository. You can # define exceptions in this script. # -# Warning #1: this scripts overwrites YOUR changes to official -# script files without any warning! Please double-check that -# none of your own-written scripts accidentially have the same -# name than any of the official scripts. -# -# Warning #2: it does not add scripts in the cvs that are +# Warning #1: it does not add scripts in the repository that are # not found in your script directory. You have to download -# new scripts once manually. +# new scripts once manually. (This can probably be done +# automatically with "svn ls $SVNURL") # -# Warning #3: you might want to call it as cron job, but -# please be not surprised by broken scripts in the cvs. +# Warning #2: you might want to call it as cron job, but +# please be not surprised by broken scripts in the repository. # This happens from time to time. # @@ -26,27 +22,67 @@ #exceptions=( "win2ksp4-updates.bat" "win2ksp4-symbols.bat" ) exceptions=( ) -# HTTP-Link to the cvs-repository -CVSLINK="http://unattended.cvs.sourceforge.net/unattended/unattended/install/scripts" +get_checksum () { + # retrieve Checksum field from svn info (md5) + svn info $1 | $GREP ^Checksum | $AWK '{print $2}' +} +get_local_md5sum () { + # perform md5sum on file and return just the hash + $MD5SUM $1 | $AWK '{print $1}' +} + + +check_file () { + # perform md5sum on file and compare to svn info + if [ `get_checksum $1` = `get_local_md5sum $2` ] ; then + return 0 + else + return 1 + fi +} + +export_script () { + if ! check_file $1 $1 ; then + $SVN export $SVNEXPORTOPTS $SVNURL/$1 $1.tmp + else + echo "$1 is already up to date." + return 0 + fi + if check_file $1 $1.tmp ; then + echo "$1 downloaded successfully" + else + echo "$1.tmp is incorrect, removing" + rm -f $1.tmp + fi + if ! [ -e $1.orig ]; then + $MV $1 $1.orig + else + echo "$1.orig already exists, not replacing" + fi + $MV $1.tmp $1 +} + +# scripts directory in svn trunk +SVNURL="https://unattended.svn.sourceforge.net/svnroot/unattended/trunk/install/scripts" +SVNEXPORTOPTS="-q" + # paths to needed programs WGET=$(which wget) FIND=$(which find) GREP=$(which grep) SORT=$(which sort) +MD5SUM=$(which md5sum) +SVN=$(which svn) +AWK=$(which awk) +MV=$(which mv) # Change to the scripts directory so paths are correct cd "$(dirname "$0")"/../scripts - -# crawl through the script-dir -for file in $($FIND . -type f | $GREP -v CVS | $SORT) + +for filename in $($FIND . -type f | $GREP -v \\.svn | grep -v \\.orig$ | grep -v \\.tmp$ | grep -v ~$ | $SORT) do - if [[ "${exceptio...@]%%${file##./}}" != "${exceptio...@]}" ]]; then continue; fi - if $WGET --output-document "$file.$$.tmp" $CVSLINK/$file?revision=HEAD - then - mv "$file.$$.tmp" "$file" - else - rm -f "$file.$$.tmp" - fi + if [[ "${exceptio...@]%%${file##./}}" != "${exceptio...@]}" ]]; then continue; fi + export_script $filename done
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________ unattended-devel mailing list unattended-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/unattended-devel