From: <sal...@li...> - 2011-10-19 08:52:50
|
Revision: 2766 http://salix.svn.sourceforge.net/salix/?rev=2766&view=rev Author: jrdasm Date: 2011-10-19 08:52:43 +0000 (Wed, 19 Oct 2011) Log Message: ----------- New way of save the persistence RAM to the persistence FILE, with a check of size. lsof is not fixed to a specific version anymore. Modified Paths: -------------- salt/trunk/create-initrd.sh salt/trunk/initrd-template/cleanup Modified: salt/trunk/create-initrd.sh =================================================================== --- salt/trunk/create-initrd.sh 2011-10-18 15:51:36 UTC (rev 2765) +++ salt/trunk/create-initrd.sh 2011-10-19 08:52:43 UTC (rev 2766) @@ -18,8 +18,7 @@ FILEURL=ftp://ftp.astron.com/pub/file/file-$FILEVER.tar.gz NTFS3GVER=2011.4.12 NTFS3GURL=http://tuxera.com/opensource/ntfs-3g_ntfsprogs-$NTFS3GVER.tgz -LSOFVER=4.84 -LSOFURL=ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_$LSOFVER.tar.bz2 +LSOFURL=ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof.tar.bz2 KERNELDIR=$PWD/kernel KVER=$KERNELDIR/lib/modules/* @@ -102,22 +101,22 @@ cp -av ntfs-3g_ntfsprogs-$NTFS3GVER/pkg/sbin/mount.ntfs-3g $TREE/sbin/ # download, compile and install lsof (only if debug) if [ -n "$DEBUG" ]; then - if [ ! -e lsof_$LSOFVER.tar.bz2 ]; then + if [ ! -e lsof.tar.bz2 ]; then wget $LSOFURL fi - if [ ! -e lsof_$LSOFVER/lsof_${LSOFVER}_src/lsof ]; then - rm -rf lsof_$LSOFVER - tar -xf lsof_$LSOFVER.tar.bz2 + if [ ! -e lsof_*/lsof_*_src/lsof ]; then + rm -rf lsof_* + tar -xf lsof.tar.bz2 ( - cd lsof_$LSOFVER - tar -xf lsof_${LSOFVER}_src.tar - cd lsof_${LSOFVER}_src + cd lsof_* + tar -xf lsof_*_src.tar + cd lsof_*_src ./Configure -n linux sed -i 's/^CFGL=.*/\0 --static/' Makefile make all ) fi - cp -av lsof_$LSOFVER/lsof_${LSOFVER}_src/lsof $TREE/bin/ + cp -av lsof_*/lsof_*_src/lsof $TREE/bin/ fi # copy needed modules while read M; do Modified: salt/trunk/initrd-template/cleanup =================================================================== --- salt/trunk/initrd-template/cleanup 2011-10-18 15:51:36 UTC (rev 2765) +++ salt/trunk/initrd-template/cleanup 2011-10-19 08:52:43 UTC (rev 2766) @@ -102,17 +102,25 @@ dev=$(cut -d: -f1 /sync-persistence) relpath=$(cut -d: -f2 /sync-persistence) dir=$(mount_device $dev) + debugshell if [ -e "$dir"/"$relpath" ]; then infolog 'Syncing RAM -> persistence file...' mkdir /mnt/sync mount -o loop "$dir"/"$relpath" /mnt/sync + debugshell if [ $? -eq 0 ]; then - cp -a /mnt/ram/* /mnt/ram/.??* /mnt/sync - sync + SIZE_RAM=$(du -sm /mnt/ram|cut -f1) + SIZE_SYNC=$(du -sm /mnt/sync|cut -f1) + if [ $SIZE_RAM -lt $SIZE_SYNC ]; then + cp -a /mnt/ram/* /mnt/ram/.??* /mnt/sync + sync + infolog " $dir/$relpath synchronized" + else + errorlog " Cannot sync to $dir/$relpath: not enough size (${SIZE_RAM}M)" + fi umount /mnt/sync - infolog " $dir/$relpath synchronized" else - errorlog " Cannot mount $dir/$relpath, bad persistence file" + errorlog " Cannot mount $dir/$relpath: bad persistence file" fi rmdir /mnt/sync fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |