Hi,

   The following patch to /usr/src/release/Makefile allows the
specification of the variable FASTCLEAN, which instead of doing
a recursive rm on CHROOTDIR, simply umounts/newfs/mounts. Of
course, this is only useful if your CHROOTDIR location is a
separate mount point (which mine is: /snap).

   Comments and critiques welcome.

   Would someone consider committing this please?


Thanks,
John

Index: Makefile
===================================================================
RCS file: /mirror/ncvs/src/release/Makefile,v
retrieving revision 1.508
diff -u -r1.508 Makefile
--- Makefile    1999/09/07 20:47:42     1.508
+++ Makefile    1999/09/09 04:01:37
@@ -152,11 +152,23 @@
 .endif
 .if make(release)
 .if exists(${CHROOTDIR})
+.if defined(FASTCLEAN)
+#
+# Simply umount/newfs/mount the partition where $CHROOTDIR resides.
+# This only works if $CHROOTDIR is a separate mount point.
+#
+       -device=`df | grep '${CHROOTDIR}' | cut -f1 -d' '` && \
+               /sbin/umount ${CHROOTDIR} && \
+               /sbin/newfs  $$device && \
+               /sbin/mount  ${CHROOTDIR} && \
+               /bin/df ${CHROOTDIR}
+.else
 # The first command will fail on a handful of files that have their schg
 # flags set.  But it greatly speeds up the next two commands.
        -rm -rf ${CHROOTDIR}
        -chflags -R noschg ${CHROOTDIR}/.
        -rm -rf ${CHROOTDIR}
+.endif
 .endif
        -mkdir -p ${CHROOTDIR}
        cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}


Sample output:

%make release CHROOTDIR=/snap TITLE=test CVSROOT=/mirror/ncvs FASTCLEAN=yes
device=`df | grep '/snap' | cut -f1 -d' '` &&  /sbin/umount /snap &&  /sbin/newfs  
$device &&  /sbin/mount  /snap &&  /bin/df /snap
newfs: /dev/ccd0b: not a character-special device
Warning: 1328 sector(s) in last cylinder unallocated
/dev/ccd0b:     11111120 sectors in 2713 cylinders of 1 tracks, 4096 sectors
        5425.4MB in 170 cyl groups (16 c/g, 32.00MB/g, 7936 i/g)
super-block backups (for fsck -b #) at:
 32, 65568, 131104, 196640, 262176, 327712, 393248, 458784, 524320, 589856,
 655392, 720928, 786464, 852000, 917536, 983072, 1048608, 1114144, 1179680,
...
 10616864, 10682400, 10747936, 10813472, 10879008, 10944544, 11010080, 11075616
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/ccd0b    5384181        1  4953446     0%    /snap
mkdir -p /snap




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to