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.2.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2c094f5b9439
branches:  trunk
changeset: 469695:2c094f5b9439
user:      xtraeme <xtraeme%pkgsrc.org@localhost>
date:      Fri Feb 27 01:32:30 2004 +0000

description:
Update mklivecd to 0.2.

Changes:

    o Added a new argument (-c) for choosing the configuration file.
    o Improve error/information messages.
    o Plus minor changes.

diffstat:

 doc/CHANGES                         |    3 +-
 sysutils/mklivecd/Makefile          |    4 +-
 sysutils/mklivecd/files/mklivecd.8  |   14 ++++-
 sysutils/mklivecd/files/mklivecd.sh |  106 ++++++++++++++++++++++-------------
 4 files changed, 82 insertions(+), 45 deletions(-)

diffs (281 lines):

diff -r b8a3be567961 -r 2c094f5b9439 doc/CHANGES
--- a/doc/CHANGES       Fri Feb 27 01:25:52 2004 +0000
+++ b/doc/CHANGES       Fri Feb 27 01:32:30 2004 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.5013 2004/02/27 00:22:07 ben Exp $
+$NetBSD: CHANGES,v 1.5014 2004/02/27 01:32:30 xtraeme Exp $
 
 Changes to the packages collection and infrastructure in 2004:
 
@@ -1064,3 +1064,4 @@
        Added py-IndexedCatalog-0.6.0 [minskim 2004-02-26]
        Added jigdo-0.7.0 [agc 2004-02-26]
        Updated SDL_gfx to 2.0.10 [ben 2004-02-26]
+       Updated mklivecd to 0.2 [xtraeme 2004-02-27]
diff -r b8a3be567961 -r 2c094f5b9439 sysutils/mklivecd/Makefile
--- a/sysutils/mklivecd/Makefile        Fri Feb 27 01:25:52 2004 +0000
+++ b/sysutils/mklivecd/Makefile        Fri Feb 27 01:32:30 2004 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.1.1.1 2004/02/26 03:58:51 xtraeme Exp $
+# $NetBSD: Makefile,v 1.2 2004/02/27 01:32:31 xtraeme Exp $
 
-DISTNAME=      mklivecd-0.1
+DISTNAME=      mklivecd-0.2
 CATEGORIES=    sysutils
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r b8a3be567961 -r 2c094f5b9439 sysutils/mklivecd/files/mklivecd.8
--- a/sysutils/mklivecd/files/mklivecd.8        Fri Feb 27 01:25:52 2004 +0000
+++ b/sysutils/mklivecd/files/mklivecd.8        Fri Feb 27 01:32:30 2004 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mklivecd.8,v 1.1.1.1 2004/02/26 03:58:54 xtraeme Exp $
+.\" $NetBSD: mklivecd.8,v 1.2 2004/02/27 01:32:31 xtraeme Exp $
 .\"
 .\" mklivecd - Build a NetBSD Live CD for i386 machines
 .\" Copyright (c) 2004 Juan RP <xtraeme%NetBSD.org@localhost>
@@ -37,6 +37,9 @@
 Live CD for i386 machines
 .Sh SYNOPSIS
 .Nm
+.Oo
+.Ar -c conf_file
+.Oc 
 .Ar target
 .Sh DESCRIPTION
 .Nm
@@ -45,6 +48,15 @@
 Live CD, so you don't need to install
 .Nx
 to any disk, because it will run directly from the CD-ROM.
+.Pp
+The following options are recognized:
+.Bl -tag -width XcXconf_file
+.It Fl c Ar conf_file
+Use
+.Ar conf_file
+as configuration file (full name expected). Example:
+.Ar -c foo.conf .
+.El
 .Sh CONFIGURATION
 .Nm
 reads the parameters of the main configuration file
diff -r b8a3be567961 -r 2c094f5b9439 sysutils/mklivecd/files/mklivecd.sh
--- a/sysutils/mklivecd/files/mklivecd.sh       Fri Feb 27 01:25:52 2004 +0000
+++ b/sysutils/mklivecd/files/mklivecd.sh       Fri Feb 27 01:32:30 2004 +0000
@@ -1,9 +1,9 @@
 #!/bin/sh
 #
-# $NetBSD: mklivecd.sh,v 1.1.1.1 2004/02/26 03:58:56 xtraeme Exp $
+# $NetBSD: mklivecd.sh,v 1.2 2004/02/27 01:32:31 xtraeme Exp $
 #
 # Copyright (c) 2004 Juan RP <xtraeme%NetBSD.org@localhost>
-# All rights Reserved.
+# All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -35,14 +35,15 @@
 # ====================================================================== #
 
 progname=$(basename $0)
-config_dir="$HOME/.mklivecd/"
-config_file="$config_dir/mklivecd.conf"
+config_dir="$HOME/.mklivecd"
 pers_conffile="personal_config"
 tmp_file="/tmp/${progname}.$$"
 
 MKISOFS="@PREFIX@/bin/mkisofs"
 CDRECORD="@PREFIX@/bin/cdrecord"
 
+trap "echo; showmsg \"Process cancelled!\"; bye 127" INT QUIT
+
 # ====================================================================== #
 #  My functions :-)                                                     #
 # ====================================================================== #
