diff options
author | xtraeme <xtraeme> | 2004-03-03 16:26:40 +0000 |
---|---|---|
committer | xtraeme <xtraeme> | 2004-03-03 16:26:40 +0000 |
commit | de047e2940636339170778be47d3db3aec7e61d0 (patch) | |
tree | 28fd7c0b20271ed1768cc513757001b910971a87 /sysutils | |
parent | d12466302ca330c993a77202d9208316cd89af5b (diff) | |
download | pkgsrc-de047e2940636339170778be47d3db3aec7e61d0.tar.gz |
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 (limited to 'sysutils')
-rw-r--r-- | sysutils/mklivecd/Makefile | 4 | ||||
-rw-r--r-- | sysutils/mklivecd/files/mklivecd.8 | 17 | ||||
-rwxr-xr-x | sysutils/mklivecd/files/mklivecd.sh | 119 |
3 files changed, 100 insertions, 40 deletions
diff --git a/sysutils/mklivecd/Makefile b/sysutils/mklivecd/Makefile index 4bfada3434e..56813505dd9 100644 --- a/sysutils/mklivecd/Makefile +++ b/sysutils/mklivecd/Makefile @@ -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 --git a/sysutils/mklivecd/files/mklivecd.8 b/sysutils/mklivecd/files/mklivecd.8 index 9f9e1c5360e..eceaea11d82 100644 --- a/sysutils/mklivecd/files/mklivecd.8 +++ b/sysutils/mklivecd/files/mklivecd.8 @@ -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> @@ -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 @@ as configuration file (full name expected). 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 @@ If set to 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 --git a/sysutils/mklivecd/files/mklivecd.sh b/sysutils/mklivecd/files/mklivecd.sh index d1f587603e9..61c2adb05f1 100755 --- a/sysutils/mklivecd/files/mklivecd.sh +++ b/sysutils/mklivecd/files/mklivecd.sh @@ -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> # All rights reserved. @@ -38,6 +38,7 @@ progname=$(basename $0) 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 @@ usage() { cat <<_usage_ - ${progname}: [-c config_file] [target] + ${progname}: [-v] [-c config_file] [target] Target operations: @@ -85,8 +86,9 @@ do_conf() 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 @@ do_conf() # Miscellaneous options : ${ENABLE_X11:=no} + : ${CDRECORD_ARGS:=-v} : ${BLANK_BEFORE_BURN:=no} : ${CDROM_DEVICE:=15,1,0} : ${PERSONAL_CONFIG:=no} @@ -169,7 +172,9 @@ EOF 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 @@ do_cdlive() 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 @@ do_cdlive() 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 @@ do_cdlive() 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 @@ do_cdlive() 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 @@ _EOF_ 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 @@ _EOF_ 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 @@ _EOF_ 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 @@ _EOF_ 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 @@ _EOF_ 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 @@ _EOF_ 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..." + fi + rm -rf $ISODIR/$RM else - echo "=> Nonexistent directory: $RM" + echo "=> Nonexistent directory: $RM." fi done @@ -528,10 +566,11 @@ _EOF_ fi if [ $BLANK_BEFORE_BURN = "yes" ]; then - $CDRECORD dev=$CDROM_DEVICE -v blank=fast + $CDRECORD dev=$CDROM_DEVICE $CDRECORD_ARGS blank=fast fi - $CDRECORD dev=$CDROM_DEVICE -v $BASEDIR/$IMAGE_NAME.iso + $CDRECORD dev=$CDROM_DEVICE $CDRECORD_ARGS \ + $BASEDIR/$IMAGE_NAME.iso ;; esac @@ -552,7 +591,7 @@ checkconf() # Main program # # =========================================================================== # -args=`getopt c: $*` +args=`getopt c:v $*` if [ $? -ne 0 ]; then usage fi @@ -563,6 +602,10 @@ while [ $# -gt 0 ]; do config_file="$config_dir/$2" shift ;; + -v) + verbose_mode=on + shift + ;; --) shift; break ;; @@ -578,6 +621,10 @@ if [ -z "$config_file" ]; then config_file=$config_dir/mklivecd.conf fi +if [ -z "$verbose_mode" ]; then + verbose_mode=off +fi + target=$1 case "$target" in |