]> Zhao Yanbai Git Server - minix.git/commitdiff
updateboot script for netbsd bootloader
authorEvgeniy Ivanov <lolkaantimat@gmail.com>
Wed, 15 Feb 2012 02:51:27 +0000 (03:51 +0100)
committerBen Gras <ben@minix3.org>
Wed, 15 Feb 2012 02:51:27 +0000 (03:51 +0100)
commands/Makefile
commands/updateboot/Makefile [new file with mode: 0644]
commands/updateboot/updateboot.sh [new file with mode: 0755]

index de07aa4f267554eb1ebb3487457dd446e36415e5..557a34c39dc2d84c0355b3559eb22388ba2c6135 100644 (file)
@@ -33,7 +33,7 @@ SUBDIR=       add_route arp ash at autil awk \
        unstack update uud uue version vol wc \
        whereis which who write writeisofs fetch \
        xargs yacc yes zdump zmodem pkgin_cd \
-       mktemp worldstone
+       mktemp worldstone updateboot
 
 .if ${ARCH} == "i386"
 SUBDIR+=       atnormalize dosread fdisk loadfont \
diff --git a/commands/updateboot/Makefile b/commands/updateboot/Makefile
new file mode 100644 (file)
index 0000000..81200bd
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= updateboot.sh
+BINDIR= /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/updateboot/updateboot.sh b/commands/updateboot/updateboot.sh
new file mode 100755 (executable)
index 0000000..18a7a54
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+set -e
+
+MDEC=/usr/mdec
+BOOT=/boot_monitor
+ROOT=`printroot -r`
+
+if [ ! -b "$ROOT" ]
+then
+       echo root device $ROOT not found
+       exit 1
+fi
+
+echo -n "Install boot as $BOOT on current root? (y/N) "
+read ans
+
+if [ ! "$ans" = y ]
+then
+       echo Aborting.
+       exit 1
+fi
+
+echo "Installing boot monitor into $BOOT."
+cp $MDEC/boot_monitor $BOOT
+
+disk=`echo "$ROOT" | sed 's/s[0-3]//'`
+echo -n "Install bootxx_minixfs3 into $disk? (y/N) "
+read ans
+
+if [ ! "$ans" = y ]
+then
+       echo Exiting...
+       sync
+       exit 0
+fi
+
+echo "Installing bootxx_minixfs3 into $disk."
+installboot_nbsd "$disk" "$MDEC/bootxx_minixfs3"
+
+sync