From 568a958d7228ed479148e78572799afdfb5213be Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 7 May 2013 12:36:41 +0000 Subject: [PATCH] releasetools: make replace . add shellscript (placeprograms.sh) that takes all the already-built boot-time programs, gives them the proper names (modules must be in the right order when sorted alphabetically), and puts them in the right dir, stripped and compressed, just like what was done by the Makefile; . add 'replace' target that just invokes this script so that the minix_latest boot directory is replaced by those executables, for a really quick update Change-Id: I35ecab33b4f7263d7114fc9efd198a0779fdc37b --- releasetools/Makefile | 26 +++++++--------- releasetools/placeprograms.sh | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 releasetools/placeprograms.sh diff --git a/releasetools/Makefile b/releasetools/Makefile index 429caa327..b63e2c280 100644 --- a/releasetools/Makefile +++ b/releasetools/Makefile @@ -83,29 +83,25 @@ bootable: hdboot install: services .WAIT do-hdboot +TEMPDIR=${DESTDIR}/boot/minix/.temp/ + do-hdboot: - @rm -rf ${DESTDIR}/boot/minix/.temp/ - ${INSTALL_DIR} ${DESTDIR}/boot/minix/.temp -# mod_0 is used to make alphabetical order equal to the boot order - @n=0; \ - for i in ${PROGRAMS}; \ - do \ - n=`expr $$n + 1`; \ - [ "$$n" -ge 10 ] && prefix="mod" || prefix="mod0"; \ - newname="${DESTDIR}/boot/minix/.temp/$${prefix}$${n}_`basename $$i`"; \ - ${INSTALL} $$i $$newname; \ - done - @cp ${PROGROOT}/kernel/kernel ${DESTDIR}/boot/minix/.temp/ + @rm -rf ${TEMPDIR} + ${INSTALL_DIR} ${TEMPDIR} + ${HOST_SH} placeprograms.sh ${TEMPDIR} "${INSTALL}" \ + "${STRIP} -s" ${PROGRAMS} ${KERNEL} @if [ "${MKINSTALLBOOT:Uno}" != "no" ] ; then \ - ${STRIP} -s ${DESTDIR}/boot/minix/.temp/* ; \ - gzip ${DESTDIR}/boot/minix/.temp/mod* ; \ ${HOST_SH} mkboot hdboot ${DESTDIR}; \ ${HOST_SH} ../commands/update_bootcfg/update_bootcfg.sh;\ else \ ${INSTALL_DIR} ${DESTDIR}/multiboot; \ - ${INSTALL} ${DESTDIR}/boot/minix/.temp/* ${DESTDIR}/multiboot; \ + ${INSTALL} ${TEMPDIR}/* ${DESTDIR}/multiboot; \ fi +replace: + ${HOST_SH} placeprograms.sh ${DESTDIR}/boot/minix_latest/./ "${INSTALL}" \ + "${STRIP} -s" ${PROGRAMS} ${KERNEL} + # download and update NetBSD reference sources. nbsd_fetch: export CVS_RSH=ssh; \ diff --git a/releasetools/placeprograms.sh b/releasetools/placeprograms.sh new file mode 100644 index 000000000..c9f78b989 --- /dev/null +++ b/releasetools/placeprograms.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Script to collect boot-time programs, install them in the given +# dir (to boot from), and +# for the modules: +# . give them filenames so that the sorted names is the boot order, +# and gzip them there +# for the kernel: +# . just copy it + +if [ $# -lt 4 ] +then echo "Usage: $0 " + exit 1 +fi + +installdir="$1" + +if [ ! -d "$installdir" ] +then echo "$0: expecting directory as first argument, $installdir" + exit 1 +fi + +shift + +installcmd="$1" +shift + +stripcmd="$1" +shift + +rm $installdir/*.gz + +echo "install cmd: $installcmd" + +n=0 + +while [ $# -gt 0 ] +do n="`expr $n + 1`" + if [ $n -ge 10 ] + then prefix=mod + else prefix=mod0 + fi + file="$1" + if [ ! -f $file ] + then echo "$0: expecting filenames, $file" + exit 1 + fi + basename="`basename $file`" + if [ $basename != kernel ] + then basename="${prefix}${n}_$basename" + fi + $installcmd $file $installdir/$basename + $stripcmd $installdir/$basename + shift +done + +gzip $installdir/mod*