@@ -51,7 +52,7 @@
 {
        cat <<_usage_
 
-       ${progname}: [target]
+       ${progname}: [-c config_file] [target]
 
        Target operations:
 
@@ -166,14 +167,10 @@
                echo >> $config_file
 
                echo "=> Configuration file created, now please edit it."
+               echo "=> Path: $config_file"
        else
-               . $config_file
-
-               if [ ! -d $SOURCEDIR/sys ]; then
-                   showmsg "Cannot find $SOURCEDIR, please download"
-                   showmsg "the src module."
-                   bye 1
-               fi
+               showmsg "$config_file already exists!"
+               bye 1
        fi
 }
 
@@ -200,6 +197,11 @@
 
        case "$1" in
        kernel)
+               if [ ! -d $SOURCEDIR/sys ]; then
+                   showmsg "Can't find NetBSD sources, exiting!"
+                   bye 1
+               fi
+
                showmsg "Building boot image on $(date)"
                echo
                showmsg "Using the following values:"
@@ -321,7 +323,7 @@
                cat > $ISODIR/etc/rc.d/root <<_EOF_
 #!/bin/sh
 #
-# \$NetBSD: mklivecd.sh,v 1.1.1.1 2004/02/26 03:58:56 xtraeme Exp $
+# \$NetBSD: mklivecd.sh,v 1.2 2004/02/27 01:32:31 xtraeme Exp $
 # 
 
 # PROVIDE: root
@@ -446,18 +448,18 @@
                    fi
                fi
 
-               if [ "${PERSONAL_CONFIG}" = "yes" -a -f $config_dir/$pers_conffile ]; then
+               if [ "${PERSONAL_CONFIG}" = "yes" -a                        \
+                       -f $config_dir/$pers_conffile ]; then
                    echo
                    showmsg "Running personal config file"
                    . $config_dir/$pers_conffile
                    showmsg "Done!"
                    echo
-               elif [ "${PERSONAL_CONFIG}" = "yes" -a ! -f $config_dir/$pers_conffile ]; then
+               elif [ "${PERSONAL_CONFIG}" = "yes" -a                      \
+                       ! -f $config_dir/$pers_conffile ]; then
                    echo
-                   showmsg "Can't find personal configuration file, please"
-                   showmsg "disable it if you don't want to use it, or otherwise"
-                   showmsg "use the example file to see how to create your"
-                   showmsg "own custom file."
+                   showmsg "Can't find the personal configuration file."
+                   showmsg "Skipping it..."
                    echo
                else
                    continue
@@ -487,11 +489,11 @@
        iso)
                if [ ! -f $ISODIR/netbsd ]; then
                        showmsg "Target iso failed!"
-                       showmsg "Can't find NetBSD kernel"
+                       showmsg "Can't find NetBSD kernel."
                        bye 1
                elif [ ! -f $ISODIR/stand/mfs_etc.tbz ]; then
                        showmsg "Target iso failed!"
-                       showmsg "Can't find mfs_etc.tbz file"
+                       showmsg "Can't find mfs_etc.tbz file."
                        bye 1
                fi
 
@@ -518,7 +520,7 @@
        ;;
        burn)
                if [ ! -f $BASEDIR/$IMAGE_NAME.iso ]; then
-                   showmsg "Can't find iso image!"
+                   showmsg "Can't find iso image!, exiting."
                    bye 1
                fi
 
@@ -534,49 +536,71 @@
 
 checkconf()
 {
-    if [ -f $config_file ]; then
-       [ `id -u` -ne 0 ] && showmsg "must be run as root" && bye 1
-           do_conf_reset; . $config_file; do_conf
-    else
-       showmsg "$config_file does not exist"
-       bye 1
-    fi
+       if [ -f $config_file ]; then
+           [ `id -u` -ne 0 ] && showmsg "must be run as root" && bye 1
+           do_conf_reset; do_conf
+       else
+           showmsg "$config_file does not exist, exiting."
+           bye 1
+       fi
 }
 
 # =========================================================================== #
 #  Main program                                                                      #
 # =========================================================================== #
 
+args=`getopt c: $*`
+if [ $? -ne 0 ]; then
+       usage
+fi
+set -- $args
+while [ $# -gt 0 ]; do
+       case "$1" in
+           -c)
+               config_file="$config_dir/$2"
+               shift
+               ;;
+           --)
+               shift; break
+               ;;
+       esac
+       shift
+done
+
 if [ $# -lt 1 ]; then
        usage
 fi
 
+if [ -z "$config_file" ]; then
+       config_file=$config_dir/mklivecd.conf
+fi
+
 case "$1" in
        iso)
-               checkconf
-               do_cdlive iso
+           checkconf
+           do_cdlive iso
        ;;
        kernel)
-               do_cdlive kernel
+           do_cdlive kernel
        ;;
        base)
-               checkconf
-               do_cdlive base
+           checkconf
+           do_cdlive base
        ;;
        chroot)
-               checkconf
-               do_cdlive chroot
+           checkconf
+           do_cdlive chroot
        ;;
        clean)
-               checkconf
-               do_cdlive clean
+           checkconf
+           do_cdlive clean
        ;;
        config)
-               do_conf
+           do_conf
        ;;
        burn)
-               checkconf
-               do_cdlive burn
+           checkconf
+           do_cdlive burn
        ;;
 esac
 



Home | Main Index | Thread Index | Old Index