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.
This commit is contained in:
xtraeme 2004-02-27 01:32:30 +00:00
parent 34cb087f2a
commit 9cdea873a2
4 changed files with 82 additions and 45 deletions

View file

@ -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: Changes to the packages collection and infrastructure in 2004:
@ -1064,3 +1064,4 @@ Changes to the packages collection and infrastructure in 2004:
Added py-IndexedCatalog-0.6.0 [minskim 2004-02-26] Added py-IndexedCatalog-0.6.0 [minskim 2004-02-26]
Added jigdo-0.7.0 [agc 2004-02-26] Added jigdo-0.7.0 [agc 2004-02-26]
Updated SDL_gfx to 2.0.10 [ben 2004-02-26] Updated SDL_gfx to 2.0.10 [ben 2004-02-26]
Updated mklivecd to 0.2 [xtraeme 2004-02-27]

View file

@ -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 CATEGORIES= sysutils
MASTER_SITES= # empty MASTER_SITES= # empty
DISTFILES= # empty DISTFILES= # empty

View file

@ -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 .\" mklivecd - Build a NetBSD Live CD for i386 machines
.\" Copyright (c) 2004 Juan RP <xtraeme@NetBSD.org> .\" Copyright (c) 2004 Juan RP <xtraeme@NetBSD.org>
@ -37,6 +37,9 @@
Live CD for i386 machines Live CD for i386 machines
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Oo
.Ar -c conf_file
.Oc
.Ar target .Ar target
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
@ -45,6 +48,15 @@ allows you to build your own
Live CD, so you don't need to install Live CD, so you don't need to install
.Nx .Nx
to any disk, because it will run directly from the CD-ROM. 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 .Sh CONFIGURATION
.Nm .Nm
reads the parameters of the main configuration file reads the parameters of the main configuration file

View file

@ -1,9 +1,9 @@
#!/bin/sh #!/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> # Copyright (c) 2004 Juan RP <xtraeme@NetBSD.org>
# All rights Reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions # modification, are permitted provided that the following conditions
@ -35,14 +35,15 @@
# ====================================================================== # # ====================================================================== #
progname=$(basename $0) progname=$(basename $0)
config_dir="$HOME/.mklivecd/" config_dir="$HOME/.mklivecd"
config_file="$config_dir/mklivecd.conf"
pers_conffile="personal_config" pers_conffile="personal_config"
tmp_file="/tmp/${progname}.$$" tmp_file="/tmp/${progname}.$$"
MKISOFS="@PREFIX@/bin/mkisofs" MKISOFS="@PREFIX@/bin/mkisofs"
CDRECORD="@PREFIX@/bin/cdrecord" CDRECORD="@PREFIX@/bin/cdrecord"
trap "echo; showmsg \"Process cancelled!\"; bye 127" INT QUIT
# ====================================================================== # # ====================================================================== #
# My functions :-) # # My functions :-) #
# ====================================================================== # # ====================================================================== #
@ -51,7 +52,7 @@ usage()
{ {
cat <<_usage_ cat <<_usage_
${progname}: [target] ${progname}: [-c config_file] [target]
Target operations: Target operations:
@ -166,14 +167,10 @@ EOF
echo >> $config_file echo >> $config_file
echo "=> Configuration file created, now please edit it." echo "=> Configuration file created, now please edit it."
echo "=> Path: $config_file"
else else
. $config_file showmsg "$config_file already exists!"
bye 1
if [ ! -d $SOURCEDIR/sys ]; then
showmsg "Cannot find $SOURCEDIR, please download"
showmsg "the src module."
bye 1
fi
fi fi
} }
@ -200,6 +197,11 @@ do_cdlive()
case "$1" in case "$1" in
kernel) kernel)
if [ ! -d $SOURCEDIR/sys ]; then
showmsg "Can't find NetBSD sources, exiting!"
bye 1
fi
showmsg "Building boot image on $(date)" showmsg "Building boot image on $(date)"
echo echo
showmsg "Using the following values:" showmsg "Using the following values:"
@ -321,7 +323,7 @@ do_cdlive()
cat > $ISODIR/etc/rc.d/root <<_EOF_ cat > $ISODIR/etc/rc.d/root <<_EOF_
#!/bin/sh #!/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 # PROVIDE: root
@ -446,18 +448,18 @@ _EOF_
fi fi
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 echo
showmsg "Running personal config file" showmsg "Running personal config file"
. $config_dir/$pers_conffile . $config_dir/$pers_conffile
showmsg "Done!" showmsg "Done!"
echo echo
elif [ "${PERSONAL_CONFIG}" = "yes" -a ! -f $config_dir/$pers_conffile ]; then elif [ "${PERSONAL_CONFIG}" = "yes" -a \
! -f $config_dir/$pers_conffile ]; then
echo echo
showmsg "Can't find personal configuration file, please" showmsg "Can't find the personal configuration file."
showmsg "disable it if you don't want to use it, or otherwise" showmsg "Skipping it..."
showmsg "use the example file to see how to create your"
showmsg "own custom file."
echo echo
else else
continue continue
@ -487,11 +489,11 @@ _EOF_
iso) iso)
if [ ! -f $ISODIR/netbsd ]; then if [ ! -f $ISODIR/netbsd ]; then
showmsg "Target iso failed!" showmsg "Target iso failed!"
showmsg "Can't find NetBSD kernel" showmsg "Can't find NetBSD kernel."
bye 1 bye 1
elif [ ! -f $ISODIR/stand/mfs_etc.tbz ]; then elif [ ! -f $ISODIR/stand/mfs_etc.tbz ]; then
showmsg "Target iso failed!" showmsg "Target iso failed!"
showmsg "Can't find mfs_etc.tbz file" showmsg "Can't find mfs_etc.tbz file."
bye 1 bye 1
fi fi
@ -518,7 +520,7 @@ _EOF_
;; ;;
burn) burn)
if [ ! -f $BASEDIR/$IMAGE_NAME.iso ]; then if [ ! -f $BASEDIR/$IMAGE_NAME.iso ]; then
showmsg "Can't find iso image!" showmsg "Can't find iso image!, exiting."
bye 1 bye 1
fi fi
@ -534,49 +536,71 @@ _EOF_
checkconf() checkconf()
{ {
if [ -f $config_file ]; then if [ -f $config_file ]; then
[ `id -u` -ne 0 ] && showmsg "must be run as root" && bye 1 [ `id -u` -ne 0 ] && showmsg "must be run as root" && bye 1
do_conf_reset; . $config_file; do_conf do_conf_reset; do_conf
else else
showmsg "$config_file does not exist" showmsg "$config_file does not exist, exiting."
bye 1 bye 1
fi fi
} }
# =========================================================================== # # =========================================================================== #
# Main program # # 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 if [ $# -lt 1 ]; then
usage usage
fi fi
if [ -z "$config_file" ]; then
config_file=$config_dir/mklivecd.conf
fi
case "$1" in case "$1" in
iso) iso)
checkconf checkconf
do_cdlive iso do_cdlive iso
;; ;;
kernel) kernel)
do_cdlive kernel do_cdlive kernel
;; ;;
base) base)
checkconf checkconf
do_cdlive base do_cdlive base
;; ;;
chroot) chroot)
checkconf checkconf
do_cdlive chroot do_cdlive chroot
;; ;;
clean) clean)
checkconf checkconf
do_cdlive clean do_cdlive clean
;; ;;
config) config)
do_conf do_conf
;; ;;
burn) burn)
checkconf checkconf
do_cdlive burn do_cdlive burn
;; ;;
esac esac