pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc Update mklivecd to 0.3.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8332d2bc0b68
branches:  trunk
changeset: 469956:8332d2bc0b68
user:      xtraeme <xtraeme%pkgsrc.org@localhost>
date:      Wed Mar 03 16:26:40 2004 +0000

description:
Update mklivecd to 0.3.

        o Added a new flag (-v) to show more informational messages.
        o Don't try to mount/umount pkgsrc directory every time the
          `chroot' target is invoked.
        o Added a new option to the config file: `CDRECORD_ARGS'.

diffstat:

 doc/CHANGES                         |    3 +-
 sysutils/mklivecd/Makefile          |    4 +-
 sysutils/mklivecd/files/mklivecd.8  |   17 ++++-
 sysutils/mklivecd/files/mklivecd.sh |  119 +++++++++++++++++++++++++----------
 4 files changed, 102 insertions(+), 41 deletions(-)

diffs (truncated from 353 to 300 lines):

diff -r 2047ce114b50 -r 8332d2bc0b68 doc/CHANGES
--- a/doc/CHANGES       Wed Mar 03 16:02:25 2004 +0000
+++ b/doc/CHANGES       Wed Mar 03 16:26:40 2004 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.5073 2004/03/03 16:02:25 minskim Exp $
+$NetBSD: CHANGES,v 1.5074 2004/03/03 16:26:40 xtraeme Exp $
 
 Changes to the packages collection and infrastructure in 2004:
 
@@ -1138,3 +1138,4 @@
        Updated ncurses to 5.4 [adam 2004-03-03]
        Updated lynx to 2.8.5 [adam 2004-03-03]
        Updated gnet to 2.0.5 [minskim 2004-03-03]
+       mklivecd to 0.3 [xtraeme 2004-03-03]
diff -r 2047ce114b50 -r 8332d2bc0b68 sysutils/mklivecd/Makefile
--- a/sysutils/mklivecd/Makefile        Wed Mar 03 16:02:25 2004 +0000
+++ b/sysutils/mklivecd/Makefile        Wed Mar 03 16:26:40 2004 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.2 2004/02/27 01:32:31 xtraeme Exp $
+# $NetBSD: Makefile,v 1.3 2004/03/03 16:26:40 xtraeme Exp $
 
-DISTNAME=      mklivecd-0.2
+DISTNAME=      mklivecd-0.3
 CATEGORIES=    sysutils
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 2047ce114b50 -r 8332d2bc0b68 sysutils/mklivecd/files/mklivecd.8
--- a/sysutils/mklivecd/files/mklivecd.8        Wed Mar 03 16:02:25 2004 +0000
+++ b/sysutils/mklivecd/files/mklivecd.8        Wed Mar 03 16:26:40 2004 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mklivecd.8,v 1.3 2004/02/27 01:48:43 wiz Exp $
+.\" $NetBSD: mklivecd.8,v 1.4 2004/03/03 16:26:40 xtraeme Exp $
 .\"
 .\" mklivecd - Build a NetBSD Live CD for i386 machines
 .\" Copyright (c) 2004 Juan RP <xtraeme%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 27, 2004
+.Dd March 3, 2004
 .Dt MKLIVECD 8
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 Live CD for i386 machines
 .Sh SYNOPSIS
 .Nm
+.Fl v
 .Fl c Ar conf_file
 .Ar target
 .Sh DESCRIPTION
@@ -56,6 +57,10 @@
 Example:
 .Fl c Ar foo.conf .
 .El
+.Bl -tag -width XvX
+.It Fl v
+Show more useful messages.
+.El
 .Sh CONFIGURATION
 .Nm
 reads the parameters of the main configuration file
@@ -132,6 +137,14 @@
 then X11 sets and configuration files will be unpacked automatically.
 Defaults to
 .Sy no .
+.It CDRECORD_ARGS
+Arguments passed to 
+.Xr cdrecord 1 
+when burning the
+.Nx
+Live CD ISO image.
+Defaults to
+.Sy -v .
 .It BLANK_BEFORE_BURN
 Used in the
 .Ar burn
diff -r 2047ce114b50 -r 8332d2bc0b68 sysutils/mklivecd/files/mklivecd.sh
--- a/sysutils/mklivecd/files/mklivecd.sh       Wed Mar 03 16:02:25 2004 +0000
+++ b/sysutils/mklivecd/files/mklivecd.sh       Wed Mar 03 16:26:40 2004 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: mklivecd.sh,v 1.4 2004/03/03 14:46:55 keihan Exp $
+# $NetBSD: mklivecd.sh,v 1.5 2004/03/03 16:26:40 xtraeme Exp $
 #
 # Copyright (c) 2004 Juan RP <xtraeme%NetBSD.org@localhost>
 # All rights reserved.
