diff options
author | Toomas Soome <tsoome@me.com> | 2015-06-26 18:55:09 +0300 |
---|---|---|
committer | Dan McDonald <danmcd@omniti.com> | 2015-07-28 12:10:44 -0400 |
commit | 21ba817cf9fbfe996f2d2729ed55dd15531eb5c7 (patch) | |
tree | b85e7df84781253479cd4ec5799b718ac7cbe1c7 | |
parent | 11b942e373071da9f760d7e6208bc79a7bbf7d3c (diff) | |
download | illumos-joyent-21ba817cf9fbfe996f2d2729ed55dd15531eb5c7.tar.gz |
6039 installgrub MBR update response check should use locale specific yesexpr
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Approved by: Garrett D'Amore <garrett@damore.org>
-rw-r--r-- | usr/src/cmd/boot/installgrub/Makefile | 9 | ||||
-rw-r--r-- | usr/src/cmd/boot/installgrub/inc.flg | 21 | ||||
-rw-r--r-- | usr/src/cmd/boot/installgrub/installgrub.c | 8 | ||||
-rw-r--r-- | usr/src/cmd/boot/installgrub/message.h | 2 |
4 files changed, 36 insertions, 4 deletions
diff --git a/usr/src/cmd/boot/installgrub/Makefile b/usr/src/cmd/boot/installgrub/Makefile index aecf0f7096..5d58bd3200 100644 --- a/usr/src/cmd/boot/installgrub/Makefile +++ b/usr/src/cmd/boot/installgrub/Makefile @@ -29,14 +29,16 @@ EINFO_SRC= ./../common/bblk_einfo.c UTILS_SRC =./../common/boot_utils.c EXTRA_SRC =./../common/mboot_extra.c -OBJS= installgrub.o pcfs_glue.o pcfs.o bblk_einfo.o boot_utils.o mboot_extra.o +OBJS= installgrub.o pcfs_glue.o pcfs.o bblk_einfo.o boot_utils.o mboot_extra.o \ + getresponse.o SRCS= installgrub.c pcfs_glue.c $(PCFS_SRC) $(UTILS_SRC) $(EINFO_SRC) \ - $(EXTRA_SRC) + $(EXTRA_SRC) $(SRC)/common/util/getresponse.c SBINLINKS= $(PROG) include ../Makefile.com CPPFLAGS += -I$(SRC)/uts/i86pc -I$(SRC)/uts/intel -I$(SRC)/uts/common +CPPFLAGS += -I$(SRC)/common/util CERRWARN += -_gcc=-Wno-unused-label CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized @@ -80,6 +82,9 @@ mboot_extra.o: $(EXTRA_SRC) bblk_einfo.o: $(EINFO_SRC) $(COMPILE.c) -o $@ $(EINFO_SRC) +%.o: $(SRC)/common/util/%.c + $(COMPILE.c) $(OUTPUT_OPTION) $< + install: all $(ROOTSBINPROG) .WAIT $(ROOTUSRSBINLINKS) clean: diff --git a/usr/src/cmd/boot/installgrub/inc.flg b/usr/src/cmd/boot/installgrub/inc.flg new file mode 100644 index 0000000000..50d189cb2e --- /dev/null +++ b/usr/src/cmd/boot/installgrub/inc.flg @@ -0,0 +1,21 @@ +#!/bin/sh +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015 Toomas Soome <tsoome@me.com> +# + +echo_file usr/src/cmd/boot/common/bblk_einfo.c +echo_file usr/src/cmd/boot/common/boot_utils.c +echo_file usr/src/cmd/boot/common/mboot_extra.c +echo_file usr/src/common/util/getresponse.c +echo_file usr/src/common/util/getresponse.h diff --git a/usr/src/cmd/boot/installgrub/installgrub.c b/usr/src/cmd/boot/installgrub/installgrub.c index 694193d9c7..0ae6749bcc 100644 --- a/usr/src/cmd/boot/installgrub/installgrub.c +++ b/usr/src/cmd/boot/installgrub/installgrub.c @@ -58,6 +58,7 @@ #include "./../common/bblk_einfo.h" #include "./../common/boot_utils.h" #include "./../common/mboot_extra.h" +#include "getresponse.h" #ifndef TEXT_DOMAIN #define TEXT_DOMAIN "SUNW_OST_OSCMD" @@ -131,6 +132,11 @@ main(int argc, char *argv[]) (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); + if (init_yes() < 0) { + (void) fprintf(stderr, gettext(ERR_MSG_INIT_YES), + strerror(errno)); + exit(BC_ERROR); + } /* * retro-compatibility: installing the bootblock is the default @@ -849,7 +855,7 @@ found_part: /* get confirmation for -m */ if (write_mbr && !force_mbr) { (void) fprintf(stdout, MBOOT_PROMPT); - if (getchar() != 'y') { + if (!yes()) { write_mbr = 0; (void) fprintf(stdout, MBOOT_NOT_UPDATED); return (BC_ERROR); diff --git a/usr/src/cmd/boot/installgrub/message.h b/usr/src/cmd/boot/installgrub/message.h index 6a2b98069d..2dc6caba6e 100644 --- a/usr/src/cmd/boot/installgrub/message.h +++ b/usr/src/cmd/boot/installgrub/message.h @@ -57,7 +57,7 @@ extern "C" { #define MBOOT_PROMPT \ gettext("Updating master boot sector destroys existing boot " \ - "managers (if any).\ncontinue (y/n)?") + "managers (if any).\ncontinue (y/n)? ") #define MBOOT_NOT_UPDATED gettext("master boot sector not updated\n") |