Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/usr.sbin/sysinst Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/0b10f84cbc23
branches:  netbsd-9
changeset: 962881:0b10f84cbc23
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Aug 28 10:00:53 2019 +0000

description:
Pull up following revision(s) (requested by martin in ticket #123):
        usr.sbin/sysinst/util.c: revision 1.32
        usr.sbin/sysinst/upgrade.c: revision 1.13
        usr.sbin/sysinst/defs.h: revision 1.44
Do not offer to upgrade the "current system" if we are running off a CD
(i.e. / is mounted read-only)

diffstat:

 usr.sbin/sysinst/defs.h    |   3 ++-
 usr.sbin/sysinst/upgrade.c |   6 +++---
 usr.sbin/sysinst/util.c    |  13 ++++++++++++-
 3 files changed, 17 insertions(+), 5 deletions(-)

diffs (71 lines):

diff -r 70b3e2f98807 -r 0b10f84cbc23 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Tue Aug 27 04:22:08 2019 +0000
+++ b/usr.sbin/sysinst/defs.h   Wed Aug 28 10:00:53 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.42.2.1 2019/08/08 05:51:43 msaitoh Exp $    */
+/*     $NetBSD: defs.h,v 1.42.2.2 2019/08/28 10:00:53 msaitoh Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -712,6 +712,7 @@
 bool   md_parts_use_wholedisk(struct disk_partitions*);
 
 /* from util.c */
+bool   root_is_read_only(void);
 void   get_ptn_alignment(const struct disk_partitions *parts, daddr_t *align, daddr_t *p0off);
 char*  str_arg_subst(const char *, size_t, const char **);
 void   msg_display_subst(const char *, size_t, ...);
diff -r 70b3e2f98807 -r 0b10f84cbc23 usr.sbin/sysinst/upgrade.c
--- a/usr.sbin/sysinst/upgrade.c        Tue Aug 27 04:22:08 2019 +0000
+++ b/usr.sbin/sysinst/upgrade.c        Wed Aug 28 10:00:53 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: upgrade.c,v 1.12 2019/07/23 18:13:40 martin Exp $      */
+/*     $NetBSD: upgrade.c,v 1.12.2.1 2019/08/28 10:00:53 msaitoh Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -64,7 +64,7 @@
 
        get_ramsize();
 
-       if (find_disks(msg_string(MSG_upgrade), true) < 0)
+       if (find_disks(msg_string(MSG_upgrade), !root_is_read_only()) < 0)
                return;
 
        if (pm->parts == NULL && !pm->cur_system) {
@@ -208,7 +208,7 @@
        if (!ask_noyes(NULL))
                return;
 
-       if (find_disks(msg_string(MSG_reinstall), true) < 0)
+       if (find_disks(msg_string(MSG_reinstall), !root_is_read_only()) < 0)
                return;
 
        if (!pm->cur_system) {
diff -r 70b3e2f98807 -r 0b10f84cbc23 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Tue Aug 27 04:22:08 2019 +0000
+++ b/usr.sbin/sysinst/util.c   Wed Aug 28 10:00:53 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.29.2.2 2019/08/18 13:29:15 msaitoh Exp $    */
+/*     $NetBSD: util.c,v 1.29.2.3 2019/08/28 10:00:53 msaitoh Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -537,6 +537,17 @@
        return 0;
 }
 
+bool
+root_is_read_only(void)
+{
+       struct statvfs sb;
+
+       if (statvfs("/", &sb) == 0)
+               return sb.f_flag & ST_RDONLY;
+
+       return false;
+}
+
 /*
  * Get from a CDROM distribution.
  * Also used on "installation using bootable install media"



Home | Main Index | Thread Index | Old Index