@@ -38,6 +38,7 @@
 config_dir="$HOME/.mklivecd"
 pers_conffile="personal_config"
 tmp_file="/tmp/${progname}.$$"
+mntstat="$config_dir/mount.stat"
 
 MKISOFS="@PREFIX@/bin/mkisofs"
 CDRECORD="@PREFIX@/bin/cdrecord"
@@ -52,7 +53,7 @@
 {
        cat <<_usage_
 
-       ${progname}: [-c config_file] [target]
+       ${progname}: [-v] [-c config_file] [target]
 
        Target operations:
 
@@ -85,8 +86,9 @@
        BASE_VARS="SOURCEDIR PKGSRCDIR SHAREDIR BASEDIR WORKDIR ISODIR \
                   BASE_SETS_DIR X11_SETS_DIR BASE_SETS X11_SETS"
 
-       MISC_VARS="ENABLE_X11 BLANK_BEFORE_BURN CDROM_DEVICE PERSONAL_CONFIG \
-                  BOOTKERN KERNEL_NAME IMAGE_NAME PKG_SYSCONFDIR REMOVE_DIRS"
+       MISC_VARS="ENABLE_X11 CDRECORD_ARGS BLANK_BEFORE_BURN CDROM_DEVICE \
+                  PERSONAL_CONFIG BOOTKERN KERNEL_NAME IMAGE_NAME \
+                  PKG_SYSCONFDIR REMOVE_DIRS"
 
        MNT_VARS="MNT_DEV_ARGS MNT_ETC_ARGS MNT_VAR_ARGS \
                  MNT_ROOT_ARGS MNT_TMP_ARGS MNT_HOME_ARGS \
@@ -106,6 +108,7 @@
 
        # Miscellaneous options
        : ${ENABLE_X11:=no}
+       : ${CDRECORD_ARGS:=-v}
        : ${BLANK_BEFORE_BURN:=no}
        : ${CDROM_DEVICE:=15,1,0}
        : ${PERSONAL_CONFIG:=no}
@@ -169,7 +172,9 @@
                echo "=> Configuration file created, now please edit it."
                echo "=> Path: $config_file"
        elif [ -f $config_file -a $target != "config" ]; then
-               showmsg "Using $config_file"
+               if [ "$verbose_mode" = "on" ]; then
+                   showmsg "Using $config_file"
+               fi
        else
                showmsg "$config_file already exists!"
                bye 1
@@ -245,8 +250,10 @@
                    rm -rf $KERNEL_NAME
                    echo
                    showmsg "Build successful"
-                   showmsg "Boot/kernel image installed!"
-                   showmsg "Next step: ${progname} base"
+                   if [ "$verbose_mode" = "on" ]; then
+                       showmsg "Boot/kernel image installed!"
+                       showmsg "Next step: ${progname} base"
+                   fi
                    echo
                else
                    echo
@@ -271,7 +278,9 @@
                for S in ${BASE_SETS}
                do
                    if [ -f $BASE_SETS_DIR/$S ]; then
-                       echo "=> Unpacking $S"
+                       if [ "$verbose_mode" = "on" ]; then
+                           echo "=> Unpacking $S"
+                       fi
                        tar xfzp $BASE_SETS_DIR/$S -C $ISODIR
                    fi
                done
@@ -291,7 +300,9 @@
                        for X in ${X11_SETS}
                        do
                            if [ -f $X11_SETS_DIR/$X ]; then
-                               echo "=> Unpacking $X"
+                               if [ "$verbose_mode" = "on" ]; then
+                                   echo "=> Unpacking $X"
+                               fi
                                tar xfzp $X11_SETS_DIR/$X -C $ISODIR
                            fi
                        done
@@ -325,7 +336,7 @@
                cat > $ISODIR/etc/rc.d/root <<_EOF_
 #!/bin/sh
 #
-# \$NetBSD: mklivecd.sh,v 1.4 2004/03/03 14:46:55 keihan Exp $
+# \$NetBSD: mklivecd.sh,v 1.5 2004/03/03 16:26:40 xtraeme Exp $
 # 
 
 # PROVIDE: root
@@ -352,19 +363,16 @@
                cd $ISODIR/dev && ./MAKEDEV all
                echo
                showmsg "Target base successful"
-               showmsg "Base system installed"
-               showmsg "Next step: ${progname} chroot"
+               if [ "$verbose_mode" = "on" ]; then
+                   showmsg "Base system installed"
+                   showmsg "Next step: ${progname} chroot"
+               fi
        ;;
        chroot)
