From 11dd81f2e2c069978f9920ee343245a1afb7e57c Mon Sep 17 00:00:00 2001 From: xtraeme Date: Tue, 10 Apr 2007 02:23:34 +0000 Subject: Update to 0.15: * Added a new target 'fetch' that will fetch the specified sets from the specified URL. * Fixed permissions on /tmp. (Reported by Zafer Aydogan). * Renamed BOOTKERN to KERNEL_CONFIG, because it's more appropiate. * Fix a problem with options accepting a 'yes' argument, now the value can be case insensitive. * Remove the example kernel config, too old and useless. * Use mktemp(1) to create the temporary file. * Updated manpage with reality. --- sysutils/mklivecd/Makefile | 10 +- sysutils/mklivecd/PLIST | 3 +- sysutils/mklivecd/files/livecd | 3 +- sysutils/mklivecd/files/mklivecd.8 | 96 +++++++++++------ sysutils/mklivecd/files/mklivecd.sh | 200 +++++++++++++++++++++++------------- 5 files changed, 199 insertions(+), 113 deletions(-) (limited to 'sysutils/mklivecd') diff --git a/sysutils/mklivecd/Makefile b/sysutils/mklivecd/Makefile index e95f0ab36c0..cf75aee1638 100644 --- a/sysutils/mklivecd/Makefile +++ b/sysutils/mklivecd/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.36 2007/03/10 00:05:46 xtraeme Exp $ +# $NetBSD: Makefile,v 1.37 2007/04/10 02:23:34 xtraeme Exp $ -DISTNAME= mklivecd-0.14.5 +DISTNAME= mklivecd-0.15 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty @@ -28,8 +28,6 @@ USE_TOOLS+= tar INSTALLATION_DIRS= ${PKGMANDIR}/man8 sbin share/mklivecd -FILES= KERN-LIVECD personal_config - do-install: .for f in livecd mklivecd.sh mklivecd.8 @${SED} -e "s,@PREFIX@,${PREFIX},g" \ @@ -42,8 +40,6 @@ do-install: ${INSTALL_SCRIPT} ${WRKDIR}/mklivecd.sh ${PREFIX}/sbin/mklivecd ${INSTALL_MAN} ${WRKDIR}/mklivecd.8 ${PREFIX}/${PKGMANDIR}/man8 ${INSTALL_DATA} ${WRKDIR}/livecd ${PREFIX}/share/mklivecd -.for F in ${FILES} - ${INSTALL_DATA} ${FILESDIR}/${F} ${PREFIX}/share/mklivecd -.endfor + ${INSTALL_DATA} ${FILESDIR}/personal_config ${PREFIX}/share/mklivecd .include "../../mk/bsd.pkg.mk" diff --git a/sysutils/mklivecd/PLIST b/sysutils/mklivecd/PLIST index 947ce6f8d66..9f377ab8819 100644 --- a/sysutils/mklivecd/PLIST +++ b/sysutils/mklivecd/PLIST @@ -1,7 +1,6 @@ -@comment $NetBSD: PLIST,v 1.3 2005/08/11 20:48:55 xtraeme Exp $ +@comment $NetBSD: PLIST,v 1.4 2007/04/10 02:23:34 xtraeme Exp $ man/man8/mklivecd.8 sbin/mklivecd -share/mklivecd/KERN-LIVECD share/mklivecd/livecd share/mklivecd/personal_config @dirrm share/mklivecd diff --git a/sysutils/mklivecd/files/livecd b/sysutils/mklivecd/files/livecd index c14c0301cce..fd4dd94ded2 100644 --- a/sysutils/mklivecd/files/livecd +++ b/sysutils/mklivecd/files/livecd @@ -1,4 +1,4 @@ -# $NetBSD: livecd,v 1.5 2006/10/13 14:58:34 xtraeme Exp $ +# $NetBSD: livecd,v 1.6 2007/04/10 02:23:34 xtraeme Exp $ # # Mount ramfs directories and unpack the required files # before anything. @@ -28,6 +28,7 @@ livecd_start() for f in dev etc root tmp var do /rescue/mkdir /ramfs/$f + [ "$f" = "tmp" ] && /rescue/chmod 01777 /ramfs/$f /rescue/mount_null /ramfs/$f /$f if [ "$f" = "var" ]; then echo "/$f." diff --git a/sysutils/mklivecd/files/mklivecd.8 b/sysutils/mklivecd/files/mklivecd.8 index a3d04916853..2d9bbf4b738 100644 --- a/sysutils/mklivecd/files/mklivecd.8 +++ b/sysutils/mklivecd/files/mklivecd.8 @@ -1,20 +1,28 @@ -.\" $NetBSD: mklivecd.8,v 1.15 2006/10/14 07:42:25 wiz Exp $ +.\" $NetBSD: mklivecd.8,v 1.16 2007/04/10 02:23:34 xtraeme Exp $ .\" -.\" mklivecd - Make your own NetBSD/i386 Live CD-ROM/DVD-ROM +.\" mklivecd - Make your own NetBSD/x86 Live CD-ROM/DVD-ROM .\" -.\" Copyright (c) 2004-2006 Juan Romero Pardines +.\" Copyright (c) 2004-2007 Juan Romero Pardines. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Juan Romero Pardines. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. -.\" 2. Neither the name of The NetBSD Foundation nor the names of its +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its .\" contributors may be used to endorse or promote products derived .\" from this software without specific prior written permission. -.\" 3. Neither the name of author nor the names of its contributors may -.\" be used to endorse or promote products derived from this software -.\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -28,14 +36,14 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 8, 2006 +.Dd April 10, 2007 .Dt MKLIVECD 8 .Os .Sh NAME .Nm mklivecd .Nd Make your own .Nx -/ i386 Live CD-ROM/DVD-ROM +/ x86 Live CD-ROM/DVD-ROM .Sh SYNOPSIS .Nm .Fl v @@ -56,11 +64,12 @@ two options for the bootloader are provided since version .Pa the GNU Grub bootloader or the .Nx -cdboot bootloader (since +ISO9660 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 +By default on i386 will use the first option: +.Pa the GNU Grub bootloader , +and the NetBSD ISO9660 booloader on amd64. You may want to +change this by changing the option .Pa USE_GNU_GRUB to .Sy no . @@ -77,7 +86,7 @@ Example: .Bl -tag -width XkXkernel .It Fl k Ar kernel Overrides the -.Ar BOOTKERN +.Ar KERNEL_CONFIG value specified in the configuration file, .Ar KERNEL_NAME will be modified automatically too. @@ -105,6 +114,17 @@ target. Primary directory used to store the main directories and the final ISO image. Defaults to .Pa $HOME/livecd . +.It FETCH_SETS +If it's set to yes, it will download the sets in the target +.Pa fetch , +from the URL specified in +.Pa REMOTE_SETS_URL . +.It REMOTE_SETS_URL +This is the URL containing the base/x11 sets for the +.Pa fetch +target and if +.Pa FETCH_SETS +is set to yes. .It BASE_SETS_DIR The base sets directory. Defaults to @@ -180,10 +200,10 @@ Sets used by default are: The X11 sets directory. Defaults to .Pa $BASE_SETS_DIR . -.It BOOTKERN +.It KERNEL_CONFIG Name of the .Nx -kernel used for the boot image. +configuration kernel (e.g. GENERIC) used for the boot image. Defaults to .Sy KERN-LIVECD . .It KERNEL_NAME @@ -239,7 +259,7 @@ then X11 sets and configuration files will be unpacked automatically. Defaults to .Sy no . .It GRUB_FILES_DIR -Directory where the grub files are stored. +Directory where the grub files are stored. Defaults to .Sy @LOCALBASE@/lib/grub/@MACHINE_ARCH@-/ . .It HOSTNAME @@ -294,7 +314,8 @@ Defaults to Used to select the bootloader for the Live CD. When it's disabled the .Nx -CDBootloader will be used. +CD Bootloader will be used. Note that you cannot use GRUB +on amd64, so the option shouldn't be touched on this arch. Defaults to .Sy yes . .It VND_COMPRESSION @@ -356,10 +377,18 @@ You should edit it after the creation as you will probably want to change the default configuration, especially paths. .It Ar kernel Builds the specified kernel -.Pa $BOOTKERN +.Pa $KERNEL_CONFIG into the .Pa $ISODIR directory. +.It Ar fetch +Downloads the sets defined in +.Pa $BASE_SETS +from +.Pa $REMOTE_SETS_URL +and if +.Pa $FETCH_SETS +is enabled. .It Ar base Install the .Pa $BASE_SETS @@ -435,7 +464,7 @@ and .Ar APMKERN , both are kernel configuration files, you'll need to define the variables named -.Ar BOOTKERN_${foo} +.Ar KERNEL_CONFIG_${foo} and .Ar KERNEL_NAME_${foo} for every kernel specified on the @@ -444,14 +473,14 @@ option. The following example shows that: .Bd -literal -offset indent MULTIPLE_KERNELS="ACPIKERN APMKERN" -BOOTKERN_ACPIKERN="LIVECD_ACPI" -BOOTKERN_APMKERN="LIVECD_APM" +KERNEL_CONFIG_ACPIKERN="LIVECD_ACPI" +KERNEL_CONFIG_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 +.Pa KERNEL_CONFIG and .Pa KERNEL_NAME variables, will don't have any effect. @@ -470,15 +499,12 @@ adds this automatically in the script, otherwise your real PKG_SYSCONFDIR directory will be copied instead of the one located in .Pa $ISODIR . .Pp -An example kernel config file, -.Pa KERN-LIVECD , -has been installed into -.Ar @PREFIX@/share/mklivecd , -based on the 2.0 branch. -You should copy your own kernel config file into +By default there's no default kernel, so you should copy +your own kernel (or kernels if MULTIPLE_KERNELS is set) config +file into .Ar $HOME/.mklivecd . The -.Sy BOOTKERN +.Sy KERNEL_CONFIG variable should point at it, if you're not using .Sy MULTIPLE_KERNELS . The important thing about the kernel is the line: @@ -496,6 +522,7 @@ Below are the minimal steps to create your own Live CD-ROM/DVD-ROM: $ mklivecd config [edit the config file] $ mklivecd kernel +$ mklivecd fetch [to download the sets if enabled] $ mklivecd base $ mklivecd chroot [edit what you like in there, e.g. config files] @@ -514,3 +541,12 @@ utility was written by .An Juan Romero Pardines Aq xtraeme@NetBSD.org . .Sh BUGS It is not perfect but at least it does its task correctly. +.Sh SUPPORT +Many Live CDs are built with this software, and sometimes +.Nm +is not even mentioned, that's not good. If you use +this software to build a Live CD, please say so in your +README file or FAQ. +If you want more features implemented, please make a +hardware or monetary donation to continue improving +NetBSD development. diff --git a/sysutils/mklivecd/files/mklivecd.sh b/sysutils/mklivecd/files/mklivecd.sh index e059486019d..099eeae5044 100755 --- a/sysutils/mklivecd/files/mklivecd.sh +++ b/sysutils/mklivecd/files/mklivecd.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: mklivecd.sh,v 1.32 2007/03/10 00:01:23 xtraeme Exp $ +# $NetBSD: mklivecd.sh,v 1.33 2007/04/10 02:23:34 xtraeme Exp $ # # Copyright (c) 2004-2007 Juan Romero Pardines. # All rights reserved. @@ -37,13 +37,13 @@ # POSSIBILITY OF SUCH DAMAGE. # # ======================================================================== # -# mklivecd - Make your own NetBSD/i386 Live CD-ROM/DVD-ROM # +# mklivecd - Make your own NetBSD/x86 Live CD-ROM/DVD-ROM # # ======================================================================== # : ${progname:=$(basename $0)} : ${config_dir:=$HOME/.mklivecd} : ${pers_conffile:=personal_config} -: ${tmp_file:=/tmp/${progname}.$$} +: ${tmp_file:=$(/usr/bin/mktemp /tmp/${progname}.XXXXXX)} : ${pkgsrc_mntstat:=$config_dir/pkgsrc_mount.stat} : ${pkgsrcdist_mntstat:=$config_dir/pkgsrcdist_mount.stat} : ${packages_mntstat:=$config_dir/packages_mount.stat} @@ -92,6 +92,7 @@ usage() chroot Chroot into the livecd clean Clean the WORKDIR and ISODIR directories config Create default configuration file + fetch Download base/x11 sets from REMOTE_SETS_URL iso Build the ISO9660 image with mkisofs(1) kernel Build and install the kernel(s) and boot files @@ -119,6 +120,34 @@ showmsgstring() fi } +is_enabled() +{ + eval _val="\$$1" + + case $_val in + [Yy][Ee][Ss]) + return 0 + ;; + *) + return 1 + ;; + esac +} + +is_disabled() +{ + eval _val="\$$1" + + case $_val in + [Nn][Oo]) + return 0 + ;; + *) + return 1 + ;; + esac +} + bye() { _exitarg="$1" @@ -128,17 +157,18 @@ bye() do_conf() { BASE_VARS="SOURCEDIR PACKAGESDIR PKGSRCDIR PKGSRCDISTDIR SHAREDIR BASEDIR \ - WORKDIR ISODIR BASE_SETS_DIR X11_SETS_DIR BASE_SETS X11_SETS \ - CHROOT_SHELL" + WORKDIR ISODIR FETCH_SETS REMOTE_SETS_URL BASE_SETS_DIR \ + X11_SETS_DIR BASE_SETS X11_SETS CHROOT_SHELL" - KERNEL_VARS="MULTIPLE_KERNELS BOOTKERN KERNEL_NAME" + KERNEL_VARS="MULTIPLE_KERNELS KERNEL_CONFIG KERNEL_NAME" MISC_VARS="ENABLE_X11 MKISOFS_BIN MKISOFS_ARGS CDRECORD_BIN CDRECORD_ARGS \ BLANK_BEFORE_BURN CDROM_DEVICE PERSONAL_CONFIG IMAGE_NAME \ - PKG_SYSCONFDIR REMOVE_DIRS HOSTNAME VND_COMPRESSION" + PKG_SYSCONFDIR REMOVE_DIRS HOSTNAME VND_COMPRESSION \ + USE_GNU_GRUB GRUB_FILES_DIR" - if [ "${ARCH}" != "x86_64" ]; then - MISC_VARS="${MISC_VARS} USE_GNU_GRUB GRUB_FILES_DIR" + if [ "${ARCH}" = "x86_64" ]; then + ARCH="amd64" fi MNT_VARS="MNT_RAMFS_CMD MNT_RAMFS_ARGS" @@ -152,6 +182,8 @@ do_conf() : ${BASEDIR:=$HOME/livecd} : ${WORKDIR:=${BASEDIR}/work} : ${ISODIR:=${BASEDIR}/iso} + : ${FETCH_SETS:=no} + : ${REMOTE_SETS_URL:=ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-3.1/${ARCH}/binary/sets} : ${BASE_SETS_DIR:=$HOME/release/binary/sets} : ${X11_SETS_DIR:=${BASE_SETS_DIR}} : ${BASE_SETS:=etc.tgz base.tgz comp.tgz text.tgz} @@ -161,7 +193,7 @@ do_conf() # kernel options : ${MULTIPLE_KERNELS:=no} - : ${BOOTKERN:=KERN-LIVECD} + : ${KERNEL_CONFIG:=KERN-LIVECD} : ${KERNEL_NAME:=MKLIVECD} # Miscellaneous options @@ -176,11 +208,7 @@ do_conf() : ${IMAGE_NAME:=NetBSD-LiveCD} : ${PKG_SYSCONFDIR:=usr/pkg/etc} : ${REMOVE_DIRS:=altroot usr/share/info} - if [ "${MACHINE_ARCH}" != "x86_64" ]; then - : ${USE_GNU_GRUB:=yes} - else - USE_GNU_GRUB=no - fi + : ${USE_GNU_GRUB:=yes} : ${GRUB_FILES_DIR:=@LOCALBASE@/lib/grub/@MACHINE_ARCH@-} : ${VND_COMPRESSION:=no} # @@ -223,17 +251,14 @@ EOF echo "# MULTIPLE_KERNELS example:"; \ echo "#"; \ echo "# MULTIPLE_KERNELS=\"ACPI APM\""; \ - echo "# BOOTKERN_ACPI=\"KERN_ACPI\""; \ + echo "# KERNEL_CONFIG_ACPI=\"KERN_ACPI\""; \ echo "# KERNEL_NAME_ACPI=\"LIVECD_ACPI\""; \ - echo "# BOOTKERN_APM=\"KERN_APM\""; \ + echo "# KERNEL_CONFIG_APM=\"KERN_APM\""; \ echo "# KERNEL_NAME_APM=\"LIVECD_APM\""; \ ) >> $config_file echo >> $config_file - # GNU Grub is not supported in 64bit. - if [ "$(/sbin/sysctl -n hw.machine_arch)" = "x86_64" ]; then - USE_GNU_GRUB=no - fi + [ "${ARCH}" != "i386" ] && USE_GNU_GRUB=no echo "# Miscellaneous options" >> $config_file for var in $(echo $MISC_VARS | tr ' ' '\n' | sort -u) @@ -274,7 +299,7 @@ copy_bootfiles() # # GNU GRUB. # - if [ "$USE_GNU_GRUB" = "yes" ]; then + if is_enabled USE_GNU_GRUB; then [ ! -d $ISODIR/$GRUB_BOOTDIR ] && mkdir -p $ISODIR/$GRUB_BOOTDIR for f in $GRUB_FILES do @@ -315,7 +340,7 @@ do_menu_lst() showmsg_n "Updating menu.lst..." ( \ echo "title NetBSD/$KERNEL_NAME kernel"; \ - echo "kernel --type=netbsd /$GRUB_BOOTDIR/$BOOTKERN.gz"; \ + echo "kernel --type=netbsd /$GRUB_BOOTDIR/$KERNEL_CONFIG.gz"; \ echo; \ ) >> $ISODIR/$GRUB_BOOTDIR/menu.lst else @@ -329,7 +354,7 @@ default 0 timeout 10 title NetBSD/$KERNEL_NAME kernel -kernel --type=netbsd /$GRUB_BOOTDIR/$BOOTKERN.gz +kernel --type=netbsd /$GRUB_BOOTDIR/$KERNEL_CONFIG.gz _EOF_ showmsgstring @@ -342,7 +367,7 @@ do_build_kernels() for K in ${MULTIPLE_KERNELS} do - eval bootkern=\$BOOTKERN_${K} + eval bootkern=\$KERNEL_CONFIG_${K} eval kernname=\$KERNEL_NAME_${K} cd $WORKDIR @@ -364,14 +389,15 @@ do_build_kernels() cd $kernname make depend && make if [ "$?" -eq 0 ]; then - if [ "$USE_GNU_GRUB" = "yes" ]; then + if is_enabled USE_GNU_GRUB; then cp $WORKDIR/$kernname/netbsd $ISODIR/$GRUB_BOOTDIR/$bootkern else cp $WORKDIR/$kernname/netbsd $ISODIR/$bootkern fi [ -n "$verbose_mode" ] && \ showmsg_n "Compressing kernel $bootkern..." - if [ "$USE_GNU_GRUB" = "yes" ]; then + + if is_enabled USE_GNU_GRUB; then gzip $ISODIR/$GRUB_BOOTDIR/$bootkern showmsgstring if [ -f $ISODIR/$GRUB_BOOTDIR/menu.lst ]; then @@ -421,47 +447,49 @@ do_cdlive() case "$1" in kernel) if [ ! -d $SOURCEDIR/sys ]; then - echo "=> CANNOT FIND NETBSD SOURCES, EXITING!" + echo "=> CANNOT FIND THE 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_CONFIG=$kernel_arg KERNEL_NAME=MKLIVECD_$kernel_arg fi - if [ "$MULTIPLE_KERNELS" = "no" ]; then + if is_disabled MULTIPLE_KERNELS; then showmsg "Building kernel on $(date):" if [ -n "$verbose_mode" ]; then echo - showmsg "Using kernel: $BOOTKERN" + showmsg "Using kernel: $KERNEL_CONFIG" showmsg "Kernel name: $KERNEL_NAME" 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 - cp $config_dir/$BOOTKERN $WORKDIR - else - cp $SHAREDIR/$BOOTKERN $WORKDIR - fi + # + # Use the specified kernel from ~/.mklivecd. + # + if [ -s $config_dir/$KERNEL_CONFIG ]; then + cp $config_dir/$KERNEL_CONFIG $WORKDIR + else + echo "=> CANNOT FIND '$KERNEL_CONFIG' in $config_dir, EXITING!" + bye 1 + fi cd $WORKDIR [ ! -d $WORKDIR/$KERNEL_NAME ] && \ mkdir $WORKDIR/$KERNEL_NAME config -s $SOURCEDIR/sys -b $WORKDIR/$KERNEL_NAME \ - $BOOTKERN + $KERNEL_CONFIG cd $KERNEL_NAME make depend && make if [ "$?" -eq 0 ]; then copy_bootfiles - showmsg_n "Compressing kernel $BOOTKERN..." - if [ "$USE_GNU_GRUB" = "yes" ]; then + showmsg_n "Compressing kernel $KERNEL_CONFIG..." + if is_enabled USE_GNU_GRUB; then cp $WORKDIR/$KERNEL_NAME/netbsd \ - $ISODIR/$GRUB_BOOTDIR/$BOOTKERN - gzip -9 $ISODIR/$GRUB_BOOTDIR/$BOOTKERN + $ISODIR/$GRUB_BOOTDIR/$KERNEL_CONFIG + gzip -9 $ISODIR/$GRUB_BOOTDIR/$KERNEL_CONFIG showmsgstring else if [ -f $ISODIR/netbsd ]; then @@ -477,10 +505,10 @@ do_cdlive() # 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 + $ISODIR/k.$KERNEL_CONFIG + gzip -9 $ISODIR/k.$KERNEL_CONFIG + mv $ISODIR/k.$KERNEL_CONFIG.gz \ + $ISODIR/k.$KERNEL_CONFIG else cp $WORKDIR/$KERNEL_NAME/netbsd $ISODIR gzip -9 $ISODIR/netbsd @@ -489,7 +517,7 @@ do_cdlive() showmsgstring fi if [ "$?" -eq 0 ]; then - [ "$USE_GNU_GRUB" = "yes" ] && do_menu_lst + is_enabled USE_GNU_GRUB && do_menu_lst [ -n "$verbose_mode" ] && \ echo "=> NEXT STEP: ${progname} base" else @@ -505,6 +533,38 @@ do_cdlive() do_build_kernels fi ;; + fetch) + # + # Fetch the sets if the option is enabled from REMOTE_SETS_URL. + # + if is_enabled FETCH_SETS; then + if [ ! -d $BASE_SETS_DIR ]; then + showmsg "Cannot find $BASE_SETS_DIR, exiting" + bye 1 + fi + cd $BASE_SETS_DIR + for f in ${BASE_SETS} + do + if [ -f "$f" ]; then + /usr/bin/ftp -4aR "$REMOTE_SETS_URL/$f" + fi + + if [ -n "$verbose_mode" ]; then + /usr/bin/ftp -4a "$REMOTE_SETS_URL/$f" + else + showmsg_n "Downloading set $f..." + /usr/bin/ftp -4a "$REMOTE_SETS_URL/$f" 2>&1 > /dev/null + showmsgstring + fi + done + else + showmsg "You have disabled the option to fetch the sets." + bye 1 + fi + + [ -n "$verbose_mode" ] && echo "=> NEXT STEP: ${progname} base" + + ;; base) for F in ${BASE_SETS} do @@ -524,7 +584,7 @@ do_cdlive() fi done - if [ "${ENABLE_X11}" = "yes" ]; then + if is_enabled ENABLE_X11; then for FX in ${X11_SETS} do if [ ! -f $X11_SETS_DIR/$FX ]; then @@ -575,7 +635,7 @@ do_cdlive() cat > $ISODIR/etc/rc.d/root <<_EOF_ #!/bin/sh # -# \$NetBSD: mklivecd.sh,v 1.32 2007/03/10 00:01:23 xtraeme Exp $ +# \$NetBSD: mklivecd.sh,v 1.33 2007/04/10 02:23:34 xtraeme Exp $ # # PROVIDE: root @@ -752,28 +812,24 @@ _EOF_ mv $ISODIR/etc/rc.d/livecd.f $ISODIR/etc/rc.d/livecd fi - if [ "${ENABLE_X11}" = "yes" -a ! -f $ISODIR/etc/X11/XF86Config ]; then + if is_enabled ENABLE_X11 && [ ! -f $ISODIR/etc/X11/XF86Config ]; then if [ -f /etc/X11/XF86Config ]; then cp /etc/X11/XF86Config $ISODIR/etc/X11 fi fi - if [ "${PERSONAL_CONFIG}" = "yes" ]; then + if is_enabled PERSONAL_CONFIG; 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 - fi + else + echo + echo "==> CANNOT FIND PERSONAL CONFIGURATION FILE" + echo + bye 1 fi fi @@ -865,12 +921,7 @@ _EOF_ done ;; iso) - # To make sure that it's not defined - if [ "${ARCH}" = "x86_64" ]; then - unset USE_GNU_GRUB - fi - - if [ "$VND_COMPRESSION" = "yes" ]; then + if is_enabled VND_COMPRESSION; then cd $ISODIR if [ ! -f $ISODIR/stand/usr.zfs ]; then @@ -909,16 +960,16 @@ _EOF_ # # Detect if we are running a MULTIBOOT kernel. # - if [ -f $ISODIR/$GRUB_BOOTDIR/menu.lst -a -f $WORKDIR/$BOOTKERN ]; then - gunzip $ISODIR/$GRUB_BOOTDIR/$BOOTKERN - config -x $ISODIR/$GRUB_BOOTDIR/$BOOTKERN | grep -q MULTIBOOT + if [ -f $ISODIR/$GRUB_BOOTDIR/menu.lst -a -f $WORKDIR/$KERNEL_CONFIG ]; then + gunzip $ISODIR/$GRUB_BOOTDIR/$KERNEL_CONFIG + config -x $ISODIR/$GRUB_BOOTDIR/$KERNEL_CONFIG | grep -q MULTIBOOT if [ "$?" -eq 0 ]; then showmsg "Applying fix for MULTIBOOT kernel..." sed -e "s|\--type=netbsd||g" $ISODIR/boot/grub/menu.lst > \ $ISODIR/boot/grub/menu.lst.in mv $ISODIR/boot/grub/menu.lst.in $ISODIR/boot/grub/menu.lst fi - gzip -9 $ISODIR/$GRUB_BOOTDIR/$BOOTKERN + gzip -9 $ISODIR/$GRUB_BOOTDIR/$KERNEL_CONFIG fi _do_real_iso_image() @@ -945,7 +996,7 @@ _EOF_ sleep 2 # Because I want to see the messages :-) showmsg_n "Creating ISO CD9660 image..." - if [ "$USE_GNU_GRUB" = "yes" ]; then + if is_enabled USE_GNU_GRUB; then [ -d $ISODIR/$GRUB_BOOTDIR ] && \ chown -R root:wheel $ISODIR/$GRUB_BOOTDIR $MKISOFS_BIN $MKISOFS_FIXED_ARGS $GRUB_BOOT_ARGS $MKISOFS_ARGS \ @@ -978,7 +1029,7 @@ _EOF_ bye 1 fi - [ "$BLANK_BEFORE_BURN" = "yes" ] && \ + [ is_enabled BLANK_BEFORE_BURN ] && \ $CDRECORD_BIN dev=$CDROM_DEVICE $CDRECORD_ARGS blank=fast $CDRECORD_BIN dev=$CDROM_DEVICE $CDRECORD_ARGS $BASEDIR/$IMAGE_NAME.iso @@ -1072,6 +1123,9 @@ case "$target" in checkconf do_cdlive burn ;; + fetch) + do_cdlive fetch + ;; *) usage ;; -- cgit v1.2.3