summaryrefslogtreecommitdiff
path: root/sysutils/mklivecd
diff options
context:
space:
mode:
authorxtraeme <xtraeme>2005-07-29 12:13:01 +0000
committerxtraeme <xtraeme>2005-07-29 12:13:01 +0000
commit64b592fb5e963127a865893a8dc297b26bd7fdda (patch)
treea4411f3270bdb6a74ec1fc66b04cb32fe48aa0e0 /sysutils/mklivecd
parentd83fd8897d8344501c9236dd75c2aa7ff2bc5e7a (diff)
downloadpkgsrc-64b592fb5e963127a865893a8dc297b26bd7fdda.tar.gz
Update to 0.12.0.
Changes: o cdboot support on NetBSD >=4.0 (-current). o Availability to choose the bootloader through a new option: USE_GNU_GRUB (by default yes). o When using GRUB as the bootloader, it is possible to build and install multiple kernels with the target "kernel", it will install the kernels into the ISO image and the menu.lst file will be modified automatically, see MULTIPLE_KERNELS (mklivecd(8)). o Various misc fixes. o Now /dev uses optimum values for not wasting space. o Added -k flag, that accepts a kernel as argument. To build an additional kernel without looking at the config file.
Diffstat (limited to 'sysutils/mklivecd')
-rw-r--r--sysutils/mklivecd/DESCR2
-rw-r--r--sysutils/mklivecd/Makefile12
-rw-r--r--sysutils/mklivecd/files/mfs_rcd18
-rw-r--r--sysutils/mklivecd/files/mklivecd.8265
-rwxr-xr-xsysutils/mklivecd/files/mklivecd.sh1302
5 files changed, 939 insertions, 660 deletions
diff --git a/sysutils/mklivecd/DESCR b/sysutils/mklivecd/DESCR
index 3d37ade7d7f..a3be5c73f10 100644
--- a/sysutils/mklivecd/DESCR
+++ b/sysutils/mklivecd/DESCR
@@ -1,2 +1,2 @@
mklivecd is a simple shell script that allows you to build a custom
-NetBSD LiveCD on i386-based machines.
+NetBSD/i386 Live CD-ROM/DVD-ROM with a command line interface.
diff --git a/sysutils/mklivecd/Makefile b/sysutils/mklivecd/Makefile
index fb55a102e6a..62805623493 100644
--- a/sysutils/mklivecd/Makefile
+++ b/sysutils/mklivecd/Makefile
@@ -1,15 +1,15 @@
-# $NetBSD: Makefile,v 1.19 2005/05/16 01:32:23 jlam Exp $
+# $NetBSD: Makefile,v 1.20 2005/07/29 12:13:01 xtraeme Exp $
-DISTNAME= mklivecd-0.11
+DISTNAME= mklivecd-0.12.0
CATEGORIES= sysutils
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= xtraeme@NetBSD.org
-COMMENT= Build a NetBSD i386 Live CD via command line
+COMMENT= Make your own NetBSD/i386 Live CD-ROM/DVD-ROM
DEPENDS+= {cdrecord,cdrtools-ossdvd}-[0-9]*:../../sysutils/cdrecord
-DEPENDS+= grub>=0.96:../../sysutils/grub
+#DEPENDS+= grub>=0.96:../../sysutils/grub
PKG_INSTALLATION_TYPES= overwrite pkgviews
@@ -27,7 +27,7 @@ INSTALLATION_DIRS= man/man8 sbin share/mklivecd
FILES= KERN-LIVECD personal_config
do-install:
-.for f in mfs_rcd mklivecd.sh
+.for f in mfs_rcd mklivecd.sh mklivecd.8
@${SED} -e "s,@PREFIX@,${PREFIX},g" \
-e "s,@LOCALBASE@,${LOCALBASE},g" \
-e "s,@TAR@,${TAR},g" \
@@ -36,7 +36,7 @@ do-install:
.endfor
${INSTALL_DATA_DIR} ${PREFIX}/share/mklivecd
${INSTALL_SCRIPT} ${WRKDIR}/mklivecd.sh ${PREFIX}/sbin/mklivecd
- ${INSTALL_MAN} ${FILESDIR}/mklivecd.8 ${PREFIX}/man/man8
+ ${INSTALL_MAN} ${WRKDIR}/mklivecd.8 ${PREFIX}/man/man8
${INSTALL_DATA} ${WRKDIR}/mfs_rcd ${PREFIX}/share/mklivecd
.for F in ${FILES}
${INSTALL_DATA} ${FILESDIR}/${F} ${PREFIX}/share/mklivecd
diff --git a/sysutils/mklivecd/files/mfs_rcd b/sysutils/mklivecd/files/mfs_rcd
index 810d746e48a..a4e469168f6 100644
--- a/sysutils/mklivecd/files/mfs_rcd
+++ b/sysutils/mklivecd/files/mfs_rcd
@@ -1,6 +1,6 @@
-# $NetBSD: mfs_rcd,v 1.4 2004/10/29 17:47:30 xtraeme Exp $
+# $NetBSD: mfs_rcd,v 1.5 2005/07/29 12:13:01 xtraeme Exp $
#
-# Mount mfs directories and unpack the required file
+# Mount mfs directories and unpack the required files
# before anything.
# PROVIDE: LiveCD
@@ -16,11 +16,15 @@ stop_cmd="mfsrc_stop"
mfsrc_start()
{
- echo "=> Mounting Memory based filesystems..."
+ echo -n "=> Mounting Memory based filesystems: "
mount_mfs @MNT_DEV_ARGS@ swap /dev
+ echo -n "/dev, "
mount_mfs @MNT_ETC_ARGS@ swap /etc
+ echo -n "/etc, "
mount_mfs @MNT_VAR_ARGS@ swap /var
+ echo -n "/root, "
mount_mfs @MNT_ROOT_ARGS@ swap /root
+ echo "/tmp."
mount_mfs @MNT_TMP_ARGS@ swap /tmp
@HOME@
@HOMETAR@
@@ -29,9 +33,13 @@ mfsrc_start()
for f in mfs_dev mfs_etc mfs_var mfs_root
do
- @TAR@ xfzp /stand/$f.tgz -C /
+ @TAR@ xfzp /stand/$f.tgz -C / > /dev/null 2>&1
+ if [ "$?" -eq 0 ]; then
+ echo "=> $f unpacked successfully."
+ else
+ echo "=> $f not unpacked correctly!"
+ fi
done
- echo "=> Finished successfully."
}
mfsrc_stop()
diff --git a/sysutils/mklivecd/files/mklivecd.8 b/sysutils/mklivecd/files/mklivecd.8
index b871d56663a..165ad7e0b1c 100644
--- a/sysutils/mklivecd/files/mklivecd.8
+++ b/sysutils/mklivecd/files/mklivecd.8
@@ -1,7 +1,8 @@
-.\" $NetBSD: mklivecd.8,v 1.10 2005/01/11 02:25:21 xtraeme Exp $
+.\" $NetBSD: mklivecd.8,v 1.11 2005/07/29 12:13:01 xtraeme Exp $
.\"
-.\" mklivecd - Build a NetBSD Live CD for i386 machines
-.\" Copyright (c) 2004 Juan RP <xtraeme@NetBSD.org>
+.\" mklivecd - Make your own NetBSD/i386 Live CD-ROM/DVD-ROM
+.\"
+.\" Copyright (c) 2004, 2005 Juan Romero Pardines <xtraeme@NetBSD.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -27,26 +28,42 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 11, 2005
+.Dd July 25, 2005
.Dt MKLIVECD 8
.Os
.Sh NAME
.Nm mklivecd
-.Nd build a
+.Nd Make your own
.Nx
-Live CD for i386 machines
+/ i386 Live CD-ROM/DVD-ROM
.Sh SYNOPSIS
.Nm
.Fl v
.Fl c Ar conf_file
+.Fl k Ar kernel
.Ar target
.Sh DESCRIPTION
.Nm
allows you to build your own
.Nx
-Live CD, so you don't need to install
+Live CD/DVD, so you don't need to install
+.Nx
+to any disk, because it will run directly from the CD-ROM/DVD-ROM.
+.Pp
+To choose different kernels when booting from the CD-ROM/DVD-ROM,
+two options for the bootloader are provided since version
+.Pa 0.12.0 :
+.Pa the GNU Grub bootloader
+or the
.Nx
-to any disk, because it will run directly from the CD-ROM.
+cdboot bootloader (since
+.Nx
+4.0). By default it will use the first option:
+.Pa the GNU Grub bootloader .
+You may want to change this by changing the option
+.Pa USE_GNU_GRUB
+to
+.Sy no .
.Pp
The following options are recognized:
.Bl -tag -width XcXconf_file
@@ -57,6 +74,14 @@ as configuration file (full name expected).
Example:
.Fl c Ar foo.conf .
.El
+.Bl -tag -width XkXkernel
+.It Fl k Ar kernel
+Overrides the
+.Ar BOOTKERN
+value specified in the configuration file,
+.Ar KERNEL_NAME
+will be modified automatically too.
+.El
.Bl -tag -width XvX
.It Fl v
Show more useful messages.
@@ -76,15 +101,32 @@ issuing the
.Ar config
target.
.Bl -tag -width 15n -offset indent
-.It SOURCEDIR
-The
-.Nx
-source directory.
+.It BASEDIR
+Primary directory used to store the main directories and the final ISO image.
Defaults to
-.Pa /usr/src .
+.Pa $HOME/livecd .
+.It BASE_SETS_DIR
+The base sets directory.
+Defaults to
+.Pa $HOME/release/binary/sets .
+.It BASE_SETS
+Base sets which will be unpacked into
+.Pa $ISODIR .
+Sets used by default are:
+.Pa etc.tgz base.tgz comp.tgz text.tgz .
+.It CHROOT_SHELL
+Default shell to use with the chroot target.
+Defaults to
+.Sy /bin/ksh .
+.It ISODIR
+Directory used to store the main
+.Nx
+base distribution.
+Defaults to
+.Pa $BASEDIR/iso .
.It PKGSRCDIR
-The
-.Nx
+The
+.Nx
packages collection directory.
When the
.Ar chroot
@@ -107,66 +149,50 @@ Defaults to
The main directory used to store the Makefiles, kernel, example configuration
files, etc.
Defaults to
-.Pa $PREFIX/share/mklivecd/ .
-.It BASEDIR
-Primary directory used to store the main directories and the final ISO image.
+.Pa @PREFIX@/share/mklivecd/ .
+.It SOURCEDIR
+The
+.Nx
+source directory.
Defaults to
-.Pa $HOME/livecd .
+.Pa /usr/src .
.It WORKDIR
Directory used to store the object files and kernel built by the target
.Ql kernel .
Defaults to
.Pa $BASEDIR/work .
-.It ISODIR
-Directory used to store the main
-.Nx
-base distribution.
-Defaults to
-.Pa $BASEDIR/iso .
-.It BASE_SETS_DIR
-The base sets directory.
-Defaults to
-.Pa $HOME/release/binary/sets .
-.It X11_SETS_DIR
-The X11 sets directory.
-Defaults to
-.Pa $BASE_SETS_DIR .
-.It BASE_SETS
-Base sets which will be unpacked into
-.Pa $ISODIR .
-Sets used by default are:
-.Pa etc.tgz base.tgz comp.tgz text.tgz .
.It X11_SETS
X11 sets which will be unpacked into
.Pa $ISODIR .
Sets used by default are:
.Pa xbase.tgz xcomp.tgz xfont.tgz xserver.tgz .
-.It CHROOT_SHELL
-Default shell to use with the chroot target.
-Defaults to
-.Sy /bin/ksh
-.It ENABLE_X11
-If set to
-.Sy yes
-then X11 sets and configuration files will be unpacked automatically.
+.It X11_SETS_DIR
+The X11 sets directory.
Defaults to
-.Sy no .
-.It MKISOFS_ARGS
-Arguments passed to
-.Xr mkisofs 1
-when creating the
+.Pa $BASE_SETS_DIR .
+.It BOOTKERN
+Name of the
.Nx
-ISO image.
+kernel used for the boot image.
Defaults to
-.Sy -nobak -J -R -v .
-.It CDRECORD_ARGS
-Arguments passed to
-.Xr cdrecord 1
-when burning the
+.Sy KERN-LIVECD .
+.It KERNEL_NAME
+Name of the built
.Nx
-Live CD ISO image.
+kernel.
+Useful if you want to change the default behaviour of the build process.
Defaults to
-.Sy -v .
+.Sy MKLIVECD .
+.It MULTIPLE_KERNELS
+If set to
+.Sy other thing than ``no'' ,
+it will compile and install the kernels specified into
+.Pa $ISODIR/boot/grub ,
+and it will update automatically the
+.Pa menu.lst
+file for
+.Pa the GNU Grub bootloader .
+See below for details.
.It BLANK_BEFORE_BURN
Used in the
.Ar burn
@@ -176,39 +202,57 @@ Live CD ISO image.
Useful if you use CD-RW.
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 CDROM_DEVICE
Used in the target
.Ar burn
to specify the CD-ROM device.
Defaults to
.Sy 15,1,0 .
-.It PERSONAL_CONFIG
+.It ENABLE_X11
If set to
-.Sy yes ,
-then
-.Pa personal_config
-file will be used.
-See below for details.
+.Sy yes
+then X11 sets and configuration files will be unpacked automatically.
Defaults to
.Sy no .
-.It BOOTKERN
-Name of the
-.Nx
-kernel used for the boot image.
-Defaults to
-.Sy KERN-LIVECD .
-.It KERNEL_NAME
-Name of the built
-.Nx
-kernel.
-Useful if you want to change the default behaviour of the build process.
+.It GRUB_FILES_DIR
+Directory where the grub files are stored.
Defaults to
-.Sy MKLIVECD .
+.Sy @LOCALBASE@/lib/grub/@MACHINE_ARCH@-/ .
+.It HOSTNAME
+Hostname of the live CD-ROM/DVD-ROM, it's assigned when running the
+.Sy base
+target. Defaults to
+.Sy MKLIVECD_0x00 .
.It IMAGE_NAME
Name of the final ISO image, e.g.:
.Pa My_NetBSD_Live_CD_ISO_Image.iso .
Defaults to
.Sy NetBSD-LiveCD .
+.It MKISOFS_ARGS
+Arguments passed to
+.Xr mkisofs 1
+when creating the
+.Nx
+ISO image.
+Defaults to
+.Sy -nobak -J -R -v .
+.It PERSONAL_CONFIG
+If set to
+.Sy yes ,
+then
+.Pa personal_config
+file will be used.
+See below for details.
+Defaults to
+.Sy no .
.It PKG_SYSCONFDIR
Directory where the pkgsrc settings are stored, by default
.Nm
@@ -223,6 +267,13 @@ It could be useful if you don't want to include some directories
on the CD, or your free space is small.
Defaults to
.Pa altroot rescue usr/share/info .
+.It USE_GNU_GRUB
+Used to select the bootloader for the Live CD.
+When it's disabled the
+.Nx
+CDBootloader will be used.
+Defaults to
+.Sy yes .
.It MNT_{MOUNT_POINT}_ARGS
This specifies the arguments passed to the
.Xr mount 8
@@ -293,12 +344,11 @@ directory and the base
.Nx
tree in
.Pa $ISODIR ,
-except the CD-ROM boot image
-.Pa /stand/cdlive-boot.fs
+except the mfs directories located in
+.Pa /stand
and the
.Nx
-kernel
-.Pa /netbsd .
+kernels.
.El
.Ss What should I do in the chroot jail?
While working in the chroot environment, you can
@@ -323,7 +373,37 @@ to the
.Ar $ISODIR/$HOME
directory.
Please take a look at the example file located in
-.Ar ${PREFIX}/share/mklivecd .
+.Ar @PREFIX@/share/mklivecd .
+.Ss How to use the MULTIPLE_KERNELS option?
+An example is provided below, we have two kernels:
+.Ar ACPIKERN
+and
+.Ar APMKERN ,
+both are kernel configuration files, you'll need
+to define the variables named
+.Ar BOOTKERN_${foo}
+and
+.Ar KERNEL_NAME_${foo}
+for every kernel specified on the
+.Pa MULTIPLE_KERNELS
+option. The following example shows that:
+.Bd -literal -offset indent
+MULTIPLE_KERNELS="ACPIKERN APMKERN"
+BOOTKERN_ACPIKERN="LIVECD_ACPI"
+BOOTKERN_APMKERN="LIVECD_APM"
+KERNEL_NAME_ACPIKERN="KERN_ACPI_LIVECD"
+KERNEL_NAME_APMKERN="KERN_APM_LIVECD"
+.Ed
+.Pp
+Note that when using this option, the
+.Pa BOOTKERN
+and
+.Pa KERNEL_NAME
+variables, will don't have any effect. After building the specified
+kernels, it will update the
+.Pa menu.lst
+file automatically for the
+.Ar GNU Grub bootloader .
.Sh NOTES
.Pa PKG_SYSCONFDIR
defaults to
@@ -338,15 +418,25 @@ directory will be copied instead of the one located in
An example kernel config file,
.Pa KERN-LIVECD ,
has been installed into
-.Ar ${PREFIX}/share/mklivecd ,
+.Ar @PREFIX@/share/mklivecd ,
based on the 2.0 branch.
You should copy your own kernel config file into
.Ar $HOME/.mklivecd .
The
.Sy BOOTKERN
-variable should point at it.
+variable should point at it, if you're not using
+.Sy MULTIPLE_KERNELS .
+The important thing about the kernel is the line:
+.Bd -literal -offset indent
+config netbsd root on cd0a type cd9660 dumps on none
+.Ed
+.Pp
+This line is required in the kernel config file for
+the Live CD-ROM/DVD-ROM to boot correctly and without
+human interactivity, otherwise you'll have to enter
+the parameters manually when booting.
.Sh EXAMPLES
-Below are the minimal steps to create your own Live CD:
+Below are the minimal steps to create your own Live CD-ROM/DVD-ROM:
.Bd -literal -offset indent
$ mklivecd config
[edit the config file]
@@ -357,11 +447,14 @@ $ mklivecd chroot
$ mklivecd iso
$ mklivecd burn
.Ed
+.Sh BUGS
+It is not perfect but at least it does its task correctly.
.Sh SEE ALSO
.Xr packages 7 ,
+.Xr mount_mfs 8 ,
.Xr mount_null 8
.Sh AUTHORS
The
.Nm
utility was written by
-.An Juan RP Aq xtraeme@NetBSD.org .
+.An Juan Romero Pardines Aq xtraeme@NetBSD.org .
diff --git a/sysutils/mklivecd/files/mklivecd.sh b/sysutils/mklivecd/files/mklivecd.sh
index 7c87a27d877..3bc311180e7 100755
--- a/sysutils/mklivecd/files/mklivecd.sh
+++ b/sysutils/mklivecd/files/mklivecd.sh
@@ -1,12 +1,12 @@
#!/bin/sh
#
-# $NetBSD: mklivecd.sh,v 1.20 2005/03/30 14:23:04 xtraeme Exp $
+# $NetBSD: mklivecd.sh,v 1.21 2005/07/29 12:13:01 xtraeme Exp $
#
# Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
-# by Juan RP.
+# by Juan Romero Pardines.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -36,9 +36,9 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-# ====================================================================== #
-# mklivecd - Build a NetBSD LiveCD! for i386 machines. #
-# ====================================================================== #
+# ======================================================================== #
+# mklivecd - Make your own NetBSD/i386 Live CD-ROM/DVD-ROM #
+# ======================================================================== #
: ${progname:=$(basename $0)}
: ${config_dir:=$HOME/.mklivecd}
@@ -49,14 +49,25 @@
: ${MKISOFS:=@LOCALBASE@/bin/mkisofs}
: ${CDRECORD:=@LOCALBASE@/bin/cdrecord}
#
+# NetBSD >= 4.0 has cdboot, no need to use grub here.
+#
+: ${CDBOOT_IMG:=cdboot}
+: ${BOOT_IMG:=boot}
+: ${CDBOOT_DIR:=/usr/mdec}
+#
# Don't modify the next ones! they are needed for booting grub.
#
-: ${MKISOFS_FIXED_ARGS:=-no-emul-boot -boot-load-size 30 -boot-info-table}
-: ${BOOTDIR:=boot/grub}
-: ${BOOTIMAGE:=stage2_eltorito}
-: ${GRUB_FILES:=stage1 stage2 stage2_eltorito iso9660_stage1_5 xfs_stage1_5 ufs2_stage1_5 reiserfs_stage1_5 jfs_stage1_5 ffs_stage1_5 fat_stage1_5 e2fs_stage1_5}
+: ${GRUB_BOOTDIR:=boot/grub}
+: ${GRUB_BOOTIMAGE:=stage2_eltorito}
+: ${GRUB_FILES:=stage1 stage2 stage2_eltorito iso9660_stage1_5 \
+ xfs_stage1_5 ufs2_stage1_5 reiserfs_stage1_5 \
+ jfs_stage1_5 ffs_stage1_5 fat_stage1_5 e2fs_stage1_5}
+#
+# Common vars for cdboot/grub.
+#
+: ${MKISOFS_FIXED_ARGS:=-no-emul-boot}
-trap "echo; showmsg \"Process cancelled!\"; bye 127" INT QUIT
+trap "echo; showmsg \"PROCESS CANCELLED!\"; bye 127" INT QUIT
# ====================================================================== #
# My functions :-) #
@@ -64,96 +75,118 @@ trap "echo; showmsg \"Process cancelled!\"; bye 127" INT QUIT
usage()
{
- cat <<_usage_
+ cat <<_usage_
- ${progname}: [-v] [-c config_file] [target]
+ ${progname}: [-v] [-c config_file] [-k kernel] [target]
Target operations:
- kernel Build and install the Boot kernel image
- iso Build the ISO 9660 image
- burn Burn the ISO image via cdrecord
- base Install the base/x11 sets into ISODIR
- chroot chroot into the livecd
- clean Clean the work directory
- config Create the default configuration file
+ base Install the base/x11 sets into ISODIR
+ burn Burn the ISO9660 image with cdrecord(1)
+ chroot Chroot into the livecd
+ clean Clean the WORKDIR and ISODIR directories
+ config Create default configuration file
+ iso Build the ISO9660 image with mkisofs(1)
+ kernel Build and install the kernel(s) and boot files
_usage_
- exit 1
+ exit 1
}
showmsg()
{
- echo "===> $@"
+ echo "===> $@"
}
-bye()
+showmsg_n()
{
- _exitarg="$1"
- rm -f $tmp_file; exit $_exitarg
+ echo -n "===> $@"
}
-do_conf()
+showmsgstring()
{
- BASE_VARS="SOURCEDIR PKGSRCDIR PKGSRCDISTDIR SHAREDIR BASEDIR WORKDIR \
- ISODIR BASE_SETS_DIR X11_SETS_DIR BASE_SETS X11_SETS \
- CHROOT_SHELL"
-
- MISC_VARS="ENABLE_X11 MKISOFS_ARGS 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 \
- MNT_PKG_SYSCONFDIR_ARGS"
-
- # Base directories/sets
- : ${SOURCEDIR:=/usr/src}
- : ${PKGSRCDIR:=/usr/pkgsrc}
- : ${PKGSRCDISTDIR:=/usr/pkgsrc/distfiles}
- : ${SHAREDIR:=@PREFIX@/share/mklivecd}
- : ${BASEDIR:=$HOME/livecd}
- : ${WORKDIR:=${BASEDIR}/work}
- : ${ISODIR:=${BASEDIR}/iso}
- : ${BASE_SETS_DIR:=$HOME/release/binary/sets}
- : ${X11_SETS_DIR:=${BASE_SETS_DIR}}
- : ${BASE_SETS:=etc.tgz base.tgz comp.tgz text.tgz}
- : ${X11_SETS:=xbase.tgz xcomp.tgz xfont.tgz xserver.tgz}
- : ${CHROOT_SHELL:=/bin/ksh}
-
- # Miscellaneous options
- : ${ENABLE_X11:=no}
- : ${MKISOFS_ARGS:=-J -R -nobak -v}
- : ${CDRECORD_ARGS:=-v}
- : ${BLANK_BEFORE_BURN:=no}
- : ${CDROM_DEVICE:=15,1,0}
- : ${PERSONAL_CONFIG:=no}
- : ${BOOTKERN:=KERN-LIVECD}
- : ${KERNEL_NAME:=MKLIVECD}
- : ${IMAGE_NAME:=NetBSD-LiveCD}
- : ${PKG_SYSCONFDIR:=usr/pkg/etc}
- : ${REMOVE_DIRS:=altroot usr/share/info}
-
- # Mount arguments
- : ${MNT_DEV_ARGS:=-o noatime -s 5m}
- : ${MNT_ETC_ARGS:=-o noatime -s 2m}
- : ${MNT_VAR_ARGS:=-o noatime -s 10m}
- : ${MNT_ROOT_ARGS:=-o noatime -s 5m}
- : ${MNT_TMP_ARGS:=-o noatime -s 10m}
- : ${MNT_HOME_ARGS:=-o noatime -s 50m}
- : ${MNT_PKG_SYSCONFDIR_ARGS:=-o noatime -s 1m}
-
- if [ ! -d $config_dir ]; then
- mkdir $config_dir
- fi
+ if [ "$?" -eq 0 ]; then
+ echo " done."
+ else
+ echo " failed."
+ fi
+}
- if [ ! -f $config_dir/$pers_conffile ]; then
- cp $SHAREDIR/$pers_conffile $config_dir
- fi
+bye()
+{
+ _exitarg="$1"
+ rm -f $tmp_file; exit $_exitarg
+}
- if [ ! -f $config_file ]; then
- cat >> $config_file <<EOF
+do_conf()
+{
+ BASE_VARS="SOURCEDIR PKGSRCDIR PKGSRCDISTDIR SHAREDIR BASEDIR WORKDIR \
+ ISODIR BASE_SETS_DIR X11_SETS_DIR BASE_SETS X11_SETS \
+ CHROOT_SHELL"
+
+ KERNEL_VARS="MULTIPLE_KERNELS BOOTKERN KERNEL_NAME"
+
+ MISC_VARS="ENABLE_X11 MKISOFS_ARGS CDRECORD_ARGS BLANK_BEFORE_BURN \
+ CDROM_DEVICE PERSONAL_CONFIG IMAGE_NAME PKG_SYSCONFDIR\
+ REMOVE_DIRS USE_GNU_GRUB GRUB_FILES_DIR HOSTNAME"
+
+ MNT_VARS="MNT_ETC_ARGS MNT_VAR_ARGS MNT_ROOT_ARGS \
+ MNT_TMP_ARGS MNT_HOME_ARGS MNT_PKG_SYSCONFDIR_ARGS \
+ MNT_DEV_ARGS"
+
+ # Base directories/sets
+ : ${SOURCEDIR:=/usr/src}
+ : ${PKGSRCDIR:=/usr/pkgsrc}
+ : ${PKGSRCDISTDIR:=/usr/pkgsrc/distfiles}
+ : ${SHAREDIR:=@PREFIX@/share/mklivecd}
+ : ${BASEDIR:=$HOME/livecd}
+ : ${WORKDIR:=${BASEDIR}/work}
+ : ${ISODIR:=${BASEDIR}/iso}
+ : ${BASE_SETS_DIR:=$HOME/release/binary/sets}
+ : ${X11_SETS_DIR:=${BASE_SETS_DIR}}
+ : ${BASE_SETS:=etc.tgz base.tgz comp.tgz text.tgz}
+ : ${X11_SETS:=xbase.tgz xcomp.tgz xfont.tgz xserver.tgz}
+ : ${CHROOT_SHELL:=/bin/ksh}
+ : ${HOSTNAME:=MKLIVECD_0x00}
+
+ # kernel options
+ : ${MULTIPLE_KERNELS:=no}
+ : ${BOOTKERN:=KERN-LIVECD}
+ : ${KERNEL_NAME:=MKLIVECD}
+
+ # Miscellaneous options
+ : ${ENABLE_X11:=no}
+ : ${MKISOFS_ARGS:=-J -R -nobak -v}
+ : ${CDRECORD_ARGS:=-v}
+ : ${BLANK_BEFORE_BURN:=no}
+ : ${CDROM_DEVICE:=15,1,0}
+ : ${PERSONAL_CONFIG:=no}
+ : ${IMAGE_NAME:=NetBSD-LiveCD}
+ : ${PKG_SYSCONFDIR:=usr/pkg/etc}
+ : ${REMOVE_DIRS:=altroot usr/share/info}
+ : ${USE_GNU_GRUB:=yes}
+ : ${GRUB_FILES_DIR:=@LOCALBASE@/lib/grub/@MACHINE_ARCH@-}
+ #
+ # Mount arguments
+ #
+ # Best value for /dev, there are >512 inodes free and some Kbytes free too.
+ # I don't recommend changing this!
+ : ${MNT_DEV_ARGS:=-o noatime -s 512k -i 64}
+ : ${MNT_ETC_ARGS:=-o noatime -s 2m}
+ : ${MNT_VAR_ARGS:=-o noatime -s 10m}
+ : ${MNT_ROOT_ARGS:=-o noatime -s 5m}
+ : ${MNT_TMP_ARGS:=-o noatime -s 10m}
+ : ${MNT_HOME_ARGS:=-o noatime -s 50m}
+ : ${MNT_PKG_SYSCONFDIR_ARGS:=-o noatime -s 1m}
+
+ [ ! -d $config_dir ] && mkdir $config_dir
+
+ [ ! -f $config_dir/$pers_conffile ] && \
+ cp $SHAREDIR/$pers_conffile $config_dir
+
+ if [ ! -f $config_file ]; then
+ cat >> $config_file <<EOF
# --*-sh-*--
#
# mklivecd - configuration file
@@ -162,81 +195,228 @@ do_conf()
# Generated automatically on $(date).
EOF
- echo "# Base directories/options" >> $config_file
- for var in $(echo $BASE_VARS | tr ' ' '\n')
- do
- eval val=\""\$$var"\"
- echo "$var=\"$val\"" >> $config_file
- done
- echo >> $config_file
-
- echo "# Miscellaneous options" >> $config_file
- for var in $(echo $MISC_VARS | tr ' ' '\n')
- do
- eval val=\""\$$var"\"
- echo "$var=\"$val\"" >> $config_file
- done
- echo >> $config_file
+ echo "# Base directories/options" >> $config_file
+ for var in $(echo $BASE_VARS | tr ' ' '\n' | sort -u)
+ do
+ eval val=\""\$$var"\"
+ echo "$var=\"$val\"" >> $config_file
+ done
+ echo >> $config_file
- echo "# Mount arguments" >> $config_file
- for var in $(echo $MNT_VARS | tr ' ' '\n')
- do
- eval val=\""\$$var"\"
- echo "$var=\"$val\"" >> $config_file
- done
- echo >> $config_file
+ echo "# kernel options" >> $config_file
+ for var in $(echo $KERNEL_VARS | tr ' ' '\n' | sort -u)
+ do
+ eval val=\""\$$var"\"
+ echo "$var=\"$val\"" >> $config_file
+ done
+ echo >> $config_file
+ ( \
+ echo "# MULTIPLE_KERNELS example:"; \
+ echo "#"; \
+ echo "# MULTIPLE_KERNELS=\"ACPI APM\""; \
+ echo "# BOOTKERN_ACPI=\"KERN_ACPI\""; \
+ echo "# KERNEL_NAME_ACPI=\"LIVECD_ACPI\""; \
+ echo "# BOOTKERN_APM=\"KERN_APM\""; \
+ echo "# KERNEL_NAME_APM=\"LIVECD_APM\""; \
+ ) >> $config_file
+ echo >> $config_file
+
+ echo "# Miscellaneous options" >> $config_file
+ for var in $(echo $MISC_VARS | tr ' ' '\n' | sort -u)
+ do
+ eval val=\""\$$var"\"
+ echo "$var=\"$val\"" >> $config_file
+ done
+ echo >> $config_file
- echo "=> Configuration file created, now please edit it."
- echo "=> Path: $config_file"
- elif [ -f $config_file -a $target != "config" ]; then
- if [ "$verbose_mode" = "on" ]; then
- showmsg "Using $config_file"
- fi
- else
- showmsg "$config_file already exists!"
- bye 1
- fi
+ echo "# Mount arguments" >> $config_file
+ for var in $(echo $MNT_VARS | tr ' ' '\n' | sort -u)
+ do
+ eval val=\""\$$var"\"
+ echo "$var=\"$val\"" >> $config_file
+ done
+ echo >> $config_file
+
+ echo "=> Configuration file created, now please edit it."
+ echo "=> Path: $config_file"
+ elif [ -f $config_file -a $target != "config" ]; then
+ [ -n "$verbose_mode" ] && showmsg "Using $config_file"
+ else
+ showmsg "$config_file already exists!"
+ bye 1
+ fi
}
do_conf_reset()
{
- for F in ${BASE_VARS} ${MISC_VARS} ${MNT_VARS}
- do
- eval $F=\"\"
- done
+ for F in ${BASE_VARS} ${MISC_VARS} ${MNT_VARS}
+ do
+ eval $F=\"\"
+ done
}
-do_cdlive()
+copy_bootfiles()
{
- . $config_file
+ if [ "$USE_GNU_GRUB" = "yes" ]; then
+ # GNU Grub selected.
+ [ ! -d $ISODIR/$GRUB_BOOTDIR ] && mkdir -p $ISODIR/$GRUB_BOOTDIR
+ for f in $GRUB_FILES
+ do
+ if [ ! -f $ISODIR/$GRUB_BOOTDIR/$f ]; then
+ if [ -f $GRUB_FILES_DIR/$f ]; then
+ cp $GRUB_FILES_DIR/$f $ISODIR/$GRUB_BOOTDIR
+ [ -n "$verbose_mode" ] && \
+ showmsg "Copying $f into $ISODIR/$GRUB_BOOTDIR"
+ else
+ echo "=> File $f not found!"
+ fi
+ else
+ echo "=> Not copying $f, already exists."
+ fi
+ done
+ else
+ # We are using cdboot.
+ if [ -f ${CDBOOT_DIR}/${CDBOOT_IMG} ]; then
+ cp -f ${CDBOOT_DIR}/${CDBOOT_IMG} $ISODIR
+ else
+ echo "=> Missing cdboot... exiting."
+ bye 1
+ fi
+
+ if [ -f ${CDBOOT_DIR}/${BOOT_IMG} ]; then
+ cp -f ${CDBOOT_DIR}/${BOOT_IMG} $ISODIR
+ else
+ echo "=> Missing boot... exiting."
+ fi
+ fi
+}
- vars="$BASEDIR $ISODIR $WORKDIR"
+do_menu_lst()
+{
+ [ -n "$verbose_mode" ] && \
+ showmsg_n "Creating $ISODIR/$GRUB_BOOTDIR/menu.lst..."
+ if [ ! -f $ISODIR/$GRUB_BOOTDIR/menu.lst ]; then
+ cat > $ISODIR/$GRUB_BOOTDIR/menu.lst << _EOF_
+# Default GRUB menu file created by ${progname}.
+# Date: $(date).
- for value in $vars
- do
- if [ ! -d $value ]; then
- mkdir -p $value
- fi
- done
+default 0
+timeout 10
- case "$1" in
- kernel)
- if [ ! -d $SOURCEDIR/sys ]; then
- showmsg "Can't find NetBSD sources, exiting!"
- bye 1
+title NetBSD/$KERNEL_NAME kernel
+kernel --type=netbsd /$GRUB_BOOTDIR/$BOOTKERN.gz
+
+_EOF_
+ showmsgstring
+ fi
+}
+
+do_build_kernels()
+{
+ . $config_file
+
+ for K in ${MULTIPLE_KERNELS}
+ do
+ eval bootkern=\$BOOTKERN_${K}
+ eval kernname=\$KERNEL_NAME_${K}
+
+ cd $WORKDIR
+ showmsg "Building kernel: $bootkern.."
+
+ [ -s $config_dir/$bootkern ] && \
+ cp $config_dir/$bootkern $WORKDIR
+
+ if [ ! -d $WORKDIR/$kernname ]; then
+ mkdir $WORKDIR/$kernname
+ fi
+
+ if [ ! -d $WORKDIR/$kernname -a ! -f $bootkern ]; then
+ showmsg "Missing files... exiting."
+ bye 1
+ fi
+
+ config -s $SOURCEDIR/sys -b $WORKDIR/$kernname $bootkern
+ cd $kernname
+ make depend
+ make COPTS="-Os" # Don't use additional flags
+ if [ "$?" -eq 0 ]; then
+ if [ "$USE_GNU_GRUB" = "yes" ]; then
+ cp $WORKDIR/$kernname/netbsd $ISODIR/$GRUB_BOOTDIR/$bootkern
+ else
+ # We are using cdboot.
+ cp $WORKDIR/$kernname/netbsd $ISODIR/$bootkern
+ fi
+ [ -n "$verbose_mode" ] && \
+ showmsg_n "Compressing kernel $bootkern..."
+ if [ "$USE_GNU_GRUB" = "yes" ]; then
+ gzip $ISODIR/$GRUB_BOOTDIR/$bootkern
+ showmsgstring
+ if [ -f $ISODIR/$GRUB_BOOTDIR/menu.lst ]; then
+ showmsg_n "Updating menu.lst..."
+ ( \
+ echo "title NetBSD/$kernname kernel"; \
+ echo "kernel --type=netbsd /$GRUB_BOOTDIR/$bootkern.gz"; \
+ echo; \
+ ) >> $ISODIR/$GRUB_BOOTDIR/menu.lst
+ else
+ showmsg_n "Creating grub menu.lst..."
+ cat >> $ISODIR/$GRUB_BOOTDIR/menu.lst << _EOF_
+# Default GRUB menu file created by ${progname}.
+# Date: $(date).
+
+default 0
+timeout 10
+
+title NetBSD/$kernname kernel
+kernel --type=netbsd /$GRUB_BOOTDIR/$bootkern.gz
+
+_EOF_
fi
+ showmsgstring
+ else
+ gzip $ISODIR/$bootkern
+ showmsgstring
+ fi
+ else
+ echo "=> kernel compilation failed! ($kernname)"
+ bye 1
+ fi
+ done
+}
- showmsg "Building boot image on $(date)"
- echo
- showmsg "Using the following values:"
- showmsg " SHAREDIR=$SHAREDIR"
- showmsg " WORKDIR=$WORKDIR"
- showmsg " ISODIR=$ISODIR"
- showmsg " BASEDIR=$BASEDIR"
+do_cdlive()
+{
+ . $config_file
+
+ vars="$BASEDIR $ISODIR $WORKDIR"
+
+ for value in $vars
+ do
+ [ ! -d $value ] && mkdir -p $value
+ done
+
+ case "$1" in
+ kernel)
+ if [ ! -d $SOURCEDIR/sys ]; then
+ echo "=> CANNOT FIND NETBSD SOURCES, EXITING!"
+ bye 1
+ fi
+
+ # if -k was specified, override values on config file.
+ if [ -n "$K_ARG_SET" ]; then
+ BOOTKERN=$kernel_arg
+ KERNEL_NAME=MKLIVECD_$kernel_arg
+ fi
+
+ if [ "$MULTIPLE_KERNELS" = "no" ]; then
+ showmsg "Building kernel on $(date):"
+ if [ -n "$verbose_mode" ]; then
+ echo
showmsg "Using kernel: $BOOTKERN"
showmsg "Kernel name: $KERNEL_NAME"
- echo
sleep 2
+ fi
+ echo
# if there's a kernel in ~/.mklivecd, use it, otherwise
# use the default one located in SHAREDIR.
if [ -s $config_dir/$BOOTKERN ]; then
@@ -246,135 +426,132 @@ do_cdlive()
fi
cd $WORKDIR
- [ ! -d $WORKDIR/$KERNEL_NAME ] && mkdir $WORKDIR/$KERNEL_NAME
- config -s $SOURCEDIR/sys -b $WORKDIR/$KERNEL_NAME \
- $BOOTKERN
+ [ ! -d $WORKDIR/$KERNEL_NAME ] && \
+ mkdir $WORKDIR/$KERNEL_NAME
+ config -s $SOURCEDIR/sys -b $WORKDIR/$KERNEL_NAME \
+ $BOOTKERN
cd $KERNEL_NAME
make depend
- make COPTS="-Os" # Don't use additional flags
- if [ $? -eq 0 ]; then
- [ ! -d $ISODIR/$BOOTDIR ] && mkdir -p $ISODIR/$BOOTDIR
- for f in $GRUB_FILES
- do
- if [ ! -f $ISODIR/$BOOTDIR/$f ]; then
- cp @PREFIX@/lib/grub/@MACHINE_ARCH@-/$f \
- $ISODIR/$BOOTDIR
- [ "$verbose_mode" = "on" ] && \
- showmsg "Copying $f into $ISODIR/$BOOTDIR."
- else
- showmsg "Not copying $f, already exists."
- fi
- done
- cp $WORKDIR/$KERNEL_NAME/netbsd $ISODIR/$BOOTDIR/$BOOTKERN
- [ "$verbose_mode" = "on" ] && \
- showmsg "Compressing kernel $BOOTKERN..."
-
- gzip $ISODIR/$BOOTDIR/$BOOTKERN
-
- [ "$verbose_mode" = "on" ] && \
- showmsg "Creating $ISODIR/$BOOTDIR/menu.lst..."
-
- if [ ! -f $ISODIR/$BOOTDIR/menu.lst ]; then
- cat > $ISODIR/$BOOTDIR/menu.lst << _EOF_
-# Default GRUB menu file created by ${progname}.
-# Date: $(date).
-
-default 0
-timeout 10
-
-title NetBSD/$BOOTKERN kernel
-kernel --type=netbsd /$BOOTDIR/$BOOTKERN.gz
-
-_EOF_
- fi
-
- if [ $? -eq 0 ]; then
- showmsg "Boot/kernel files installed!"
- showmsg "Next step: ${progname} base"
- make clean >/dev/null 2>&1
- rm -rf $KERNEL_NAME
+ make COPTS="-Os" # Don't use additional flags
+ if [ "$?" -eq 0 ]; then
+ copy_bootfiles
+ showmsg_n "Compressing kernel $BOOTKERN..."
+ if [ "$USE_GNU_GRUB" = "yes" ]; then
+ cp $WORKDIR/$KERNEL_NAME/netbsd \
+ $ISODIR/$GRUB_BOOTDIR/$BOOTKERN
+ gzip -9 $ISODIR/$GRUB_BOOTDIR/$BOOTKERN
+ showmsgstring
+ else
+ if [ -f $ISODIR/netbsd ]; then
+ #
+ # ISO9660 specifies that ISO Level 1 cannot handle
+ # filenames with > 8 characters... actually the
+ # cd9660.c standalone file-system for the bootloader
+ # does not support ISO Level 2/3.
+ #
+ # Note too that '-' is not an allowed character, so
+ # is better to use a dot '.' .
+ #
+ # I'll change this when cd9660.c is fixed.
+ #
+ cp $WORKDIR/$KERNEL_NAME/netbsd \
+ $ISODIR/k.$BOOTKERN
+ gzip -9 $ISODIR/k.$BOOTKERN
+ mv $ISODIR/k.$BOOTKERN.gz \
+ $ISODIR/k.$BOOTKERN
+ else
+ cp $WORKDIR/$KERNEL_NAME/netbsd $ISODIR
+ gzip -9 $ISODIR/netbsd
+ mv $ISODIR/netbsd.gz $ISODIR/netbsd
+ fi
+ showmsgstring
+ fi
+ if [ "$?" -eq 0 ]; then
+ [ "$USE_GNU_GRUB" = "yes" ] && do_menu_lst
+ [ -n "$verbose_mode" ] && \
+ echo "=> NEXT STEP: ${progname} base"
else
- showmsg "Couldn't install the kernel."
+ echo "=> COULDN'T INSTALL THE KERNEL(S)"
fi
else
echo
- showmsg "kernel build failed."
- showmsg "Boot/kernel files were not installed!"
+ showmsg "Target kernel failed."
+ bye 1
fi
+ else
+ copy_bootfiles
+ do_build_kernels
+ fi
;;
- base)
- for F in ${BASE_SETS}
- do
- if [ ! -f $BASE_SETS_DIR/$F ]; then
- showmsg "Target base failed!"
- showmsg "Can't find $F, exiting."
- bye 1
- fi
- done
+ base)
+ for F in ${BASE_SETS}
+ do
+ if [ ! -f $BASE_SETS_DIR/$F ]; then
+ showmsg "Cannot find $F, exiting."
+ bye 1
+ fi
+ done
- showmsg "Installing base sets"
- for S in ${BASE_SETS}
+ showmsg "Installing base sets:"
+ for S in ${BASE_SETS}
+ do
+ if [ -f $BASE_SETS_DIR/$S ]; then
+ echo -n "=> Unpacking $S..."
+ @TAR@ xfzp $BASE_SETS_DIR/$S -C $ISODIR
+ showmsgstring
+ fi
+ done
+
+ if [ "${ENABLE_X11}" = "yes" ]; then
+ for FX in ${X11_SETS}
+ do
+ if [ ! -f $X11_SETS_DIR/$FX ]; then
+ showmsg "Can't find $FX, disabling X11."
+ DISABLE_X11=yes
+ break
+ fi
+ done
+ if [ "$DISABLE_X11" = "" ]; then
+ showmsg "Installing X11 sets:"
+ for X in ${X11_SETS}
do
- if [ -f $BASE_SETS_DIR/$S ]; then
- if [ "$verbose_mode" = "on" ]; then
- echo "=> Unpacking $S"
- fi
- @TAR@ xfzp $BASE_SETS_DIR/$S -C $ISODIR
- fi
+ if [ -f $X11_SETS_DIR/$X ]; then
+ echo -n "=> Unpacking $X..."
+ @TAR@ xfzp $X11_SETS_DIR/$X -C $ISODIR
+ showmsgstring
+ fi
done
-
- if [ "${ENABLE_X11}" = "yes" ]; then
- for FX in ${X11_SETS}
- do
- if [ ! -f $X11_SETS_DIR/$FX ]; then
- showmsg "Can't find $FX, disabling X11."
- DISABLE_X11=yes
- break
- fi
- done
-
- if [ "$DISABLE_X11" = "" ]; then
- showmsg "Installing X11 sets"
- for X in ${X11_SETS}
- do
- if [ -f $X11_SETS_DIR/$X ]; then
- if [ "$verbose_mode" = "on" ]; then
- echo "=> Unpacking $X"
- fi
- @TAR@ xfzp $X11_SETS_DIR/$X -C $ISODIR
- fi
- done
- fi
- fi # ENABLE_X11
+ fi
+ fi # ENABLE_X11
- cp $SHAREDIR/mfs_rcd $ISODIR/etc/rc.d
-
- # /etc/rc.conf
- showmsg "Installing configuration files"
- sed -e "s,rc_configured=NO,rc_configured=YES,g" \
- $ISODIR/etc/rc.conf > $ISODIR/etc/rc.conf.fixed
- mv $ISODIR/etc/rc.conf.fixed $ISODIR/etc/rc.conf
- touch $ISODIR/etc/fstab
-
- ( \
- echo "mfsrc=yes"; \
- echo "dhclient=yes dhclient_flags=-q"; \
- echo "wscons=yes"; \
- echo "hostname=$KERNEL_NAME"; \
- echo "nfs_client=yes"; \
- echo "inetd=no"; \
- echo "ntpdate=yes"; \
- echo "savecore=no"; \
- ) >> $ISODIR/etc/rc.conf
-
- # /etc/rc.d/root could umount the mfs directories,
- # so it's best not to touch them.
-
- rm $ISODIR/etc/rc.d/root
- cat > $ISODIR/etc/rc.d/root <<_EOF_
+ cp $SHAREDIR/mfs_rcd $ISODIR/etc/rc.d
+
+ # /etc/rc.conf
+ showmsg_n "Installing configuration files..."
+ sed -e "s,rc_configured=NO,rc_configured=YES,g" \
+ $ISODIR/etc/rc.conf > $ISODIR/etc/rc.conf.fixed
+ mv $ISODIR/etc/rc.conf.fixed $ISODIR/etc/rc.conf
+ touch $ISODIR/etc/fstab
+
+ ( \
+ echo "mfsrc=yes"; \
+ echo "dhclient=yes dhclient_flags=-q"; \
+ echo "wscons=yes"; \
+ echo "hostname=$HOSTNAME"; \
+ echo "nfs_client=yes"; \
+ echo "inetd=no"; \
+ echo "ntpdate=yes"; \
+ echo "savecore=no"; \
+ ) >> $ISODIR/etc/rc.conf
+
+ # /etc/rc.d/root could umount the mfs directories,
+ # so it's best not to touch them.
+
+ rm $ISODIR/etc/rc.d/root
+ cat > $ISODIR/etc/rc.d/root <<_EOF_
#!/bin/sh
#
-# \$NetBSD: mklivecd.sh,v 1.20 2005/03/30 14:23:04 xtraeme Exp $
+# \$NetBSD: mklivecd.sh,v 1.21 2005/07/29 12:13:01 xtraeme Exp $
#
# PROVIDE: root
@@ -394,367 +571,368 @@ root_start()
load_rc_config \$name
run_rc_command "\$1"
_EOF_
- # Make sure the devices are created before creating
- # the .tgz files.
-
- showmsg "Creating devices"
- cd $ISODIR/dev && ./MAKEDEV all
- echo
- showmsg "Target base successful"
- if [ "$verbose_mode" = "on" ]; then
- showmsg "Base system installed"
- showmsg "Next step: ${progname} chroot"
- fi
- ;;
- chroot)
- if [ ! -f $ISODIR/etc/profile ]; then
- ( \
- echo "export PS1=\"$KERNEL_NAME> \""; \
- echo "set -o emacs"; \
- ) > $ISODIR/etc/profile
- else
- if [ "$verbose_mode" = "on" ]; then
- showmsg "Not overwriting /etc/profile."
- fi
- fi
-
- if [ ! -d $ISODIR/usr/pkgsrc/distfiles ]; then
- mkdir -p $ISODIR/usr/pkgsrc/distfiles
- fi
-
- if [ ! -f $ISODIR/usr/share/misc/termcap ]; then
- cp /usr/share/misc/termcap* \
- $ISODIR/usr/share/misc
- fi
-
- showmsg "Entering into the chroot!"
+ showmsgstring
+ # Make sure the devices are created before creating
+ # the .tgz files.
+
+ showmsg_n "Creating devices..."
+ cd $ISODIR/dev && ./MAKEDEV all
+ showmsgstring
+ showmsg "Target base finished."
+ [ -n "$verbose_mode" ] && \
+ echo "=> NEXT STEP: ${progname} chroot"
+ ;;
+ chroot)
+ if [ ! -f $ISODIR/etc/profile ]; then
+ ( \
+ echo "export PS1=\"$KERNEL_NAME> \""; \
+ echo "set -o emacs"; \
+ ) > $ISODIR/etc/profile
+ else
+ [ -n "$verbose_mode" ] && \
+ showmsg "Not overwriting /etc/profile."
+ fi
- if [ -d $PKGSRCDIR ]; then
- if [ -f $pkgsrc_mntstat ]; then
- count=$(cat $pkgsrc_mntstat)
- count=$(($count + 1))
- echo $count > $pkgsrc_mntstat
- showmsg "pkgsrc directory already mounted."
- else
- showmsg "pkgsrc directory ready."
- echo "1" > $pkgsrc_mntstat
- mount_null $PKGSRCDIR $ISODIR/usr/pkgsrc
- fi
- else
- showmsg "Can't find $PKGSRCDIR, disabling it."
- fi
+ [ ! -d $ISODIR/usr/pkgsrc/distfiles ] && \
+ mkdir -p $ISODIR/usr/pkgsrc/distfiles
+
+ [ ! -f $ISODIR/usr/share/misc/termcap ] && \
+ cp /usr/share/misc/termcap* $ISODIR/usr/share/misc
+
+ showmsg "Entering into the chroot!"
+
+ if [ -d $PKGSRCDIR ]; then
+ if [ -f $pkgsrc_mntstat ]; then
+ count=$(cat $pkgsrc_mntstat)
+ count=$(($count + 1))
+ echo $count > $pkgsrc_mntstat
+ echo "=> pkgsrc directory already mounted."
+ else
+ echo "=> pkgsrc directory ready."
+ echo "1" > $pkgsrc_mntstat
+ mount_null $PKGSRCDIR $ISODIR/usr/pkgsrc
+ fi
+ else
+ showmsg "==> CANNOT FIND $PKGSRCDIR"
+ fi
- if [ -d $PKGSRCDISTDIR ]; then
- if [ -f $pkgsrcdist_mntstat ]; then
- count=$(cat $pkgsrcdist_mntstat)
- count=$(($count +1))
- echo $count > $pkgsrcdist_mntstat
- showmsg "distfiles directory already mounted."
- else
- showmsg "distfiles directory ready."
- echo "1" > $pkgsrcdist_mntstat
- mount_null $PKGSRCDISTDIR $ISODIR/usr/pkgsrc/distfiles
- fi
- else
- showmsg "Can't find $PKGSRCDISTDIR, disabling it."
- fi
+ if [ -d $PKGSRCDISTDIR ]; then
+ if [ -f $pkgsrcdist_mntstat ]; then
+ count=$(cat $pkgsrcdist_mntstat)
+ count=$(($count +1))
+ echo $count > $pkgsrcdist_mntstat
+ echo "=> distfiles directory already mounted."
+ else
+ echo "=> distfiles directory ready."
+ echo "1" > $pkgsrcdist_mntstat
+ mount_null $PKGSRCDISTDIR $ISODIR/usr/pkgsrc/distfiles
+ fi
+ else
+ echo "==> CANNOT FIND $PKGSRCDISTDIR"
+ fi
- echo
- chroot $ISODIR $CHROOT_SHELL
- echo
+ echo
+ chroot $ISODIR $CHROOT_SHELL
+ echo
- if [ ! -d $ISODIR/root ]; then
- showmsg "Target chroot failed!"
- showmsg "Can't find root directory, exiting."
- bye 1
- fi
+ if [ ! -d $ISODIR/root ]; then
+ showmsg "Cannot find root directory, exiting."
+ bye 1
+ fi
- cd $ISODIR
- cp -f $SHAREDIR/mfs_rcd $ISODIR/etc/rc.d
-
- SUBST_H="mount_mfs $MNT_HOME_ARGS swap /home"
- SUBST_HT="@TAR@ xfzp /stand/mfs_home.tgz -C /"
- SUBST_S="mount_mfs $MNT_PKG_SYSCONFDIR_ARGS swap /$PKG_SYSCONFDIR"
- SUBST_ST="@TAR@ xfzp /stand/mfs_pkg_sysconfdir.tgz -C /"
-
- sed -e "s,@MNT_DEV_ARGS@,$MNT_DEV_ARGS,g" \
- -e "s,@MNT_ETC_ARGS@,$MNT_ETC_ARGS,g" \
- -e "s,@MNT_VAR_ARGS@,$MNT_VAR_ARGS,g" \
- -e "s,@MNT_ROOT_ARGS@,$MNT_ROOT_ARGS,g" \
- -e "s,@MNT_TMP_ARGS@,$MNT_TMP_ARGS,g" \
- $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.in
- mv $ISODIR/etc/rc.d/mfs_rcd.in $ISODIR/etc/rc.d/mfs_rcd
+ cd $ISODIR
+ cp -f $SHAREDIR/mfs_rcd $ISODIR/etc/rc.d
+
+ SUBST_H="mount_mfs $MNT_HOME_ARGS swap /home"
+ SUBST_HT="@TAR@ xfzp /stand/mfs_home.tgz -C /"
+ SUBST_S="mount_mfs $MNT_PKG_SYSCONFDIR_ARGS swap /$PKG_SYSCONFDIR"
+ SUBST_ST="@TAR@ xfzp /stand/mfs_pkg_sysconfdir.tgz -C /"
+
+ sed -e "s|@MNT_ETC_ARGS@|$MNT_ETC_ARGS|g" \
+ -e "s|@MNT_DEV_ARGS@|$MNT_DEV_ARGS|g" \
+ -e "s|@MNT_VAR_ARGS@|$MNT_VAR_ARGS|g" \
+ -e "s|@MNT_ROOT_ARGS@|$MNT_ROOT_ARGS|g" \
+ -e "s|@MNT_TMP_ARGS@|$MNT_TMP_ARGS|g" \
+ $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.in
+ mv $ISODIR/etc/rc.d/mfs_rcd.in $ISODIR/etc/rc.d/mfs_rcd
- for U in root var dev etc home
- do
- if [ -d $ISODIR/$U ]; then
- @TAR@ cfzp $ISODIR/stand/mfs_$U.tgz $U >/dev/null 2>&1
- showmsg "Creating /stand/mfs_$U.tgz"
- fi
- done
+ for U in root var dev etc home
+ do
+ if [ -d $ISODIR/$U ]; then
+ showmsg_n "Creating /stand/mfs_$U.tgz..."
+ @TAR@ cfzp $ISODIR/stand/mfs_$U.tgz $U >/dev/null 2>&1
+ showmsgstring
+ fi
+ done
- if [ -d $ISODIR/home ]; then
- sed -e "s,@HOME@,$SUBST_H," \
- -e "s,@HOMETAR@,$SUBST_HT," \
- $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
- mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
- else
- sed -e "s,@HOME@,," -e "s,@HOMETAR@,," \
- $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
- mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
- fi
+ if [ -d $ISODIR/home ]; then
+ sed -e "s|@HOME@|$SUBST_H|" -e "s|@HOMETAR@|$SUBST_HT|" \
+ $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
+ mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
+ else
+ sed -e "s|@HOME@||" -e "s|@HOMETAR@||" \
+ $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
+ mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
+ fi
- if [ -d $ISODIR/$PKG_SYSCONFDIR ]; then
- @TAR@ cfzp $ISODIR/stand/mfs_pkg_sysconfdir.tgz \
- $PKG_SYSCONFDIR >/dev/null 2>&1
- showmsg "Creating /stand/mfs_pkg_sysconfdir.tgz"
- sed -e "s,@USRPKGETC@,$SUBST_S," \
- -e "s,@USRPKGETCTAR@,$SUBST_ST," \
- $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
- mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
- else
- sed -e "s,@USRPKGETC@,," -e "s,@USRPKGETCTAR@,," \
- $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
- mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
- fi
+ if [ -d $ISODIR/$PKG_SYSCONFDIR ]; then
+ showmsg_n "Creating /stand/mfs_pkg_sysconfdir.tgz..."
+ @TAR@ cfzp $ISODIR/stand/mfs_pkg_sysconfdir.tgz \
+ $PKG_SYSCONFDIR >/dev/null 2>&1
+ showmsgstring
+ sed -e "s|@USRPKGETC@|$SUBST_S|" -e "s|@USRPKGETCTAR@|$SUBST_ST|" \
+ $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
+ mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
+ else
+ sed -e "s|@USRPKGETC@||" -e "s|@USRPKGETCTAR@||" \
+ $ISODIR/etc/rc.d/mfs_rcd > $ISODIR/etc/rc.d/mfs_rcd.f
+ mv $ISODIR/etc/rc.d/mfs_rcd.f $ISODIR/etc/rc.d/mfs_rcd
+ fi
- if [ "${ENABLE_X11}" = "yes" ]; then
- if [ -f /etc/X11/XF86Config ]; then
- cp /etc/X11/XF86Config $ISODIR/etc/X11
- fi
- fi
+ if [ "${ENABLE_X11}" = "yes" ]; then
+ [ -f /etc/X11/XF86Config ] && \
+ cp /etc/X11/XF86Config $ISODIR/etc/X11
+ fi
- 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
- echo
- showmsg "Can't find the personal configuration file."
- showmsg "Skipping it..."
- echo
+ if [ "${PERSONAL_CONFIG}" = "yes" ]; then
+ if [ -f $config_dir/$pers_conffile ]; then
+ echo
+ showmsg_n "Running personal config file..."
+ . $config_dir/$pers_conffile
+ showmsgstring
+ echo
+ elif [ "${PERSONAL_CONFIG}" = "yes" ]; then
+ if [ ! -f $config_dir/$pers_conffile ]; then
+ echo
+ echo "==> CANNOT FIND PERSONAL CONFIGURATION FILE"
+ echo
+ bye 1
else
- continue
+ continue
fi
+ fi
+ fi
- # Make sure mfs_rcd has the right permissions, because
- # it could be critical!.
+ # Make sure mfs_rcd has the right permissions, because
+ # it could be critical!.
- chmod -R a+rx $ISODIR/etc/rc.d
+ chmod -R a+rx $ISODIR/etc/rc.d
- if [ ! -f $pkgsrcdist_mntstat ]; then
- showmsg "distfiles directory was not mounted."
+ if [ ! -f $pkgsrcdist_mntstat ]; then
+ showmsg "distfiles directory was not mounted."
+ else
+ cnt=$(cat $pkgsrcdist_mntstat)
+ if [ "$cnt" -gt 1 ]; then
+ cnt=$(($cnt - 1))
+ echo $cnt > $pkgsrcdist_mntstat
+ [ -n "$verbose_mode" ] && \
+ echo "=> distfiles directory still in use by mklivecd."
+ else
+ [ -n "$verbose_mode" ] && \
+ echo "=> Unmounting distfiles directory."
+ umount -R $ISODIR/usr/pkgsrc/distfiles
+ if [ $? -eq 0 ]; then
+ rm $pkgsrcdist_mntstat
else
- cnt=$(cat $pkgsrcdist_mntstat)
- if [ "$cnt" -gt 1 ]; then
- cnt=$(($cnt - 1))
- echo $cnt > $pkgsrcdist_mntstat
- showmsg "distfiles directory still in use by mklivecd."
- else
- showmsg "Unmounting distfiles directory."
- umount -R $ISODIR/usr/pkgsrc/distfiles
- if [ $? -eq 0 ]; then
- rm $pkgsrcdist_mntstat
- else
- echo "Can't umount $PKGSRCDISTDIR."
- fi
- fi
+ echo "Can't umount $PKGSRCDISTDIR."
fi
+ fi
+ fi
- if [ ! -f $pkgsrc_mntstat ]; then
- showmsg "pkgsrc directory was not mounted."
+ if [ ! -f $pkgsrc_mntstat ]; then
+ showmsg "pkgsrc directory was not mounted."
+ else
+ cnt=$(cat $pkgsrc_mntstat)
+ if [ "$cnt" -gt 1 ]; then
+ cnt=$(($cnt - 1))
+ echo $cnt > $pkgsrc_mntstat
+ echo "=> pkgsrc directory still in use by mklivecd."
+ else
+ [ -n "$verbose_mode" ] && \
+ echo "=> Unmounting pkgsrc directory."
+ umount -R $ISODIR/usr/pkgsrc
+ if [ $? -eq 0 ]; then
+ rm $pkgsrc_mntstat
else
- cnt=$(cat $pkgsrc_mntstat)
- if [ "$cnt" -gt 1 ]; then
- cnt=$(($cnt - 1))
- echo $cnt > $pkgsrc_mntstat
- showmsg "pkgsrc directory still in use by mklivecd."
- else
- showmsg "Unmounting pkgsrc directory."
- umount -R $ISODIR/usr/pkgsrc
- if [ $? -eq 0 ]; then
- rm $pkgsrc_mntstat
- else
- echo "Can't umount $PKGSRCDIR."
- fi
- fi
+ echo "Can't umount $PKGSRCDIR."
fi
+ fi
+ fi
- if [ "$verbose_mode" = "on" ]; then
- showmsg "Size: $(du -sh $ISODIR)"
- fi
- ;;
- clean)
- if [ -f $pkgsrc_mntstat -o -f $pkgsrcdist_mntstat ]; then
- showmsg "The pkgsrc directories still in use! Exiting."
- bye 1
- fi
- showmsg "Cleaning WORKDIR: $WORKDIR"
- rm -rf $WORKDIR
- for F in bin dev etc lib libexec mnt rescue \
- root tmp usr var sbin home
- do
- if [ -d $ISODIR/$F ]; then
- if [ "$verbose_mode" = "on" ]; then
- showmsg "Removing $ISODIR/$F."
- fi
- rm -rf $ISODIR/$F
- fi
- done
- showmsg "Done."
- ;;
- iso)
- _do_real_iso_image()
- {
- if [ "$verbose_mode" = "on" ]; then
- echo "=> Removing $IMAGE_NAME.iso..."
- fi
-
- [ -f "$BASEDIR/$IMAGE_NAME.iso" ] && rm $BASEDIR/$IMAGE_NAME.iso
- [ -d $ISODIR/$BOOTDIR ] && chown -R root:wheel $ISODIR/$BOOTDIR
-
- if [ ! -f $ISODIR/stand/mfs_etc.tgz ]; then
- showmsg "Target iso failed!"
- showmsg "Can't find mfs_etc.tgz file."
- bye 1
- fi
- showmsg "Removing not needed directories."
- for RM in ${REMOVE_DIRS}
- do
- if [ -d $ISODIR/$RM ]; then
- if [ "$verbose_mode" = "on" ]; then
- echo "=> Removing $RM..."
- fi
- rm -rf $ISODIR/$RM
- else
- echo "=> Nonexistent directory: $RM."
- fi
- done
-
- sleep 2 # Because I want to see the messages :-)
-
- showmsg "Creating ISO CD9660 image"
- $MKISOFS $MKISOFS_FIXED_ARGS $MKISOFS_ARGS \
- -b $BOOTDIR/$BOOTIMAGE \
- -o $BASEDIR/$IMAGE_NAME.iso $ISODIR
- }
- if [ -f $BASEDIR/$IMAGE_NAME.iso ]; then
- showmsg "Found a previous ISO image, do you want to override it?"
- echo
- echo "[Press the Enter key to keep your ISO image, otherwise"
- echo " press any other key to proceed removing this file and"
- echo " creating a new one called: $IMAGE_NAME.iso]"
- read output_u
- if [ -n "$output_u" ]; then
- _do_real_iso_image
- elif [ -z "$output_u" ]; then
- showmsg "Not overwritting ISO image, skipped."
- fi
- else
- _do_real_iso_image
- fi
- ;;
- burn)
- if [ ! -f $BASEDIR/$IMAGE_NAME.iso ]; then
- showmsg "Can't find iso image!, exiting."
- bye 1
+ [ -n "$verbose_mode" ] && showmsg "Size: $(du -sh $ISODIR)"
+ ;;
+ clean)
+ if [ -f $pkgsrc_mntstat -o -f $pkgsrcdist_mntstat ]; then
+ showmsg "The pkgsrc directories are still in use! Exiting."
+ bye 1
+ fi
+ showmsg "Cleaning WORKDIR: $WORKDIR"
+ rm -rf $WORKDIR
+ for F in bin dev etc lib libexec mnt rescue root tmp usr var sbin home
+ do
+ if [ -d $ISODIR/$F ]; then
+ showmsg_n "Removing $ISODIR/$F..."
+ rm -rf $ISODIR/$F
+ showmsgstring
+ fi
+ done
+ ;;
+ iso)
+ _do_real_iso_image()
+ {
+ if [ -f "$BASEDIR/$IMAGE_NAME.iso" ]; then
+ [ -n "$verbose_mode" ] && \
+ echo "=> Removing $IMAGE_NAME.iso..."
+ rm $BASEDIR/$IMAGE_NAME.iso
+ fi
+ [ -d $ISODIR/$BOOTDIR ] && chown -R root:wheel $ISODIR/$BOOTDIR
+
+ if [ ! -f $ISODIR/stand/mfs_etc.tgz ]; then
+ showmsg "Cannot find mfs_etc.tgz file."
+ bye 1
+ fi
+ for RM in ${REMOVE_DIRS}
+ do
+ if [ -d $ISODIR/$RM ]; then
+ echo -n "=> Removing $RM..."
+ rm -rf $ISODIR/$RM
+ showmsgstring
fi
+ done
+
+ sleep 2 # Because I want to see the messages :-)
+
+ showmsg_n "Creating ISO CD9660 image..."
+ if [ "$USE_GNU_GRUB" = "yes" ]; then
+ $MKISOFS $MKISOFS_FIXED_ARGS $MKISOFS_ARGS \
+ -b $GRUB_BOOTDIR/$GRUB_BOOTIMAGE \
+ -o $BASEDIR/$IMAGE_NAME.iso $ISODIR > /dev/null 2>&1
+ showmsgstring
+ else
+ $MKISOFS $MKISOFS_FIXED_ARGS $MKISOFS_ARGS \
+ -b ${CDBOOT_IMG} -o $BASEDIR/$IMAGE_NAME.iso $ISODIR \
+ > /dev/null 2>&1
+ showmsgstring
+ fi
+ }
+ if [ -f $BASEDIR/$IMAGE_NAME.iso ]; then
+ echo "* Found $IMAGE_NAME.iso."
+ echo -n "=> Do you want to overwrite this image? (y/n) "
+ read output_u
+ if [ "$output_u" = "y" ]; then
+ _do_real_iso_image
+ elif [ "$output_u" = "n" -o "$output_u" != "y" ]; then
+ showmsg "Exiting."
+ fi
+ else
+ _do_real_iso_image
+ fi
+ ;;
+ burn)
+ if [ ! -f $BASEDIR/$IMAGE_NAME.iso ]; then
+ showmsg "Can't find iso image!, exiting."
+ bye 1
+ fi
- if [ $BLANK_BEFORE_BURN = "yes" ]; then
- $CDRECORD dev=$CDROM_DEVICE $CDRECORD_ARGS blank=fast
- fi
+ [ "$BLANK_BEFORE_BURN" = "yes" ] && \
+ $CDRECORD dev=$CDROM_DEVICE $CDRECORD_ARGS blank=fast
- $CDRECORD dev=$CDROM_DEVICE $CDRECORD_ARGS \
- $BASEDIR/$IMAGE_NAME.iso
- ;;
- esac
+ $CDRECORD dev=$CDROM_DEVICE $CDRECORD_ARGS $BASEDIR/$IMAGE_NAME.iso
+ ;;
+ esac
}
checkconf()
{
- 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
+ if [ -f $config_file ]; then
+ if [ $(id -u) -ne 0 ]; then
+ showmsg "MUST BE RUN AS ROOT!"
+ bye 1
+ fi
+ do_conf_reset; do_conf
+ else
+ showmsg "$config_file DOESN'T EXIST, EXITING!"
+ bye 1
+ fi
}
# =========================================================================== #
# Main program #
# =========================================================================== #
-args=$(getopt c:v $*)
+args=$(getopt c:k:v $*)
if [ $? -ne 0 ]; then
- usage
+ usage
fi
set -- $args
while [ $# -gt 0 ]; do
- case "$1" in
- -c)
- config_file="$config_dir/$2"
- shift
- ;;
- -v)
- verbose_mode=on
- ;;
- --)
- shift; break
- ;;
- esac
+ case "$1" in
+ -c)
+ config_file="$config_dir/$2"
shift
+ ;;
+ -k)
+ kernel_arg="$2"
+ K_ARG_SET=1
+ shift
+ ;;
+ -v)
+ verbose_mode=on
+ ;;
+ --)
+ shift; break
+ ;;
+ esac
+ shift
done
if [ $# -lt 1 ]; then
- usage
+ usage
fi
if [ -z "$config_file" ]; then
- config_file=$config_dir/mklivecd.conf
+ config_file=$config_dir/mklivecd.conf
fi
if [ -z "$verbose_mode" ]; then
- verbose_mode=off
+ verbose_mode=
fi
target=$1
case "$target" in
- iso)
- checkconf
- do_cdlive iso
- ;;
- kernel)
- do_cdlive kernel
- ;;
- base)
- checkconf
- do_cdlive base
- ;;
- chroot)
- checkconf
- do_cdlive chroot
- ;;
- clean)
- checkconf
- do_cdlive clean
- ;;
- config)
- do_conf
- ;;
- burn)
- checkconf
- do_cdlive burn
- ;;
- *)
- usage
- ;;
+ iso)
+ checkconf
+ do_cdlive iso
+ ;;
+ kernel)
+ do_cdlive kernel
+ ;;
+ base)
+ checkconf
+ do_cdlive base
+ ;;
+ chroot)
+ checkconf
+ do_cdlive chroot
+ ;;
+ clean)
+ checkconf
+ do_cdlive clean
+ ;;
+ config)
+ do_conf
+ ;;
+ burn)
+ checkconf
+ do_cdlive burn
+ ;;
+ *)
+ usage
+ ;;
esac
-exit 0 # agur!
+exit 0 # agur! (that's all folks)
+
+# vim: expandtab:softtabstop=4:shiftwidth=4