-               if [ ! -f $ISODIR/.prompt_done ]; then
-                   (                                               \
-                   echo "export PS1=\"$KERNEL_NAME> \"";           \
-                   echo "set -o emacs";                            \
-                   ) > $ISODIR/etc/profile
-                   touch $ISODIR/.prompt_done
-               else
-                   showmsg "Prompt already set!"
-               fi
+               (                                                   \
+               echo "export PS1=\"$KERNEL_NAME> \"";       \
+               echo "set -o emacs";                        \
+               ) > $ISODIR/etc/profile
 
                if [ ! -d $ISODIR/usr/pkgsrc ]; then
                    mkdir $ISODIR/usr/pkgsrc
@@ -378,16 +386,23 @@
                showmsg "Entering into the chroot!"
 
                if [ -d $PKGSRCDIR ]; then
-                   showmsg "Mounting pkgsrc directory."
-                   mount_null $PKGSRCDIR $ISODIR/usr/pkgsrc
+                   if [ -f $mntstat ]; then
+                       count=`cat $mntstat`
+                       count=$(($count + 1))
+                       echo $count > $mntstat
+                       showmsg "pkgsrc directory already mounted."
+                   else
+                       showmsg "pkgsrc directory ready."
+                       echo "1" > $mntstat
+                       mount_null $PKGSRCDIR $ISODIR/usr/pkgsrc
+                   fi
                else
-                   showmsg "Can't find $PKGSRCDIR, disabling it"
+                   showmsg "Can't find $PKGSRCDIR, disabling it."
                fi
 
                echo
                chroot $ISODIR /bin/ksh
                echo
-               showmsg "Unmounting pkgsrc."
 
                if [ ! -d $ISODIR/root ]; then
                    showmsg "Target chroot failed!"
@@ -453,7 +468,7 @@
                if [ "${PERSONAL_CONFIG}" = "yes" -a                        \
                        -f $config_dir/$pers_conffile ]; then
                    echo
-                   showmsg "Running personal config file"
+                   showmsg "Running personal config file..."
                    . $config_dir/$pers_conffile
                    showmsg "Done!"
                    echo
@@ -472,9 +487,27 @@
 
                chmod -R a+rx $ISODIR/etc/rc.d
 
-               umount $ISODIR/usr/pkgsrc
-               rm $ISODIR/.prompt_done
-               showmsg "Size: $(du -sh $ISODIR)"
+               if [ ! -f $mntstat ]; then
+                   showmsg "pkgsrc was not mounted."
+               else
+                   cnt=`cat $mntstat`
+                   if [ "$cnt" -gt 1 ]; then
+                       cnt=$(($cnt - 1))
+                       echo $cnt > $mntstat
+                       showmsg "pkgsrc Still in use by mklivecd."
+                   else
+                       showmsg "Unmounting pkgsrc."
+                       umount -R $ISODIR/usr/pkgsrc
+                       if [ $? -eq 0 ]; then
+                           rm $mntstat
+                       else
+                           echo "Can't umount $PKGSRCDIR."
+                       fi
+                   fi
+               fi
+               if [ "$verbose_mode" = "on" ]; then
+                   showmsg "Size: $(du -sh $ISODIR)"
+               fi
        ;;
        clean)
                showmsg "Cleaning WORKDIR: $WORKDIR"
@@ -483,7 +516,9 @@
                    root tmp usr var sbin home
                do
                    if [ -d $ISODIR/$F ]; then
-                       showmsg "Cleaning ISODIR: $ISODIR/$F"
+                       if [ "$verbose_mode" = "on" ]; then
+                           showmsg "Removing $ISODIR/$F."
+                       fi
                        rm -rf $ISODIR/$F
                    fi
                done
@@ -501,13 +536,16 @@
                fi
 
                echo
-               showmsg "Removing not needed directories:"
+               showmsg "Removing not needed directories."
                for RM in ${REMOVE_DIRS}
                 do
                     if [ -d $ISODIR/$RM ]; then
-                        echo "=> Removing $RM..."; rm -rf $ISODIR/$RM
+                       if [ "$verbose_mode" = "on" ]; then
+                           echo "=> Removing $RM..."



Home | Main Index | Thread Index | Old Index