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
This commit is contained in:
Ben Gras 2013-05-07 12:36:41 +00:00
parent 64511a4f9a
commit 5f86cf4d33
2 changed files with 68 additions and 15 deletions

View File

@ -83,29 +83,25 @@ bootable:
hdboot install: services .WAIT do-hdboot hdboot install: services .WAIT do-hdboot
TEMPDIR=${DESTDIR}/boot/minix/.temp/
do-hdboot: do-hdboot:
@rm -rf ${DESTDIR}/boot/minix/.temp/ @rm -rf ${TEMPDIR}
${INSTALL_DIR} ${DESTDIR}/boot/minix/.temp ${INSTALL_DIR} ${TEMPDIR}
# mod_0 is used to make alphabetical order equal to the boot order ${HOST_SH} placeprograms.sh ${TEMPDIR} "${INSTALL}" \
@n=0; \ "${STRIP} -s" ${PROGRAMS} ${KERNEL}
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/
@if [ "${MKINSTALLBOOT:Uno}" != "no" ] ; then \ @if [ "${MKINSTALLBOOT:Uno}" != "no" ] ; then \
${STRIP} -s ${DESTDIR}/boot/minix/.temp/* ; \
gzip ${DESTDIR}/boot/minix/.temp/mod* ; \
${HOST_SH} mkboot hdboot ${DESTDIR}; \ ${HOST_SH} mkboot hdboot ${DESTDIR}; \
${HOST_SH} ../commands/update_bootcfg/update_bootcfg.sh;\ ${HOST_SH} ../commands/update_bootcfg/update_bootcfg.sh;\
else \ else \
${INSTALL_DIR} ${DESTDIR}/multiboot; \ ${INSTALL_DIR} ${DESTDIR}/multiboot; \
${INSTALL} ${DESTDIR}/boot/minix/.temp/* ${DESTDIR}/multiboot; \ ${INSTALL} ${TEMPDIR}/* ${DESTDIR}/multiboot; \
fi fi
replace:
${HOST_SH} placeprograms.sh ${DESTDIR}/boot/minix_latest/./ "${INSTALL}" \
"${STRIP} -s" ${PROGRAMS} ${KERNEL}
# download and update NetBSD reference sources. # download and update NetBSD reference sources.
nbsd_fetch: nbsd_fetch:
export CVS_RSH=ssh; \ export CVS_RSH=ssh; \

View File

@ -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 <installdir> <installcmd> <stripcmd> <programlist ...>"
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*