CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri Apr 5 16:44:54 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: remove dup named dir To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.62 src/usr.sbin/postinstall/postinstall.in:1.63 --- src/usr.sbin/postinstall/postinstall.in:1.62 Sun Mar 10 14:23:18 2024 +++ src/usr.sbin/postinstall/postinstall.in Fri Apr 5 12:44:54 2024 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.62 2024/03/10 18:23:18 rillig Exp $ +# $NetBSD: postinstall.in,v 1.63 2024/04/05 16:44:54 christos Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1706,6 +1706,12 @@ do_named() compare_dir "${op}" "${SRC_DIR}/etc/namedb" "${DEST_DIR}/etc/namedb" \ 644 \ root.cache + + local od="${DEST_DIR}/usr/libexec/named" + if [ -d "$od" ]; then + rm -fr "$od" + msg "Removed obsolete '${od}'" + fi }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri Apr 5 16:44:54 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: remove dup named dir To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: rillig Date: Sun Mar 10 18:23:18 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix parameter order in usage message To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.61 src/usr.sbin/postinstall/postinstall.in:1.62 --- src/usr.sbin/postinstall/postinstall.in:1.61 Sat Mar 9 06:51:40 2024 +++ src/usr.sbin/postinstall/postinstall.in Sun Mar 10 18:23:18 2024 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.61 2024/03/09 06:51:40 rillig Exp $ +# $NetBSD: postinstall.in,v 1.62 2024/03/10 18:23:18 rillig Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -235,7 +235,7 @@ check_dir() # check_ids() { - [ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id ..." + [ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file srcfile start id ..." local op="$1" local type="$2" local file="$3"
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: rillig Date: Sun Mar 10 18:23:18 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix parameter order in usage message To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: rillig Date: Sat Mar 9 06:51:40 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix endless loop (since 2024-03-07) To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: rillig Date: Sat Mar 9 06:51:40 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix endless loop (since 2024-03-07) To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.60 src/usr.sbin/postinstall/postinstall.in:1.61 --- src/usr.sbin/postinstall/postinstall.in:1.60 Thu Mar 7 22:03:16 2024 +++ src/usr.sbin/postinstall/postinstall.in Sat Mar 9 06:51:40 2024 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.60 2024/03/07 22:03:16 christos Exp $ +# $NetBSD: postinstall.in,v 1.61 2024/03/09 06:51:40 rillig Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -100,7 +100,7 @@ mkdtemp() while true; do dir="${base}.${serial}" mkdir -m 0700 "${dir}" && break - _serial=$((${serial} + 1)) + serial=$((${serial} + 1)) done echo "${dir}" }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Mar 7 22:03:16 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: no local in loops, simplify eval (thanks kre) To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.59 src/usr.sbin/postinstall/postinstall.in:1.60 --- src/usr.sbin/postinstall/postinstall.in:1.59 Thu Mar 7 11:54:16 2024 +++ src/usr.sbin/postinstall/postinstall.in Thu Mar 7 17:03:16 2024 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.59 2024/03/07 16:54:16 christos Exp $ +# $NetBSD: postinstall.in,v 1.60 2024/03/07 22:03:16 christos Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -95,9 +95,10 @@ mkdtemp() local base="/tmp/_postinstall.$$" local serial=0 + local dir while true; do - local dir="${base}.${serial}" + dir="${base}.${serial}" mkdir -m 0700 "${dir}" && break _serial=$((${serial} + 1)) done @@ -320,11 +321,11 @@ populate_dir() check_dir "${op}" "${dst}" 755 || return 1 local cmpdir_rv=0 - local f + local f fs fd error for f in "$@"; do - local fs="${src}/${f}" - local fd="${dst}/${f}" - local error="" + fs="${src}/${f}" + fd="${dst}/${f}" + error="" if [ ! -f "${fd}" ]; then error="${fd} does not exist" elif ! cmp -s "${fs}" "${fd}" ; then @@ -423,8 +424,7 @@ rcconf_is_set() [ -f "${f}" ] && . "${f}" done eval echo -n \"\${${var}}\" 1>&3 - if eval "[ -n \"\${${var}}\" \ - -o \"\${${var}-UNSET}\" != \"UNSET\" ]"; then + if eval "[ -n \"\${${var}+SET}\" ]"; then if [ -n "${verbose}" ]; then msg \ "Obsolete rc.conf(5) variable '\$${var}' found.${notfixed}" @@ -963,11 +963,11 @@ do_blocklist() { [ -n "$1" ] || err 3 "USAGE: do_blocklist fix|check" local op="$1" - local i + local i old # if we are actually using blocklistd for i in /var/db/blacklist.db /etc/blacklistd.conf; do - local old="${DEST_DIR}${i}" + old="${DEST_DIR}${i}" if [ ! -f "${old}" ]; then continue elif [ "$1" = "check" ]; then @@ -1068,6 +1068,7 @@ do_catpages() { local op="$1" local failed=0 + local manbase sec for manbase in /usr/share/man /usr/X11R6/man /usr/X11R7/man; do for sec in 1 2 3 4 5 6 7 8 9; do obsolete_catpages "$1" "${DEST_DIR}${manbase}" "${sec}" @@ -2200,8 +2201,8 @@ do_rc() ${extra_scripts} failed=$(( ${failed} + $? )) + local i rc_file for i in ${rc_external_files}; do - local rc_file case $i in *d) rc_file=${i};; *) rc_file=${i}d;; @@ -2527,6 +2528,7 @@ do_x11() notfixed="${NOT_FIXED}" fi + local d # check if /usr/X11R6/lib/X11 needs to migrate to /etc/X11 if [ -n "${libx11}" ]; then for d in \
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Mar 7 22:03:16 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: no local in loops, simplify eval (thanks kre) To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Mar 7 16:54:16 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: - fix named.conf (remove dnssec-enable option) - use proper local variables instead of adding _ or other prefixes. - centralize rm use - use grep -q instead of > /dev/null - reduce constant duplication To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Mar 7 16:54:16 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: - fix named.conf (remove dnssec-enable option) - use proper local variables instead of adding _ or other prefixes. - centralize rm use - use grep -q instead of > /dev/null - reduce constant duplication To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.58 src/usr.sbin/postinstall/postinstall.in:1.59 --- src/usr.sbin/postinstall/postinstall.in:1.58 Sun Jan 28 19:57:38 2024 +++ src/usr.sbin/postinstall/postinstall.in Thu Mar 7 11:54:16 2024 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.58 2024/01/29 00:57:38 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.59 2024/03/07 16:54:16 christos Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -60,6 +60,7 @@ : ${SED:=sed} : ${SORT:=sort} : ${STAT:=stat} +: ${RM:=rm} # # helper functions @@ -67,11 +68,11 @@ err() { - exitval=$1 + local exitval=$1 shift echo 1>&2 "${PROGNAME}: $*" if [ -n "${SCRATCHDIR}" ]; then - /bin/rm -rf "${SCRATCHDIR}" + ${RM} -rf "${SCRATCHDIR}" fi exit ${exitval} } @@ -92,15 +93,15 @@ mkdtemp() [ -d /tmp ] || err 2 /tmp is not a directory [ -w /tmp ] || err 2 /tmp is not writable - _base="/tmp/_postinstall.$$" - _serial=0 + local base="/tmp/_postinstall.$$" + local serial=0 while true; do - _dir="${_base}.${_serial}" - mkdir -m 0700 "${_dir}" && break - _serial=$((${_serial} + 1)) + local dir="${base}.${serial}" + mkdir -m 0700 "${dir}" && break + _serial=$((${serial} + 1)) done - echo "${_dir}" + echo "${dir}" } # Quote args to make them safe in the shell. @@ -131,7 +132,7 @@ shell_quote() # '\'''\'' sequences that result from multiple # adjacent quotes in he input. qarg="$(printf "%s\n" "$arg" | \ - ${SED:-sed} -e "s/'/'''/g" \ + ${SED} -e "s/'/'''/g" \ -e "1s/^/'/" -e "\$s/\$/'/" \ -e "1s/^''//" -e "\$s/''\$//" \ -e "s/'''/'/g" @@ -206,18 +207,18 @@ adddisableditem() check_dir() { [ $# -eq 3 ] || err 3 "USAGE: check_dir op dir mode" - _cdop="$1" - _cddir="$2" - _cdmode="$3" - [ -d "${_cddir}" ] && return 0 - if [ "${_cdop}" = "check" ]; then - msg "${_cddir} is not a directory" + local op="$1" + local dir="$2" + local mode="$3" + [ -d "${dir}" ] && return 0 + if [ "${op}" = "check" ]; then + msg "${dir} is not a directory" return 1 - elif ! mkdir -m "${_cdmode}" "${_cddir}" ; then - msg "Can't create missing ${_cddir}" + elif ! mkdir -m "${mode}" "${dir}" ; then + msg "Can't create missing ${dir}" return 1 else - msg "Missing ${_cddir} created" + msg "Missing ${dir} created" fi return 0 } @@ -234,27 +235,27 @@ check_dir() check_ids() { [ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id ..." - _op="$1" - _type="$2" - _file="$3" - _srcfile="$4" - _start="$5" + local op="$1" + local type="$2" + local file="$3" + local srcfile="$4" + local start="$5" shift 5 - #_ids="$@" + #local ids="$@" - if [ ! -f "${_file}" ]; then - msg "${_file} doesn't exist; can't check for missing ${_type}" + if [ ! -f "${file}" ]; then + msg "${file} doesn't exist; can't check for missing ${type}" return 1 fi - if [ ! -r "${_file}" ]; then - msg "${_file} is not readable; can't check for missing ${_type}" + if [ ! -r "${file}" ]; then + msg "${file} is not readable; can't check for missing ${type}" return 1 fi - _notfixed="" - if [ "${_op}" = "fix" ]; then - _notfixed="${NOT_FIXED}" + local notfixed="" + if [ "${op}" = "fix" ]; then + notfixed="${NOT_FIXED}" fi - _missing="$(${AWK} -v start=$_start -F: ' + local missing="$(${AWK} -v start=$start -F: ' BEGIN { for (x = 1; x < ARGC; x++) { if (ARGV[x] == "SKIP") @@ -278,14 +279,14 @@ check_ids() start++; } } - ' "$@" < "${_file}")" || return 1 - if [ -n "${_missing}" ]; then - msg "Error ${_type}${_notfixed}:" $(echo ${_missing}) + ' "$@" < "${file}")" || return 1 + if [ -n "${missing}" ]; then + msg "Error ${type}${notfixed}:" $(echo ${missing}) msg "Use the following as a template:" - set -- ${_missing} + set -- ${missing} while [ $# -gt 0 ] do - ${GREP} -E "^${1}:" ${_srcfile} + ${GREP} -E "^${1}:" ${srcfile} shift 2 done | sort -t: -k3n msg "and adjust if necessary." @@ -294,8 +295,8 @@ check_ids() return 0 } -# populate_dir op onlynew src dest mode file ... -# Perform op ("check" or "fix") on files in src/ against dest/ +# populate_dir op onlynew src dst mode file ... +# Perform op ("check" or "fix") on files in src/ against dst/ # If op = "check" display missing or changed files, optionally with
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Mon Jan 29 00:57:38 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Don't say /etc/openssl/certs.conf already exists. It's confusing when all the other `postinstall fix' actions are silent in the event they don't have anything to do. PR install/57885 To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.57 src/usr.sbin/postinstall/postinstall.in:1.58 --- src/usr.sbin/postinstall/postinstall.in:1.57 Wed Oct 18 13:10:34 2023 +++ src/usr.sbin/postinstall/postinstall.in Mon Jan 29 00:57:38 2024 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.57 2023/10/18 13:10:34 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.58 2024/01/29 00:57:38 riastradh Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1685,7 +1685,6 @@ do_opensslcertsconf() fix) # If /etc/openssl/certs.conf is already there, nothing # to do. if [ -r "$certsconf" ]; then - msg "/etc/openssl/certs.conf already exists" return 0 fi
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Mon Jan 29 00:57:38 UTC 2024 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Don't say /etc/openssl/certs.conf already exists. It's confusing when all the other `postinstall fix' actions are silent in the event they don't have anything to do. PR install/57885 To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Wed Oct 18 13:10:34 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Use /usr/sbin/certctl. Obviates need to have /usr/sbin in PATH when running this. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Wed Oct 18 13:10:34 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Use /usr/sbin/certctl. Obviates need to have /usr/sbin in PATH when running this. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.56 src/usr.sbin/postinstall/postinstall.in:1.57 --- src/usr.sbin/postinstall/postinstall.in:1.56 Wed Sep 6 13:38:54 2023 +++ src/usr.sbin/postinstall/postinstall.in Wed Oct 18 13:10:34 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.56 2023/09/06 13:38:54 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.57 2023/10/18 13:10:34 riastradh Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1763,7 +1763,7 @@ do_opensslcertsrehash() check) # Create a scratch rehash for comparison. mtreekeys="type,link" scratchdir="${SCRATCHDIR}/opensslcerts" - certctl -c "$scratchdir" rehash || return $? + /usr/sbin/certctl -c "$scratchdir" rehash || return $? # This will create ${scratchdir}/.certctl unless the # configuration is manual. If the configuration is @@ -1782,7 +1782,7 @@ do_opensslcertsrehash() # that we report a failure if /etc/openssl/certs # appears to be managed manually, but `manual' was not # specified in /etc/openssl/certs.conf. - certctl -n rehash || return $? + /usr/sbin/certctl -n rehash || return $? # Compare the trees with mtree(8). Inconveniently, # mtree returns status zero even if there are missing @@ -1810,7 +1810,7 @@ do_opensslcertsrehash() return 1 ;; esac - certctl rehash + /usr/sbin/certctl rehash ;; *) err 3 "USAGE: do_opensslcerts fix|check" ;;
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Wed Sep 6 13:38:54 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Modify default certs.conf. When manually configured /etc/openssl/certs is detected, just uncomment the `#manual' line in the default certs.conf rather than writing a new one. That way, you can switch to certctl-managed and still get the default path by just deleting /etc/openssl/certs and re-commenting the `manual' line. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.55 src/usr.sbin/postinstall/postinstall.in:1.56 --- src/usr.sbin/postinstall/postinstall.in:1.55 Sun Sep 3 18:31:36 2023 +++ src/usr.sbin/postinstall/postinstall.in Wed Sep 6 13:38:54 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.55 2023/09/03 18:31:36 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.56 2023/09/06 13:38:54 riastradh Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1668,7 +1668,7 @@ do_named() additem opensslcertsconf "ensure TLS trust anchor configuration exists" do_opensslcertsconf() { - local certsdir certsconf defaultconf + local certsdir certsconf defaultconf manualmsg [ -n "$1" ] || err 3 "USAGE: do_opensslcertsconf fix|check" @@ -1701,15 +1701,40 @@ do_opensslcertsconf() -maxdepth 0 -type d -empty -exit 1) then msg "/etc/openssl/certs appears manually configured" - cat <${certsconf}.tmp -netbsd-certctl 20230816 - -# existing /etc/openssl/certs configuration detected by postinstall(8) -manual -EOF + manualmsg="[existing /etc/openssl/certs configuration" + manualmsg="$manualmsg detected by postinstall(8)]" +# Change the commented-out `#manual' line to +# uncommented `manual', or print an error +# message if there is no `#manual' line and put +# `manual' at the end. +awk -v defaultconf="$defaultconf" \ + -v manualmsg="$manualmsg" ' +BEGIN { + manual = 0 +} +/^#manual/ && !manual { + manual = 1 + sub(/^#/, "") + print + print "#", manualmsg + next +} +{ + print +} +END { + if (!manual) { + printf "warning: %s %s?\n", \ + "corrupt", defaultconf \ + >"/dev/stderr" + print "manual" + print "#", manualmsg + } +} + ' <$defaultconf >${certsconf}.tmp else msg "installing default /etc/openssl/certs.conf" - cp -- "$defaultconf" "${certsconf}.tmp" + cat <$defaultconf >${certsconf}.tmp fi && mv -f -- "${certsconf}.tmp" "$certsconf" ;; *) err 3 "USAGE: do_opensslcerts fix|check"
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Wed Sep 6 13:38:54 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Modify default certs.conf. When manually configured /etc/openssl/certs is detected, just uncomment the `#manual' line in the default certs.conf rather than writing a new one. That way, you can switch to certctl-managed and still get the default path by just deleting /etc/openssl/certs and re-commenting the `manual' line. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Sun Sep 3 18:31:36 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Handle various certs.conf scenarios gracefully. Tested the following scenarios: 1. fresh install empty /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash [x] check: fail -- needs rehash [x] fix: pass -- quietly rehash successfully (go to 4) 2. fresh upgrade empty /etc/openssl/certs no /etc/openssl/certs.conf - opensslcertsconf [x] check: fail -- complain missing /etc/openssl/certs.conf [x] fix: pass -- install default /etc/openssl/certs.conf (go to 1) - opensslcertsrehash [x] check: fail -- complain missing /etc/openssl/certs.conf - [x] fix: fail -- complain missing /etc/openssl/certs.conf 3. upgrade from certctl, changes to certs certctl-managed /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash [x] check: fail -- needs rehash [x] fix: pass -- quietly rehash successfully (go to 4) 4. upgrade from certctl, no changes to certs certctl-managed /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash [x] check: pass [x] fix: pass -- quietly rehash successfully (go to 4) 5. upgrade from mozilla-rootcerts populated /etc/openssl/certs no /etc/openssl/certs.conf - opensslcertsconf: [x] check: fail -- complain missing /etc/openssl/certs.conf [x] fix: pass -- install manual /etc/openssl/certs.conf (go to 7) - opensslcertsrehash: [x] check: fail -- complain missing /etc/openssl/certs.conf [x] fix: fail -- complain missing /etc/openssl/certs.conf 6. upgrade from mozilla-rootcerts with etcupdate naively populated /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf: [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash: [x] check: fail -- complain mismatched certs/ and certs.conf [x] fix: fail -- complain mismatched certs/ and certs.conf 7. upgrade from mozilla-rootcerts with etcupdate manually populated /etc/openssl/certs manual /etc/openssl/certs.conf - opensslcertsconf: [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash: [x] check: pass [x] fix: pass -- skip rehash because manual (go to 7) XXX Someone should draft automatic tests for postinstall. It has a very good track record, but it sure would be nice to automate this testing rather than redo it each time I make a tiny change. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Sun Sep 3 18:31:36 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Handle various certs.conf scenarios gracefully. Tested the following scenarios: 1. fresh install empty /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash [x] check: fail -- needs rehash [x] fix: pass -- quietly rehash successfully (go to 4) 2. fresh upgrade empty /etc/openssl/certs no /etc/openssl/certs.conf - opensslcertsconf [x] check: fail -- complain missing /etc/openssl/certs.conf [x] fix: pass -- install default /etc/openssl/certs.conf (go to 1) - opensslcertsrehash [x] check: fail -- complain missing /etc/openssl/certs.conf - [x] fix: fail -- complain missing /etc/openssl/certs.conf 3. upgrade from certctl, changes to certs certctl-managed /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash [x] check: fail -- needs rehash [x] fix: pass -- quietly rehash successfully (go to 4) 4. upgrade from certctl, no changes to certs certctl-managed /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash [x] check: pass [x] fix: pass -- quietly rehash successfully (go to 4) 5. upgrade from mozilla-rootcerts populated /etc/openssl/certs no /etc/openssl/certs.conf - opensslcertsconf: [x] check: fail -- complain missing /etc/openssl/certs.conf [x] fix: pass -- install manual /etc/openssl/certs.conf (go to 7) - opensslcertsrehash: [x] check: fail -- complain missing /etc/openssl/certs.conf [x] fix: fail -- complain missing /etc/openssl/certs.conf 6. upgrade from mozilla-rootcerts with etcupdate naively populated /etc/openssl/certs default /etc/openssl/certs.conf - opensslcertsconf: [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash: [x] check: fail -- complain mismatched certs/ and certs.conf [x] fix: fail -- complain mismatched certs/ and certs.conf 7. upgrade from mozilla-rootcerts with etcupdate manually populated /etc/openssl/certs manual /etc/openssl/certs.conf - opensslcertsconf: [x] check: pass [x] fix: pass -- nothing - opensslcertsrehash: [x] check: pass [x] fix: pass -- skip rehash because manual (go to 7) XXX Someone should draft automatic tests for postinstall. It has a very good track record, but it sure would be nice to automate this testing rather than redo it each time I make a tiny change. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.54 src/usr.sbin/postinstall/postinstall.in:1.55 --- src/usr.sbin/postinstall/postinstall.in:1.54 Mon Aug 28 23:57:08 2023 +++ src/usr.sbin/postinstall/postinstall.in Sun Sep 3 18:31:36 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.54 2023/08/28 23:57:08 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.55 2023/09/03 18:31:36 riastradh Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1662,24 +1662,126 @@ do_named() # -# opensslcerts +# opensslcertsconf # -additem opensslcerts "build /etc/openssl/certs cache of HTTPS CA certificates" -do_opensslcerts() +additem opensslcertsconf "ensure TLS trust anchor configuration exists" +do_opensslcertsconf() { - [ -n "$1" ] || err 3 "USAGE: do_opensslcerts fix|check" + local certsdir certsconf defaultconf + + [ -n "$1" ] || err 3 "USAGE: do_opensslcertsconf fix|check" + + certsdir="${DEST_DIR}/etc/openssl/certs" + certsconf="${DEST_DIR}/etc/openssl/certs.conf" + defaultconf="${DEST_DIR}/usr/share/examples/certctl/certs.conf" case $1 in - check) # XXX Anything to check? - return 0 + check) if [ ! -r "$certsconf" ]; then + msg "/etc/openssl/certs.conf missing; see certctl(8)" + return 1 + fi + ;; + fix) # If /etc/openssl/certs.conf is already there, nothing + # to do. + if [ -r "$certsconf" ]; then + msg "/etc/openssl/certs.conf already exists" + return 0 + fi + + # If /etc/openssl/certs is a symlink, or exists but is + # not a directory, or is a directory but is nonempty, + # then either it's managed by someone else or something + # fishy is afoot. So set it manual in that case. + # Otherwise, install the default config file. + if [ -h "$certsdir" ] || + [ -e "$certsdir" -a ! -d "$certsdir" ] || + ([ -d "$certsdir" ] && + find -f "$certsdir" -- \ + -maxdepth 0 -type d -empty -exit 1) +
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Mon Aug 28 23:57:08 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Fail if `certctl rehash' fails. Not using `set -e' here, evidently (maybe we should), so the separate return 0 suppressed the error. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.53 src/usr.sbin/postinstall/postinstall.in:1.54 --- src/usr.sbin/postinstall/postinstall.in:1.53 Sat Aug 26 05:59:00 2023 +++ src/usr.sbin/postinstall/postinstall.in Mon Aug 28 23:57:08 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.53 2023/08/26 05:59:00 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.54 2023/08/28 23:57:08 riastradh Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1684,7 +1684,6 @@ do_opensslcerts() ;; esac certctl rehash - return 0 ;; *) err 3 "USAGE: do_opensslcerts fix|check" ;;
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Mon Aug 28 23:57:08 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Fail if `certctl rehash' fails. Not using `set -e' here, evidently (maybe we should), so the separate return 0 suppressed the error. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Sat Aug 26 05:59:00 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Add opensslcerts item to regen /etc/openssl/certs. Works only with destdir /, since it relies on running openssl(1), which is not available as a tool or required in the cross-build environment. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Sat Aug 26 05:59:00 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall(8): Add opensslcerts item to regen /etc/openssl/certs. Works only with destdir /, since it relies on running openssl(1), which is not available as a tool or required in the cross-build environment. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.52 src/usr.sbin/postinstall/postinstall.in:1.53 --- src/usr.sbin/postinstall/postinstall.in:1.52 Wed Jun 21 18:46:06 2023 +++ src/usr.sbin/postinstall/postinstall.in Sat Aug 26 05:59:00 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.52 2023/06/21 18:46:06 mrg Exp $ +# $NetBSD: postinstall.in,v 1.53 2023/08/26 05:59:00 riastradh Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1662,6 +1662,37 @@ do_named() # +# opensslcerts +# + +additem opensslcerts "build /etc/openssl/certs cache of HTTPS CA certificates" +do_opensslcerts() +{ + [ -n "$1" ] || err 3 "USAGE: do_opensslcerts fix|check" + + case $1 in + check) # XXX Anything to check? + return 0 + ;; + fix) # This runs openssl(1), which is not available as a + # build-time tool. So for now, restrict it to running + # on the installed system. + case $DEST_DIR in + ''|/) ;; + *) msg "opensslcerts limited to DEST_DIR=/" + return 1 + ;; + esac + certctl rehash + return 0 + ;; + *) err 3 "USAGE: do_opensslcerts fix|check" + ;; + esac +} + + +# # pam #
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: mrg Date: Wed Jun 21 18:46:06 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: adjust for new fontconfig files. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: mrg Date: Wed Jun 21 18:46:06 UTC 2023 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: adjust for new fontconfig files. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.51 src/usr.sbin/postinstall/postinstall.in:1.52 --- src/usr.sbin/postinstall/postinstall.in:1.51 Sun May 29 10:47:40 2022 +++ src/usr.sbin/postinstall/postinstall.in Wed Jun 21 18:46:06 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.51 2022/05/29 10:47:40 andvar Exp $ +# $NetBSD: postinstall.in,v 1.52 2023/06/21 18:46:06 mrg Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -1318,9 +1318,9 @@ do_fontconfig() fi local regular_fonts=" 10-autohint.conf -10-no-sub-pixel.conf 10-scale-bitmap-fonts.conf 10-sub-pixel-bgr.conf +10-sub-pixel-none.conf 10-sub-pixel-rgb.conf 10-sub-pixel-vbgr.conf 10-sub-pixel-vrgb.conf
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:57:32 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.8 Log Message: postinstall(8); add -?. expand operation usage To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/postinstall/postinstall.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.8 diff -u src/usr.sbin/postinstall/postinstall.8:1.20 src/usr.sbin/postinstall/postinstall.8:1.21 --- src/usr.sbin/postinstall/postinstall.8:1.20 Wed Nov 21 20:13:09 2018 +++ src/usr.sbin/postinstall/postinstall.8 Sat Jan 8 23:57:32 2022 @@ -1,6 +1,6 @@ -.\" $NetBSD: postinstall.8,v 1.20 2018/11/21 20:13:09 martin Exp $ +.\" $NetBSD: postinstall.8,v 1.21 2022/01/08 23:57:32 lukem Exp $ .\" -.\" Copyright (c) 2005-2008 The NetBSD Foundation, Inc. +.\" Copyright (c) 2005-2022 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 20, 2018 +.Dd January 9, 2022 .Dt POSTINSTALL 8 .Os .Sh NAME @@ -38,10 +38,12 @@ .Op Fl a Ar arch .Op Fl d Ar destdir .Op Fl m Ar machine -.Op Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile +.Op Fl s Pq Ar srcdir | Ar tgzdir | Ar tgzfile .Op Fl x Ar xsrcdir .Ar operation -.Op Ar item Op ... +.Ar \&... +.Nm postinstall +.Fl \&? .Sh DESCRIPTION The .Nm @@ -73,7 +75,7 @@ Defaults to .It Fl m Ar machine MACHINE. Defaults to machine of the host operating system. -.It Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile +.It Fl s Pq Ar srcdir | Ar tgzdir | Ar tgzfile The location of the reference files, or the .Nx source files used to create the reference files. @@ -130,19 +132,21 @@ Location of the X11 source files. This must be a directory that contains a .Nx xsrc tree. +.It Fl \&? +Display help to stdout, and exit. .El .Pp The .Ar operation argument may be one of: .Bl -tag -width usageXX -offset indent -.It Cm check +.It Cm check Ar item Ar \&... Perform post-installation checks on items. -.It Cm diff Op Xr diff 1 Li options +.It Cm diff Oo Fl Ar bcenpuw Oc Ar item Ar \&... Similar to .Cm check , but also show the differences between the files. -.It Cm fix +.It Cm fix Ar item Ar \&... Apply fixes that .Cm check determines need to be applied. @@ -160,14 +164,13 @@ See .Xr etcupdate 8 for an alternative update method that is able to merge files. .It Cm help -Display a short help. +Display help to stdout, and exit. .It Cm list List available .Ar items , showing if they are enabled or disabled by default. .It Cm usage -Same as -.Cm help . +Display help to stdout, and exit. .El .Sh EXIT STATUS The
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:57:32 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.8 Log Message: postinstall(8); add -?. expand operation usage To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/postinstall/postinstall.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:30:42 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: improve -s usage Reword -s SRC_ARG to be a bit clearer as to the variations, and sync more with postinstall(8). To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.49 src/usr.sbin/postinstall/postinstall.in:1.50 --- src/usr.sbin/postinstall/postinstall.in:1.49 Sat Jan 8 23:07:17 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 23:30:41 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.49 2022/01/08 23:07:17 lukem Exp $ +# $NetBSD: postinstall.in,v 1.50 2022/01/08 23:30:41 lukem Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -2541,7 +2541,7 @@ do_obsolete() help() { cat << _USAGE_ -Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_DIR] [-x XSRC_DIR] OPERATION ... +Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_ARG] [-x XSRC_DIR] OPERATION ... ${PROGNAME} -? Perform post-installation checks and/or fixes on a system's @@ -2553,14 +2553,16 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI -a ARCH Set \$MACHINE_ARCH to ARCH. [${MACHINE_ARCH}] -d DEST_DIR Destination directory to check. [${DEST_DIR:-/}] -m MACHINE Set \$MACHINE to MACHINE. [${MACHINE}] - -s SRC_DIR Location of the source files. This may be any of + -s SRC_ARG Location of the source files. This may be any of the following: - * A directory that contains a NetBSD source tree; - * A distribution set file such as "etc.tgz" or - "xetc.tgz". Pass multiple -s options to specify - multiple such files; - * A temporary directory in which one or both of - "etc.tgz" and "xetc.tgz" have been extracted. + -s SRC_DIR A directory that contains a NetBSD + source tree. + -s TGZ_DIR A directory in which one or both of + "etc.tgz" and "xetc.tgz" have been + extracted. + -s TGZ_FILE A distribution set file such as + "etc.tgz" or "xetc.tgz". + May be specified multipled times. [${SRC_DIR:-/usr/src}] -x XSRC_DIR Location of the X11 source files. This must be a directory that contains a NetBSD xsrc tree.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:30:42 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: improve -s usage Reword -s SRC_ARG to be a bit clearer as to the variations, and sync more with postinstall(8). To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:07:17 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: tweak -a and -m usage To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:07:17 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: tweak -a and -m usage To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.48 src/usr.sbin/postinstall/postinstall.in:1.49 --- src/usr.sbin/postinstall/postinstall.in:1.48 Sat Jan 8 23:04:11 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 23:07:17 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.48 2022/01/08 23:04:11 lukem Exp $ +# $NetBSD: postinstall.in,v 1.49 2022/01/08 23:07:17 lukem Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -2550,9 +2550,9 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI Options: -? Display this help, and exit. - -a ARCH \$MACHINE_ARCH. [${MACHINE_ARCH}] + -a ARCH Set \$MACHINE_ARCH to ARCH. [${MACHINE_ARCH}] -d DEST_DIR Destination directory to check. [${DEST_DIR:-/}] - -m MACHINE \$MACHINE. [${MACHINE}] + -m MACHINE Set \$MACHINE to MACHINE. [${MACHINE}] -s SRC_DIR Location of the source files. This may be any of the following: * A directory that contains a NetBSD source tree;
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:04:11 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: add -? to usage To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.47 src/usr.sbin/postinstall/postinstall.in:1.48 --- src/usr.sbin/postinstall/postinstall.in:1.47 Sat Jan 8 06:58:40 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 23:04:11 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.47 2022/01/08 06:58:40 lukem Exp $ +# $NetBSD: postinstall.in,v 1.48 2022/01/08 23:04:11 lukem Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -2549,6 +2549,7 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI If no items are provided, a default set of checks or fixes is applied. Options: + -? Display this help, and exit. -a ARCH \$MACHINE_ARCH. [${MACHINE_ARCH}] -d DEST_DIR Destination directory to check. [${DEST_DIR:-/}] -m MACHINE \$MACHINE. [${MACHINE}] @@ -2566,14 +2567,14 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI [${XSRC_DIR:-/usr/src/../xsrc}] Supported values for OPERATION: - help Display this help. + help Display this help, and exit. list List available items. check ITEM ... Perform post-installation checks on ITEMs. diff [-bcenpuw] ITEM ... Similar to 'check' but also output difference of files, using diff with the provided options. fix ITEM ... Apply fixes that 'check' determines need to be applied. - usage Display this usage. + usage Display this help, and exit. _USAGE_ }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 23:04:11 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: add -? to usage To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:58:40 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: add -?. improve option errors Support -? to show help. Implemented using getopts "leading colon optstring" feature. Improve error messages for unknown options and missing arguments. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.46 src/usr.sbin/postinstall/postinstall.in:1.47 --- src/usr.sbin/postinstall/postinstall.in:1.46 Sat Jan 8 06:57:34 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 06:58:40 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.46 2022/01/08 06:57:34 lukem Exp $ +# $NetBSD: postinstall.in,v 1.47 2022/01/08 06:58:40 lukem Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -2542,6 +2542,8 @@ help() { cat << _USAGE_ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_DIR] [-x XSRC_DIR] OPERATION ... + ${PROGNAME} -? + Perform post-installation checks and/or fixes on a system's configuration files. If no items are provided, a default set of checks or fixes is applied. @@ -2567,9 +2569,9 @@ Usage: ${PROGNAME} [-a ARCH] [-d DEST_DI help Display this help. list List available items. check ITEM ... Perform post-installation checks on ITEMs. - diff [DIFFOPT] ITEM ... + diff [-bcenpuw] ITEM ... Similar to 'check' but also output difference of files, - using diff [DIFFOPT]. + using diff with the provided options. fix ITEM ... Apply fixes that 'check' determines need to be applied. usage Display this usage. _USAGE_ @@ -2626,7 +2628,7 @@ main() # Validate options. # - while getopts a:d:m:s:x: ch; do + while getopts :a:d:m:s:x: ch; do case "${ch}" in a) MACHINE_ARCH="${OPTARG}" @@ -2675,9 +2677,23 @@ main() err 2 "Not a directory for -x option" fi ;; - *) + "?") + if [ "${OPTARG}" = "?" ]; then +help +return # no further processing or validation + fi + warn "Unknown option -${OPTARG}" + usage + ;; + + :) + warn "Missing argument for option -${OPTARG}" usage ;; + + *) + err 3 "Unimplemented option -${ch}" + ;; esac done shift $((${OPTIND} - 1)) @@ -2706,20 +2722,30 @@ main() op=check DIFF_STYLE=n # default style is RCS OPTIND=1 - while getopts bcenpuw ch; do + while getopts :bcenpuw ch; do case "${ch}" in c|e|n|u) if [ "${DIFF_STYLE}" != "n" -a \ "${DIFF_STYLE}" != "${ch}" ]; then - err 2 "diff: conflicting output style: ${ch}" + warn "diff: conflicting output style: -${ch}" + usage fi DIFF_STYLE="${ch}" ;; b|p|w) DIFF_OPT="${DIFF_OPT} -${ch}" ;; + "?") +# NOTE: not supporting diff -? +warn "diff: Unknown option -${OPTARG}" +usage +;; + :) +warn "diff: Missing argument for option -${OPTARG}" +usage +;; *) -err 2 "diff: unknown option" +err 3 "diff: Unimplemented option -${ch}" ;; esac done
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:58:40 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: add -?. improve option errors Support -? to show help. Implemented using getopts "leading colon optstring" feature. Improve error messages for unknown options and missing arguments. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:57:34 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: usage improvements Show options alphabetically. Use UPPER_CASE instead of lowercase as the convention for argument names. Provide per-OPERATION argument usage. Implement options alphabetically. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.45 src/usr.sbin/postinstall/postinstall.in:1.46 --- src/usr.sbin/postinstall/postinstall.in:1.45 Sat Jan 8 06:56:43 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 06:57:34 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.45 2022/01/08 06:56:43 lukem Exp $ +# $NetBSD: postinstall.in,v 1.46 2022/01/08 06:57:34 lukem Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -2541,15 +2541,17 @@ do_obsolete() help() { cat << _USAGE_ -Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] operation [item ...] +Usage: ${PROGNAME} [-a ARCH] [-d DEST_DIR] [-m MACHINE] [-s SRC_DIR] [-x XSRC_DIR] OPERATION ... Perform post-installation checks and/or fixes on a system's configuration files. If no items are provided, a default set of checks or fixes is applied. Options: - -s {srcdir|tgzfile|tempdir} - Location of the source files. This may be any - of the following: + -a ARCH \$MACHINE_ARCH. [${MACHINE_ARCH}] + -d DEST_DIR Destination directory to check. [${DEST_DIR:-/}] + -m MACHINE \$MACHINE. [${MACHINE}] + -s SRC_DIR Location of the source files. This may be any of + the following: * A directory that contains a NetBSD source tree; * A distribution set file such as "etc.tgz" or "xetc.tgz". Pass multiple -s options to specify @@ -2557,21 +2559,19 @@ Usage: ${PROGNAME} [-s srcdir] [-x xsrcd * A temporary directory in which one or both of "etc.tgz" and "xetc.tgz" have been extracted. [${SRC_DIR:-/usr/src}] - -x xsrcdir Location of the X11 source files. This must be + -x XSRC_DIR Location of the X11 source files. This must be a directory that contains a NetBSD xsrc tree. [${XSRC_DIR:-/usr/src/../xsrc}] - -d destdir Destination directory to check. [${DEST_DIR:-/}] - -m mach MACHINE. [${MACHINE}] - -a arch MACHINE_ARCH. [${MACHINE_ARCH}] - - Supported values for operation: - help Display this help. - list List available items. - check Perform post-installation checks on items. - diff [diff(1) options ...] - Similar to 'check' but also output difference of files. - fix Apply fixes that 'check' determines need to be applied. - usage Display this usage. + + Supported values for OPERATION: + help Display this help. + list List available items. + check ITEM ... Perform post-installation checks on ITEMs. + diff [DIFFOPT] ITEM ... + Similar to 'check' but also output difference of files, + using diff [DIFFOPT]. + fix ITEM ... Apply fixes that 'check' determines need to be applied. + usage Display this usage. _USAGE_ } @@ -2626,8 +2626,17 @@ main() # Validate options. # - while getopts s:x:d:m:a: ch; do + while getopts a:d:m:s:x: ch; do case "${ch}" in + a) + MACHINE_ARCH="${OPTARG}" + ;; + d) + DEST_DIR="${OPTARG}" + ;; + m) + MACHINE="${OPTARG}" + ;; s) qarg="$(shell_quote "${OPTARG}")" N_SRC_ARGS=$(( $N_SRC_ARGS + 1 )) @@ -2666,15 +2675,6 @@ main() err 2 "Not a directory for -x option" fi ;; - d) - DEST_DIR="${OPTARG}" - ;; - m) - MACHINE="${OPTARG}" - ;; - a) - MACHINE_ARCH="${OPTARG}" - ;; *) usage ;;
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:57:34 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: usage improvements Show options alphabetically. Use UPPER_CASE instead of lowercase as the convention for argument names. Provide per-OPERATION argument usage. Implement options alphabetically. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:56:43 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: improve validation and help Validate the operation and items before extracting any etc.tgz, so that help or errors are displayed quicker, for a better user experience. Style: - Rename todo to ITEMS. - Order processing of list after check. - Ensure DIFF_OPT is initialised, for consistency. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.44 src/usr.sbin/postinstall/postinstall.in:1.45 --- src/usr.sbin/postinstall/postinstall.in:1.44 Sat Jan 8 06:55:13 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 06:56:43 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.44 2022/01/08 06:55:13 lukem Exp $ +# $NetBSD: postinstall.in,v 1.45 2022/01/08 06:56:43 lukem Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -2598,13 +2598,13 @@ list() eval desc=\"\${desc_${i}}\" printf " %-20s %s\n" "${i}" "${desc}" done - } main() { DIRMODE=false # true if "-s" specified a directory + ITEMS= # items to check|diff|fix. [${defaultitems}] N_SRC_ARGS=0 # number of "-s" args in SRC_ARGLIST SOURCEMODE=false # true if "-s" specified a source directory SRC_ARGLIST= # quoted list of one or more "-s" args @@ -2624,6 +2624,8 @@ main() ;; esac + # Validate options. + # while getopts s:x:d:m:a: ch; do case "${ch}" in s) @@ -2683,6 +2685,8 @@ main() warn "Missing operation" usage fi + op="$1" + shift if [ "$N_SRC_ARGS" -gt 1 ] && $DIRMODE; then err 2 "Multiple -s args are allowed only with tgz files" @@ -2694,6 +2698,68 @@ main() SRC_ARGLIST="-s $(shell_quote "${SRC_ARG}")" fi + # Validate 'diff' first, as it becomes 'check' + # + case "${op}" in + + diff) + op=check + DIFF_STYLE=n # default style is RCS + OPTIND=1 + while getopts bcenpuw ch; do + case "${ch}" in + c|e|n|u) +if [ "${DIFF_STYLE}" != "n" -a \ +"${DIFF_STYLE}" != "${ch}" ]; then + err 2 "diff: conflicting output style: ${ch}" +fi +DIFF_STYLE="${ch}" +;; + b|p|w) +DIFF_OPT="${DIFF_OPT} -${ch}" +;; + *) +err 2 "diff: unknown option" +;; + esac + done + shift $((${OPTIND} - 1)) + ;; + + esac + + # Validate operation and items. + # + case "${op}" in + + check|fix) + ITEMS="$*" + : ${ITEMS:="${defaultitems}"} + + # ensure that all supplied items are valid + # + for i in ${ITEMS}; do + eval desc=\"\${desc_${i}}\" + [ -n "${desc}" ] || err 2 "Unsupported ${op} '"${i}"'" + done + ;; + + help|usage) + help + return # no further processing or validation + ;; + + list) + # processed below + ;; + + *) + warn "Unknown operation '"${op}"'" + usage + ;; + + esac + # # If '-s' arg or args specified tgz files, extract them # to a scratch directory. @@ -2736,63 +2802,13 @@ main() detect_x11 - op="$1" - shift - - case "${op}" in - diff) - op=check - DIFF_STYLE=n # default style is RCS - OPTIND=1 - while getopts bcenpuw ch; do - case "${ch}" in - c|e|n|u) -if [ "${DIFF_STYLE}" != "n" -a \ -"${DIFF_STYLE}" != "${ch}" ]; then - err 2 "conflicting output style: ${ch}" -fi -DIFF_STYLE="${ch}" -;; - b|p|w) -DIFF_OPT="${DIFF_OPT} -${ch}" -;; - *) -err 2 "unknown diff option" -;; - esac - done - shift $((${OPTIND} - 1)) - ;; - esac - + # Perform operation. + # case "${op}" in - usage|help) - help - ;; - - list) - echo "Source directory: ${SRC_DIR:-/}" - echo "Target directory: ${DEST_DIR:-/}" - if $TGZMODE; then - echo " (extracted from: ${SRC_ARG})" - fi - list - ;; - check|fix) - todo="$*" - : ${todo:="${defaultitems}"} - - # ensure that all supplied items are valid - # - for i in ${todo}; do - eval desc=\"\${desc_${i}}\" - [ -n "${desc}" ] || err 2 "Unsupported ${op} '"${i}"'" - done + [ -n "${ITEMS}" ] || err 2 "${op}: missing items" - # perform each check/fix - # echo "Source directory: ${SRC_DIR:-/}" if $TGZMODE; then echo " (extracted from: ${SRC_ARG})" @@ -2800,7 +2816,7 @@ main() echo "Target directory: ${DEST_DIR:-/}" items_passed= items_failed= - for i in ${todo}; do + for i in ${ITEMS}; do echo "${i} ${op}:" ( eval do_${i} ${op} ) if [ $? -eq 0 ]; then @@ -2829,12 +2845,20 @@ Note that this may overwrite local chang _Fix_me_ fi fi + ;; + list) + echo "Source directory: ${SRC_DIR:-/}" + echo "Target directory: ${DEST_DIR:-/}" + if $TGZMODE; then + echo " (extracted from: ${SRC_ARG})" + fi + list ;; *) - warn "Unknown operation '"${op}"'" - usage + #
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:55:13 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: style tweaks Fix ... in comments and internal errors. Sort variables declared at top of main(), for easier review. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.43 src/usr.sbin/postinstall/postinstall.in:1.44 --- src/usr.sbin/postinstall/postinstall.in:1.43 Sat Jan 8 06:53:58 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 06:55:13 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.43 2022/01/08 06:53:58 lukem Exp $ +# $NetBSD: postinstall.in,v 1.44 2022/01/08 06:55:13 lukem Exp $ # # Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. @@ -222,7 +222,7 @@ check_dir() return 0 } -# check_ids op type file srcfile start id [...] +# check_ids op type file srcfile start id ... # Check if file of type "users" or "groups" contains the relevant IDs. # Use srcfile as a reference for the expected contents. # The specified "id" names should be given in numerical order, @@ -233,7 +233,7 @@ check_dir() # check_ids() { - [ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id [...]" + [ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id ..." _op="$1" _type="$2" _file="$3" @@ -294,7 +294,7 @@ check_ids() return 0 } -# populate_dir op onlynew src dest mode file [file ...] +# populate_dir op onlynew src dest mode file ... # Perform op ("check" or "fix") on files in src/ against dest/ # If op = "check" display missing or changed files, optionally with diffs. # If op != "check" copies any missing or changed files. @@ -303,7 +303,7 @@ check_ids() # populate_dir() { - [ $# -ge 5 ] || err 3 "USAGE: populate_dir op onlynew src dest mode file [...]" + [ $# -ge 5 ] || err 3 "USAGE: populate_dir op onlynew src dest mode file ..." _op="$1" _onlynew="$2" _src="$3" @@ -353,7 +353,7 @@ populate_dir() return ${_cmpdir_rv} } -# compare_dir op src dest mode file [file ...] +# compare_dir op src dest mode file ... # Perform op ("check" or "fix") on files in src/ against dest/ # If op = "check" display missing or changed files, optionally with diffs. # If op != "check" copies any missing or changed files. @@ -361,7 +361,7 @@ populate_dir() # compare_dir() { - [ $# -ge 4 ] || err 3 "USAGE: compare_dir op src dest mode file [...]" + [ $# -ge 4 ] || err 3 "USAGE: compare_dir op src dest mode file ..." _op="$1" _src="$2" _dest="$3" @@ -457,7 +457,7 @@ rcvar_is_enabled() ) } -# find_file_in_dirlist() file message dir1 [...] -- +# find_file_in_dirlist() file message dir1 ... -- # Find which directory file is in, and sets ${dir} to match. # Returns 0 if matched, otherwise 1 (and sets ${dir} to ""). # @@ -466,7 +466,7 @@ rcvar_is_enabled() # find_file_in_dirlist() { - [ $# -ge 3 ] || err 3 "USAGE: find_file_in_dirlist file msg dir1 [...]" + [ $# -ge 3 ] || err 3 "USAGE: find_file_in_dirlist file msg dir1 ..." _file="$1" ; shift _msg="$1" ; shift @@ -756,12 +756,12 @@ contents_owner() fi } -# get_makevar var [var ...] +# get_makevar var ... # Retrieve the value of a user-settable system make variable get_makevar() { $SOURCEMODE || err 3 "get_makevar must be used in source mode" - [ $# -eq 0 ] && err 3 "USAGE: get_makevar var [var ...]" + [ $# -eq 0 ] && err 3 "USAGE: get_makevar var ..." for _var in "$@"; do _value="$(echo '.include ' | \ @@ -2604,14 +2604,15 @@ list() main() { - TGZLIST= # quoted list list of tgz files + DIRMODE=false # true if "-s" specified a directory + N_SRC_ARGS=0 # number of "-s" args in SRC_ARGLIST + SOURCEMODE=false # true if "-s" specified a source directory SRC_ARGLIST= # quoted list of one or more "-s" args SRC_DIR="${SRC_ARG}" # set default value for early usage() - XSRC_DIR="${SRC_ARG}/../xsrc" - N_SRC_ARGS=0 # number of "-s" args + TGZLIST= # quoted list list of tgz files TGZMODE=false # true if "-s" specifies a tgz file - DIRMODE=false # true if "-s" specified a directory - SOURCEMODE=false # true if "-s" specified a source directory + XSRC_DIR="${SRC_ARG}/../xsrc" + XSRC_DIR_FIX= case "$(uname -s)" in Darwin)
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:55:13 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: style tweaks Fix ... in comments and internal errors. Sort variables declared at top of main(), for easier review. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:53:58 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: help to stdout. usage tweaks When invoked as "help" or "usage", send the usage to stdout instead of stderr, so that it's easier to pipe to a pager. Explicitly warn that the operation is missing. Tweak the usage; "operation" instead of "op", no need for [] around ... To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.42 src/usr.sbin/postinstall/postinstall.in:1.43 --- src/usr.sbin/postinstall/postinstall.in:1.42 Fri Jan 7 01:03:02 2022 +++ src/usr.sbin/postinstall/postinstall.in Sat Jan 8 06:53:58 2022 @@ -1,8 +1,8 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.42 2022/01/07 01:03:02 lukem Exp $ +# $NetBSD: postinstall.in,v 1.43 2022/01/08 06:53:58 lukem Exp $ # -# Copyright (c) 2002-2021 The NetBSD Foundation, Inc. +# Copyright (c) 2002-2022 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation @@ -2538,10 +2538,10 @@ do_obsolete() # -usage() +help() { - cat 1>&2 << _USAGE_ -Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] op [item [...]] + cat << _USAGE_ +Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] operation [item ...] Perform post-installation checks and/or fixes on a system's configuration files. If no items are provided, a default set of checks or fixes is applied. @@ -2564,7 +2564,7 @@ Usage: ${PROGNAME} [-s srcdir] [-x xsrcd -m mach MACHINE. [${MACHINE}] -a arch MACHINE_ARCH. [${MACHINE_ARCH}] - Operation may be one of: + Supported values for operation: help Display this help. list List available items. check Perform post-installation checks on items. @@ -2573,6 +2573,11 @@ Usage: ${PROGNAME} [-s srcdir] [-x xsrcd fix Apply fixes that 'check' determines need to be applied. usage Display this usage. _USAGE_ +} + +usage() +{ + help 1>&2 exit 2 } @@ -2673,7 +2678,10 @@ main() esac done shift $((${OPTIND} - 1)) - [ $# -gt 0 ] || usage + if [ $# -eq 0 ] ; then + warn "Missing operation" + usage + fi if [ "$N_SRC_ARGS" -gt 1 ] && $DIRMODE; then err 2 "Multiple -s args are allowed only with tgz files" @@ -2759,7 +2767,7 @@ main() case "${op}" in usage|help) - usage + help ;; list)
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sat Jan 8 06:53:58 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: help to stdout. usage tweaks When invoked as "help" or "usage", send the usage to stdout instead of stderr, so that it's easier to pipe to a pager. Explicitly warn that the operation is missing. Tweak the usage; "operation" instead of "op", no need for [] around ... To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Fri Jan 7 01:03:02 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix x11 migration of /usr/X11R6/lib/X11 Fix the x11 check if /usr/X11R6/lib/X11/* needs to migrate to /etc/X11/* by ensuring that the former actually is detected. Avoids false migration errors for paths such as /fs if /usr/X11R6 doesn't exist, such as: x11 check: Migrate /fs to /etc/X11/fs The original implemention handled this correctly, but the bug crept in postinstall 1.110 on 2010/11/21. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.41 src/usr.sbin/postinstall/postinstall.in:1.42 --- src/usr.sbin/postinstall/postinstall.in:1.41 Sat Aug 21 10:06:33 2021 +++ src/usr.sbin/postinstall/postinstall.in Fri Jan 7 01:03:02 2022 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.41 2021/08/21 10:06:33 andvar Exp $ +# $NetBSD: postinstall.in,v 1.42 2022/01/07 01:03:02 lukem Exp $ # # Copyright (c) 2002-2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -2300,6 +2300,7 @@ do_x11() failed=0 _etcx11="${DEST_DIR}/etc/X11" + _libx11="" if [ ! -d "${_etcx11}" ]; then msg "${_etcx11} is not a directory; skipping check" return 0 @@ -2318,30 +2319,33 @@ do_x11() _notfixed="${NOT_FIXED}" fi - for d in \ - fs lbxproxy proxymngr rstart twm xdm xinit xserver xsm \ - ; do - sd="${_libx11}/${d}" - ld="/etc/X11/${d}" - td="${DEST_DIR}${ld}" - if [ -h "${sd}" ]; then - continue - elif [ -d "${sd}" ]; then - tdfiles="$(find "${td}" \! -type d)" - if [ -n "${tdfiles}" ]; then -msg "${sd} exists yet ${td} already" \ -"contains files${_notfixed}" + # check if /usr/X11R6/lib/X11 needs to migrate to /etc/X11 + if [ -n "${_libx11}" ]; then + for d in \ + fs lbxproxy proxymngr rstart twm xdm xinit xserver xsm \ + ; do + sd="${_libx11}/${d}" + ld="/etc/X11/${d}" + td="${DEST_DIR}${ld}" + if [ -h "${sd}" ]; then +continue + elif [ -d "${sd}" ]; then +tdfiles="$(find "${td}" \! -type d)" +if [ -n "${tdfiles}" ]; then + msg "${sd} exists yet ${td} already" \ + "contains files${_notfixed}" +else + msg "Migrate ${sd} to ${td}${_notfixed}" +fi +failed=1 + elif [ -e "${sd}" ]; then +msg "Unexpected file ${sd}${_notfixed}" +continue else -msg "Migrate ${sd} to ${td}${_notfixed}" +continue fi - failed=1 - elif [ -e "${sd}" ]; then - msg "Unexpected file ${sd}${_notfixed}" - continue - else - continue - fi - done + done + fi # check if xdm resources have been updated if [ -r ${_etcx11}/xdm/Xresources ] && \
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Fri Jan 7 01:03:02 UTC 2022 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix x11 migration of /usr/X11R6/lib/X11 Fix the x11 check if /usr/X11R6/lib/X11/* needs to migrate to /etc/X11/* by ensuring that the former actually is detected. Avoids false migration errors for paths such as /fs if /usr/X11R6 doesn't exist, such as: x11 check: Migrate /fs to /etc/X11/fs The original implemention handled this correctly, but the bug crept in postinstall 1.110 on 2010/11/21. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: andvar Date: Sat Aug 21 10:06:33 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: s/accidentaly/accidentally/ To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.40 src/usr.sbin/postinstall/postinstall.in:1.41 --- src/usr.sbin/postinstall/postinstall.in:1.40 Sat Aug 21 09:59:47 2021 +++ src/usr.sbin/postinstall/postinstall.in Sat Aug 21 10:06:33 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.40 2021/08/21 09:59:47 andvar Exp $ +# $NetBSD: postinstall.in,v 1.41 2021/08/21 10:06:33 andvar Exp $ # # Copyright (c) 2002-2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -1243,7 +1243,7 @@ do_dhcpcd() # dhcpcdrundir # -additem dhcpcdrundir "accidentaly created /@RUNDIR@ does not exist" +additem dhcpcdrundir "accidentally created /@RUNDIR@ does not exist" do_dhcpcdrundir() { [ -n "$1" ] || err 3 "USAGE: do_dhcpcdrundir fix|check"
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: andvar Date: Sat Aug 21 10:06:33 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: s/accidentaly/accidentally/ To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: mlelstv Date: Mon Jun 7 05:29:22 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Don't overwrite changed autofs config files. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: mlelstv Date: Mon Jun 7 05:29:22 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Don't overwrite changed autofs config files. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.38 src/usr.sbin/postinstall/postinstall.in:1.39 --- src/usr.sbin/postinstall/postinstall.in:1.38 Sun Apr 25 06:21:37 2021 +++ src/usr.sbin/postinstall/postinstall.in Mon Jun 7 05:29:22 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.38 2021/04/25 06:21:37 lukem Exp $ +# $NetBSD: postinstall.in,v 1.39 2021/06/07 05:29:22 mlelstv Exp $ # # Copyright (c) 2002-2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -902,12 +902,12 @@ special_null mkdir -p "${DEST_DIR}/etc/autofs" fi failed=$(( ${failed} + $? )) - populate_dir "$op" false "${SRC_DIR}/etc" \ + populate_dir "$op" true "${SRC_DIR}/etc" \ "${DEST_DIR}/etc" \ 644 \ auto_master failed=$(( ${failed} + $? )) - populate_dir "$op" false "${SRC_DIR}/etc/autofs" \ + populate_dir "$op" true "${SRC_DIR}/etc/autofs" \ "${DEST_DIR}/etc/autofs" \ 644 \ ${autofs_files}
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 06:21:37 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: re-align list output To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 06:21:37 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: re-align list output To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.37 src/usr.sbin/postinstall/postinstall.in:1.38 --- src/usr.sbin/postinstall/postinstall.in:1.37 Sun Apr 25 01:44:55 2021 +++ src/usr.sbin/postinstall/postinstall.in Sun Apr 25 06:21:37 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.37 2021/04/25 01:44:55 lukem Exp $ +# $NetBSD: postinstall.in,v 1.38 2021/04/25 06:21:37 lukem Exp $ # # Copyright (c) 2002-2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -2576,18 +2576,18 @@ _USAGE_ list() { echo "Default set of items (to apply if no items are provided by user):" - echo " Item Description" - echo " ---" + echo " Item Description" + echo " ---" for i in ${defaultitems}; do eval desc=\"\${desc_${i}}\" - printf " %-12s %s\n" "${i}" "${desc}" + printf " %-20s %s\n" "${i}" "${desc}" done echo "Items disabled by default (must be requested explicitly):" - echo " Item Description" - echo " ---" + echo " Item Description" + echo " ---" for i in ${otheritems}; do eval desc=\"\${desc_${i}}\" - printf " %-12s %s\n" "${i}" "${desc}" + printf " %-20s %s\n" "${i}" "${desc}" done }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 01:44:55 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: sort the items. keep obsolete* last Consistency and quality of life improvements to postinstall: Order all of the items (including disabled) alphabetically. Consistent comment style before each item block. Move other functions used by do_*() before rather than after do_*(). To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.36 src/usr.sbin/postinstall/postinstall.in:1.37 --- src/usr.sbin/postinstall/postinstall.in:1.36 Sun Apr 25 01:15:39 2021 +++ src/usr.sbin/postinstall/postinstall.in Sun Apr 25 01:44:55 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.36 2021/04/25 01:15:39 lukem Exp $ +# $NetBSD: postinstall.in,v 1.37 2021/04/25 01:44:55 lukem Exp $ # # Copyright (c) 2002-2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -590,7 +590,8 @@ exclude() # find all the target symlinks of shared libaries and exclude them # from consideration for removal # -exclude_libs() { +exclude_libs() +{ local target="$(ls -l -d lib*.so.* 2> /dev/null \ | ${AWK} '{ print $11; }' \ | ${SED} -e 's@.*/@@' | ${SORT} -u)" @@ -808,43 +809,118 @@ find_makedev() # items # - # +# NOTE: Keep these items sorted, except for obsolete* which are listed last. +# # -# Bluetooth +# atf # -additem bluetooth "Bluetooth configuration is up to date" -do_bluetooth() +handle_atf_user() { - [ -n "$1" ] || err 3 "USAGE: do_bluetooth fix|check" + local op="$1" + local failed=0 + + local conf="${DEST_DIR}/etc/atf/common.conf" + if grep '[^#]*unprivileged-user[ \t]*=.*_atf' "${conf}" >/dev/null + then + if [ "$1" = "fix" ]; then + ${SED} -e \ + "/[^#]*unprivileged-user[\ t]*=/s/_atf/_tests/" \ + "${conf}" >"${conf}.new" + failed=$(( ${failed} + $? )) + mv "${conf}.new" "${conf}" + failed=$(( ${failed} + $? )) + msg "Set unprivileged-user=_tests in ${conf}" + else + msg "unprivileged-user=_atf in ${conf} should be" \ + "unprivileged-user=_tests" + failed=1 + fi + fi + + return ${failed} +} + +additem atf "install missing atf configuration files and validate them" +do_atf() +{ + [ -n "$1" ] || err 3 "USAGE: do_atf fix|check" op="$1" failed=0 - populate_dir "${op}" true \ - "${SRC_DIR}/etc/bluetooth" "${DEST_DIR}/etc/bluetooth" 644 \ - hosts protocols btattach.conf btdevctl.conf - failed=$(( ${failed} + $? )) - - move_file "${op}" "${DEST_DIR}/var/db/btdev.xml" \ - "${DEST_DIR}/var/db/btdevctl.plist" - failed=$(( ${failed} + $? )) + # Ensure atf configuration files are in place. + if find_file_in_dirlist NetBSD.conf "NetBSD.conf" \ + "${SRC_DIR}/external/bsd/atf/etc/atf" \ + "${SRC_DIR}/etc/atf"; then + # ${dir} is set by find_file_in_dirlist() + populate_dir "${op}" true "${dir}" "${DEST_DIR}/etc/atf" 644 \ + NetBSD.conf common.conf || failed=1 + else + failed=1 + fi + if find_file_in_dirlist atf-run.hooks "atf-run.hooks" \ + "${SRC_DIR}/external/bsd/atf/dist/tools/sample" \ + "${SRC_DIR}/etc/atf"; then + # ${dir} is set by find_file_in_dirlist() + populate_dir "${op}" true "${dir}" "${DEST_DIR}/etc/atf" 644 \ + atf-run.hooks || failed=1 + else + failed=1 + fi - notfixed="" - if [ "${op}" = "fix" ]; then - notfixed="${NOT_FIXED}" + # Validate the _atf to _tests user/group renaming. + if [ -f "${DEST_DIR}/etc/atf/common.conf" ]; then + handle_atf_user "${op}" || failed=1 + else + failed=1 fi - for _v in btattach btconfig btdevctl; do - if rcvar_is_enabled "${_v}"; then - msg \ -"${_v} is obsolete in rc.conf(5)${notfixed}: use bluetooth=YES" - failed=$(( ${failed} + 1 )) - fi - done return ${failed} } -fixblock() { + +# +# autofsconfig +# + +additem autofsconfig "automounter configuration files" +do_autofsconfig() +{ + [ -n "$1" ] || err 3 "USAGE: do_autofsconfig fix|check" + local autofs_files=" +include_ldap +include_nis +special_hosts +special_media +special_noauto +special_null +" + op="$1" + failed=0 + if [ "$op" = "fix" ]; then + mkdir -p "${DEST_DIR}/etc/autofs" + fi + failed=$(( ${failed} + $? )) + populate_dir "$op" false "${SRC_DIR}/etc" \ + "${DEST_DIR}/etc" \ + 644 \ + auto_master + failed=$(( ${failed} + $? )) + populate_dir "$op" false "${SRC_DIR}/etc/autofs" \ + "${DEST_DIR}/etc/autofs" \ + 644 \ + ${autofs_files} + return ${failed} +} + + +# +# blocklist +# + +fixblock() +{ local op="$1" local target="${DEST_DIR}$2" @@ -869,9 +945,6 @@ fixblock() { fi } -# -# blocklist update -# additem blocklist "rename old files to blocklist" do_blocklist() { @@ -897,9 +970,108 @@ do_blocklist()
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 01:44:55 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: sort the items. keep obsolete* last Consistency and quality of life improvements to postinstall: Order all of the items (including disabled) alphabetically. Consistent comment style before each item block. Move other functions used by do_*() before rather than after do_*(). To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 01:15:40 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: comment and usage style Use NOTE: for comments to be aware of. Remove double space before "fix|check" in some items. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 01:15:40 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: comment and usage style Use NOTE: for comments to be aware of. Remove double space before "fix|check" in some items. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.35 src/usr.sbin/postinstall/postinstall.in:1.36 --- src/usr.sbin/postinstall/postinstall.in:1.35 Sun Apr 25 00:36:47 2021 +++ src/usr.sbin/postinstall/postinstall.in Sun Apr 25 01:15:39 2021 @@ -1,8 +1,8 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.35 2021/04/25 00:36:47 lukem Exp $ +# $NetBSD: postinstall.in,v 1.36 2021/04/25 01:15:39 lukem Exp $ # -# Copyright (c) 2002-2015 The NetBSD Foundation, Inc. +# Copyright (c) 2002-2021 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation @@ -35,7 +35,7 @@ # # -# XXX BE SURE TO USE ${DEST_DIR} PREFIX BEFORE ALL REAL FILE OPERATIONS XXX +# NOTE: Be sure to use ${DEST_DIR} prefix before all real file operations. # # @@ -517,7 +517,7 @@ file_exists_exact() # obsolete_paths() { - [ -n "$1" ] || err 3 "USAGE: obsolete_paths fix|check" + [ -n "$1" ] || err 3 "USAGE: obsolete_paths fix|check" op="$1" failed=0 @@ -875,7 +875,7 @@ fixblock() { additem blocklist "rename old files to blocklist" do_blocklist() { - [ -n "$1" ] || err 3 "USAGE: do_blocklist fix|check" + [ -n "$1" ] || err 3 "USAGE: do_blocklist fix|check" local op="$1" # if we are actually using blocklistd @@ -903,7 +903,7 @@ do_blocklist() additem ddbonpanic "verify ddb.onpanic is configured in sysctl.conf" do_ddbonpanic() { - [ -n "$1" ] || err 3 "USAGE: do_ddbonpanic fix|check" + [ -n "$1" ] || err 3 "USAGE: do_ddbonpanic fix|check" if ${GREP} -E '^#*[[:space:]]*ddb\.onpanic[[:space:]]*\??=[[:space:]]*[[:digit:]]+' \ "${DEST_DIR}/etc/sysctl.conf" >/dev/null 2>&1 @@ -932,7 +932,7 @@ do_ddbonpanic() additem defaults "/etc/defaults/ being up to date" do_defaults() { - [ -n "$1" ] || err 3 "USAGE: do_defaults fix|check" + [ -n "$1" ] || err 3 "USAGE: do_defaults fix|check" local op="$1" local failed=0 local etcsets=$(getetcsets) @@ -1256,7 +1256,7 @@ do_fontconfig() additem gid "required groups in /etc/group" do_gid() { - [ -n "$1" ] || err 3 "USAGE: do_gid fix|check" + [ -n "$1" ] || err 3 "USAGE: do_gid fix|check" check_ids "$1" groups "${DEST_DIR}/etc/group" \ "${SRC_DIR}/etc/group" 14 \ @@ -1288,7 +1288,7 @@ do_gpio() additem hosts "/etc/hosts being up to date" do_hosts() { - [ -n "$1" ] || err 3 "USAGE: do_hosts fix|check" + [ -n "$1" ] || err 3 "USAGE: do_hosts fix|check" modify_file "$1" "${DEST_DIR}/etc/hosts" "${SCRATCHDIR}/hosts" ' /^(127\.0\.0\.1|::1)[ ]+[^\.]*$/ { @@ -1306,7 +1306,7 @@ do_hosts() additem iscsi "/etc/iscsi is populated" do_iscsi() { - [ -n "$1" ] || err 3 "USAGE: do_iscsi fix|check" + [ -n "$1" ] || err 3 "USAGE: do_iscsi fix|check" populate_dir "${op}" true \ "${SRC_DIR}/etc/iscsi" "${DEST_DIR}/etc/iscsi" 600 auths @@ -1321,7 +1321,7 @@ do_iscsi() additem makedev "/dev/MAKEDEV being up to date" do_makedev() { - [ -n "$1" ] || err 3 "USAGE: do_makedev fix|check" + [ -n "$1" ] || err 3 "USAGE: do_makedev fix|check" failed=0 if [ -f "${SRC_DIR}/etc/MAKEDEV.tmpl" ]; then @@ -1357,7 +1357,7 @@ do_makedev() additem motd "contents of motd" do_motd() { - [ -n "$1" ] || err 3 "USAGE: do_motd fix|check" + [ -n "$1" ] || err 3 "USAGE: do_motd fix|check" if ${GREP} -i 'http://www.NetBSD.org/Misc/send-pr.html' \ "${DEST_DIR}/etc/motd" >/dev/null 2>&1 \ @@ -1397,7 +1397,7 @@ do_motd() additem mtree "/etc/mtree/ being up to date" do_mtree() { - [ -n "$1" ] || err 3 "USAGE: do_mtree fix|check" + [ -n "$1" ] || err 3 "USAGE: do_mtree fix|check" failed=0 compare_dir "$1" "${SRC_DIR}/etc/mtree" "${DEST_DIR}/etc/mtree" 444 special @@ -1426,7 +1426,7 @@ do_mtree() additem named "named configuration update" do_named() { - [ -n "$1" ] || err 3 "USAGE: do_named fix|check" + [ -n "$1" ] || err 3 "USAGE: do_named fix|check" op="$1" move_file "${op}" \ @@ -1444,7 +1444,7 @@ do_named() additem pam "/etc/pam.d is populated" do_pam() { - [ -n "$1" ] || err 3 "USAGE: do_pam fix|check" + [ -n "$1" ] || err 3 "USAGE: do_pam fix|check" op="$1" failed=0 @@ -1465,7 +1465,7 @@ do_pam() additem periodic "/etc/{daily,weekly,monthly,security} being up to date" do_periodic() { - [ -n "$1" ] || err 3 "USAGE: do_periodic fix|check" + [ -n "$1" ] || err 3 "USAGE: do_periodic fix|check" compare_dir "$1" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \ daily weekly monthly security @@
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 00:36:47 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: ensure SRC_DIR and DEST_DIR are quoted To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.34 src/usr.sbin/postinstall/postinstall.in:1.35 --- src/usr.sbin/postinstall/postinstall.in:1.34 Sun Apr 25 00:29:52 2021 +++ src/usr.sbin/postinstall/postinstall.in Sun Apr 25 00:36:47 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.34 2021/04/25 00:29:52 lukem Exp $ +# $NetBSD: postinstall.in,v 1.35 2021/04/25 00:36:47 lukem Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -1599,7 +1599,7 @@ select_obsolete_files() { if $SOURCEMODE; then ${SED} -n -e "/obsolete/s@\.$1$2[[:space:]].*@\1@p" \ - ${SRC_DIR}/distrib/sets/lists/$3/mi + "${SRC_DIR}/distrib/sets/lists/$3/mi" return fi @@ -1610,9 +1610,9 @@ select_obsolete_files() local obsolete_dir if [ $3 = "etc" ] ;then - obsolete_dir=${SRC_DIR}/var/db/obsolete + obsolete_dir="${SRC_DIR}/var/db/obsolete" else - obsolete_dir=${DEST_DIR}/var/db/obsolete + obsolete_dir="${DEST_DIR}/var/db/obsolete" fi ${SED} -n -e "s@\.$1$2\$@\1@p" "${obsolete_dir}/$3" } @@ -2397,7 +2397,7 @@ listarchsubdirs() { echo "@ARCHSUBDIRS@" else ${SED} -n -e '/ARCHDIR_SUBDIR/s/[[:space:]]//gp' \ - ${SRC_DIR}/compat/archdirs.mk + "${SRC_DIR}/compat/archdirs.mk" fi }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 00:36:47 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: ensure SRC_DIR and DEST_DIR are quoted To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 00:29:52 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: use correct DEST_DIR in obsolete_stand To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.33 src/usr.sbin/postinstall/postinstall.in:1.34 --- src/usr.sbin/postinstall/postinstall.in:1.33 Fri Aug 28 15:26:23 2020 +++ src/usr.sbin/postinstall/postinstall.in Sun Apr 25 00:29:52 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.33 2020/08/28 15:26:23 christos Exp $ +# $NetBSD: postinstall.in,v 1.34 2021/04/25 00:29:52 lukem Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -2371,7 +2371,7 @@ obsolete_stand_internal() ${prefix}/stand/${MACHINE}-xen \ ${prefix}/stand/${MACHINE}pae-xen do - [ -d "${DESTDIR}${dir}" ] && obsolete_stand "${dir}" + [ -d "${DEST_DIR}${dir}" ] && obsolete_stand "${dir}" done | obsolete_paths "${op}" failed=$(( ${failed} + $? ))
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: lukem Date: Sun Apr 25 00:29:52 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: use correct DEST_DIR in obsolete_stand To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri Aug 28 15:26:23 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: missing quote To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri Aug 28 15:26:23 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: missing quote To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.32 src/usr.sbin/postinstall/postinstall.in:1.33 --- src/usr.sbin/postinstall/postinstall.in:1.32 Fri Aug 28 11:25:16 2020 +++ src/usr.sbin/postinstall/postinstall.in Fri Aug 28 11:26:23 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.32 2020/08/28 15:25:16 christos Exp $ +# $NetBSD: postinstall.in,v 1.33 2020/08/28 15:26:23 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -860,7 +860,7 @@ fixblock() { local p=$(${STAT} -f %Lp "${target}") chmod u+w "${target}" || return 1 if [ "$2" = "/etc/npf.conf" ]; then -${SED} -i -e 's/"blacklistd/"blocklistd"/g' "${target}" +${SED} -i -e 's/"blacklistd"/"blocklistd"/g' "${target}" else ${SED} -i -e 's/\([bB]\)lacklist/\1locklist/g' "${target}" fi
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri Aug 28 15:25:17 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Restrict npf.conf fixes to "blacklistd" -> "blocklistd" To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.31 src/usr.sbin/postinstall/postinstall.in:1.32 --- src/usr.sbin/postinstall/postinstall.in:1.31 Tue Jul 7 08:01:21 2020 +++ src/usr.sbin/postinstall/postinstall.in Fri Aug 28 11:25:16 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.31 2020/07/07 12:01:21 simonb Exp $ +# $NetBSD: postinstall.in,v 1.32 2020/08/28 15:25:16 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -859,7 +859,11 @@ fixblock() { else local p=$(${STAT} -f %Lp "${target}") chmod u+w "${target}" || return 1 - ${SED} -i -e 's/\([bB]\)lack/\1lock/g' "${target}" + if [ "$2" = "/etc/npf.conf" ]; then +${SED} -i -e 's/"blacklistd/"blocklistd"/g' "${target}" + else +${SED} -i -e 's/\([bB]\)lacklist/\1locklist/g' "${target}" + fi chmod "${p}" "${target}" fi fi
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri Aug 28 15:25:17 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Restrict npf.conf fixes to "blacklistd" -> "blocklistd" To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: simonb Date: Tue Jul 7 12:01:21 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Sort missing IDs (users and groups) by the numeric ID. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.30 src/usr.sbin/postinstall/postinstall.in:1.31 --- src/usr.sbin/postinstall/postinstall.in:1.30 Mon Jun 29 23:04:57 2020 +++ src/usr.sbin/postinstall/postinstall.in Tue Jul 7 12:01:21 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.30 2020/06/29 23:04:57 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.31 2020/07/07 12:01:21 simonb Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -287,7 +287,7 @@ check_ids() do ${GREP} -E "^${1}:" ${_srcfile} shift 2 - done + done | sort -t: -k3n msg "and adjust if necessary." return 1 fi
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: simonb Date: Tue Jul 7 12:01:21 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Sort missing IDs (users and groups) by the numeric ID. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: rin Date: Mon Jun 22 06:55:41 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Fix do_blocklist: - Respect destination directory specified by -d option. - Accept check and fix options. For the former, do not modify anything as users normally expect. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.28 src/usr.sbin/postinstall/postinstall.in:1.29 --- src/usr.sbin/postinstall/postinstall.in:1.28 Sat Jun 20 18:30:53 2020 +++ src/usr.sbin/postinstall/postinstall.in Mon Jun 22 06:55:41 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.28 2020/06/20 18:30:53 riastradh Exp $ +# $NetBSD: postinstall.in,v 1.29 2020/06/22 06:55:41 rin Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -845,15 +845,24 @@ do_bluetooth() } fixblock() { - for i; do - if [ ! -f "$i" ]; then - continue + local op="$1" + local target="${DEST_DIR}$2" + + if [ ! -f "${target}" ]; then + continue + fi + + if ${GREP} '[bB]lack' "${target}" > /dev/null; then + if [ "$1" = "check" ]; then + msg "Fix old configuration file(s)." + return 1 + else + local p=$(${STAT} -f %Lp "${target}") + chmod u+w "${target}" || return 1 + ${SED} -i -e 's/\([bB]\)lack/\1lock/g' "${target}" + chmod "${p}" "${target}" fi - local p=$(stat -f %Lp "$i") - chmod u+w "$i" - sed -i -e 's/\([bB]\)lack/\1lock/g' "$i" - chmod "$p" "$i" - done + fi } # @@ -862,23 +871,26 @@ fixblock() { additem blocklist "rename old files to blocklist" do_blocklist() { - local rcfiles="/etc/rc.conf /etc/npf.conf /etc/defaults/rc.conf" - + [ -n "$1" ] || err 3 "USAGE: do_blocklist fix|check" + local op="$1" + # if we are actually using blocklistd - if [ -f /var/db/blacklist.db ]; then - mv /var/db/blacklist.db /var/db/blocklist.db - fi - if [ -f /etc/blacklistd.conf ]; then - mv /etc/blacklistd.conf /etc/blocklistd.conf - fixblock /etc/blocklistd.conf - fi - - # if we have fixed the rc files we are done - if ! grep -qs $rcfiles; then - return - fi + for i in /var/db/blacklist.db /etc/blacklistd.conf; do + local old="${DEST_DIR}${i}" + if [ ! -f "${old}" ]; then + continue + elif [ "$1" = "check" ]; then + msg "Rename old file(s)." + return 1 + fi + local new=$(echo "${old}" | ${SED} s/black/block/) + mv "${old}" "${new}" || return 1 + done - fixblock $rcfiles + for i in /etc/rc.conf /etc/npf.conf /etc/blocklistd.conf \ + /etc/defaults/rc.conf; do + fixblock "${op}" "${i}" || return 1 + done } #
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: rin Date: Mon Jun 22 06:55:41 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Fix do_blocklist: - Respect destination directory specified by -d option. - Accept check and fix options. For the former, do not modify anything as users normally expect. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Sat Jun 20 18:30:54 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.27 src/usr.sbin/postinstall/postinstall.in:1.28 --- src/usr.sbin/postinstall/postinstall.in:1.27 Mon Jun 15 21:56:49 2020 +++ src/usr.sbin/postinstall/postinstall.in Sat Jun 20 18:30:53 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.27 2020/06/15 21:56:49 christos Exp $ +# $NetBSD: postinstall.in,v 1.28 2020/06/20 18:30:53 riastradh Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -863,7 +863,7 @@ additem blocklist "rename old files to b do_blocklist() { local rcfiles="/etc/rc.conf /etc/npf.conf /etc/defaults/rc.conf" - + # if we are actually using blocklistd if [ -f /var/db/blacklist.db ]; then mv /var/db/blacklist.db /var/db/blocklist.db @@ -1110,7 +1110,7 @@ include_nis special_hosts special_media special_noauto -special_null +special_null " op="$1" failed=0 @@ -1656,12 +1656,12 @@ do_rc() failed=$(( ${failed} + $? )) for i in ${rc_external_files}; do - local rc_file + local rc_file case $i in *d) rc_file=${i};; *) rc_file=${i}d;; esac - + update_rc "${op}" "${dir}" ${rc_file} /sbin \ "${SRC_DIR}/external/bsd/$i/etc/rc.d" failed=$(( ${failed} + $? )) @@ -2381,7 +2381,7 @@ listarchsubdirs() { echo "@ARCHSUBDIRS@" else ${SED} -n -e '/ARCHDIR_SUBDIR/s/[[:space:]]//gp' \ - ${SRC_DIR}/compat/archdirs.mk + ${SRC_DIR}/compat/archdirs.mk fi }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: riastradh Date: Sat Jun 20 18:30:54 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 21:56:50 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: handle /etc/blacklistd.conf To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 21:56:50 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: handle /etc/blacklistd.conf To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.26 src/usr.sbin/postinstall/postinstall.in:1.27 --- src/usr.sbin/postinstall/postinstall.in:1.26 Mon Jun 15 17:51:13 2020 +++ src/usr.sbin/postinstall/postinstall.in Mon Jun 15 17:56:49 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.26 2020/06/15 21:51:13 christos Exp $ +# $NetBSD: postinstall.in,v 1.27 2020/06/15 21:56:49 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -851,7 +851,7 @@ fixblock() { fi local p=$(stat -f %Lp "$i") chmod u+w "$i" - sed -i -e s/black/block/g "$i" + sed -i -e 's/\([bB]\)lack/\1lock/g' "$i" chmod "$p" "$i" done } @@ -868,6 +868,10 @@ do_blocklist() if [ -f /var/db/blacklist.db ]; then mv /var/db/blacklist.db /var/db/blocklist.db fi + if [ -f /etc/blacklistd.conf ]; then + mv /etc/blacklistd.conf /etc/blocklistd.conf + fixblock /etc/blocklistd.conf + fi # if we have fixed the rc files we are done if ! grep -qs $rcfiles; then
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 21:51:13 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: correct blocklist script - removal of rc file is handled by obsolete - use grep to find if we need more changes - fix rc population To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 21:51:13 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: correct blocklist script - removal of rc file is handled by obsolete - use grep to find if we need more changes - fix rc population To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.25 src/usr.sbin/postinstall/postinstall.in:1.26 --- src/usr.sbin/postinstall/postinstall.in:1.25 Mon Jun 15 10:32:07 2020 +++ src/usr.sbin/postinstall/postinstall.in Mon Jun 15 17:51:13 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.25 2020/06/15 14:32:07 christos Exp $ +# $NetBSD: postinstall.in,v 1.26 2020/06/15 21:51:13 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -862,18 +862,19 @@ fixblock() { additem blocklist "rename old files to blocklist" do_blocklist() { + local rcfiles="/etc/rc.conf /etc/npf.conf /etc/defaults/rc.conf" + # if we are actually using blocklistd if [ -f /var/db/blacklist.db ]; then mv /var/db/blacklist.db /var/db/blocklist.db fi # if we have fixed the rc files we are done - if [ ! -f /etc/rc.d/blacklist ]; then + if ! grep -qs $rcfiles; then return fi - fixblock /etc/rc.conf /etc/npf.conf /etc/defaults/rc.conf - rm -f /etc/rc.d/blacklist + fixblock $rcfiles } # @@ -1618,7 +1619,7 @@ do_rc() fi # Directories of external programs that have rc files (in bsd) - local rc_external_files="blacklist nsd unbound" + local rc_external_files="blocklist nsd unbound" # rc* files in /etc/ # XXX: at least rc.conf and rc.local shouldn't be updated. PR/54741
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 14:32:08 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: fix reversed mv, pointed out by wiz@ To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 14:32:08 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: fix reversed mv, pointed out by wiz@ To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.24 src/usr.sbin/postinstall/postinstall.in:1.25 --- src/usr.sbin/postinstall/postinstall.in:1.24 Mon Jun 15 10:25:40 2020 +++ src/usr.sbin/postinstall/postinstall.in Mon Jun 15 10:32:07 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.24 2020/06/15 14:25:40 christos Exp $ +# $NetBSD: postinstall.in,v 1.25 2020/06/15 14:32:07 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -864,7 +864,7 @@ do_blocklist() { # if we are actually using blocklistd if [ -f /var/db/blacklist.db ]; then - mv /var/db/blocklist.db /var/db/blacklist.db + mv /var/db/blacklist.db /var/db/blocklist.db fi # if we have fixed the rc files we are done
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 14:25:40 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: deal with blacklist -> blocklist To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Mon Jun 15 14:25:40 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: deal with blacklist -> blocklist To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.23 src/usr.sbin/postinstall/postinstall.in:1.24 --- src/usr.sbin/postinstall/postinstall.in:1.23 Wed Jun 3 07:47:46 2020 +++ src/usr.sbin/postinstall/postinstall.in Mon Jun 15 10:25:40 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.23 2020/06/03 11:47:46 roy Exp $ +# $NetBSD: postinstall.in,v 1.24 2020/06/15 14:25:40 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -844,6 +844,38 @@ do_bluetooth() return ${failed} } +fixblock() { + for i; do + if [ ! -f "$i" ]; then + continue + fi + local p=$(stat -f %Lp "$i") + chmod u+w "$i" + sed -i -e s/black/block/g "$i" + chmod "$p" "$i" + done +} + +# +# blocklist update +# +additem blocklist "rename old files to blocklist" +do_blocklist() +{ + # if we are actually using blocklistd + if [ -f /var/db/blacklist.db ]; then + mv /var/db/blocklist.db /var/db/blacklist.db + fi + + # if we have fixed the rc files we are done + if [ ! -f /etc/rc.d/blacklist ]; then + return + fi + + fixblock /etc/rc.conf /etc/npf.conf /etc/defaults/rc.conf + rm -f /etc/rc.d/blacklist +} + # # ddbonpanic #
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Wed Jun 3 11:47:47 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Ensure the dhcpcd log socket is removed. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.22 src/usr.sbin/postinstall/postinstall.in:1.23 --- src/usr.sbin/postinstall/postinstall.in:1.22 Sun May 31 13:45:47 2020 +++ src/usr.sbin/postinstall/postinstall.in Wed Jun 3 11:47:46 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.22 2020/05/31 13:45:47 roy Exp $ +# $NetBSD: postinstall.in,v 1.23 2020/06/03 11:47:46 roy Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -996,7 +996,7 @@ do_dhcpcd() # Ensure chroot is now empty for dir in \ - $(find ${chroot_dir} -type f) \ + $(find ${chroot_dir} ! -type d) \ $(find ${chroot_dir} -type d -mindepth 1 | sort -r) do echo "/var/chroot/dhcpcd${dir##${chroot_dir}}"
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Wed Jun 3 11:47:47 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Ensure the dhcpcd log socket is removed. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Sun May 31 13:45:47 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: Move files out of dhcpcd chroot To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.21 src/usr.sbin/postinstall/postinstall.in:1.22 --- src/usr.sbin/postinstall/postinstall.in:1.21 Fri May 15 16:33:38 2020 +++ src/usr.sbin/postinstall/postinstall.in Sun May 31 13:45:47 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.21 2020/05/15 16:33:38 christos Exp $ +# $NetBSD: postinstall.in,v 1.22 2020/05/31 13:45:47 roy Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -945,57 +945,65 @@ do_dhcpcd() populate_dir "$op" true "${dir}" "${DEST_DIR}/etc" 644 dhcpcd.conf failed=$(( ${failed} + $? )) - dstdir="${DEST_DIR}/var/chroot/dhcpcd" - - check_dir "${op}" "${dstdir}/var/db/dhcpcd" 755 + check_dir "${op}" "${DEST_DIR}/var/db/dhcpcd" 755 failed=$(( ${failed} + $? )) move_file "${op}" \ "${DEST_DIR}/etc/dhcpcd.duid" \ - "${dstdir}/var/db/dhcpcd/duid" + "${DEST_DIR}/var/db/dhcpcd/duid" failed=$(( ${failed} + $? )) move_file "${op}" \ "${DEST_DIR}/etc/dhcpcd.secret" \ - "${dstdir}/var/db/dhcpcd/secret" + "${DEST_DIR}/var/db/dhcpcd/secret" failed=$(( ${failed} + $? )) move_file "${op}" \ "${DEST_DIR}/var/db/dhcpcd-rdm.monotonic" \ - "${dstdir}/var/db/dhcpcd/rdm_monotonic" + "${DEST_DIR}/var/db/dhcpcd/rdm_monotonic" failed=$(( ${failed} + $? )) for lease in "${DEST_DIR}/var/db/dhcpcd-"*.lease*; do [ -f "${lease}" ] || continue new_lease=$(basename "${lease}" | ${SED} -e 's/dhcpcd-//') - new_lease="${dstdir}/var/db/dhcpcd/${new_lease}" + new_lease="${DEST_DIR}/var/db/dhcpcd/${new_lease}" move_file "${op}" "${lease}" "${new_lease}" failed=$(( ${failed} + $? )) done + chroot_dir="${DEST_DIR}/var/chroot/dhcpcd" move_file "${op}" \ - "${DEST_DIR}/var/db/dhcpcd/duid" \ - "${dstdir}/var/db/dhcpcd/duid" + "${chroot_dir}/var/db/dhcpcd/duid" \ + "${DEST_DIR}/var/db/dhcpcd/duid" failed=$(( ${failed} + $? )) move_file "${op}" \ - "${DEST_DIR}/var/db/dhcpcd/secret" \ - "${dstdir}/var/db/dhcpcd/secret" + "${chroot_dir}/var/db/dhcpcd/secret" \ + "${DEST_DIR}/var/db/dhcpcd/secret" failed=$(( ${failed} + $? )) move_file "${op}" \ - "${DEST_DIR}/var/db/dhcpcd/rdm_monotonic" \ - "${dstdir}/var/db/dhcpcd/rdm_monotonic" + "${chroot_dir}/var/db/dhcpcd/rdm_monotonic" \ + "${DEST_DIR}/var/db/dhcpcd/rdm_monotonic" failed=$(( ${failed} + $? )) - for lease in "${DEST_DIR}/var/db/dhcpcd/"*.lease*; do + for lease in "${chroot_dir}/var/db/dhcpcd/"*.lease*; do [ -f "${lease}" ] || continue - new_lease="${dstdir}/var/db/dhcpcd/$(basename ${lease})" + new_lease="${DEST_DIR}/var/db/dhcpcd/$(basename ${lease})" move_file "${op}" "${lease}" "${new_lease}" failed=$(( ${failed} + $? )) done - contents_owner "${op}" "${dstdir}/var/db/dhcpcd" _dhcpcd _dhcpcd + # Ensure chroot is now empty + for dir in \ + $(find ${chroot_dir} -type f) \ + $(find ${chroot_dir} -type d -mindepth 1 | sort -r) + do + echo "/var/chroot/dhcpcd${dir##${chroot_dir}}" + done | obsolete_paths "${op}" + failed=$(( ${failed} + $? )) + + contents_owner "${op}" "${DEST_DIR}/var/db/dhcpcd" root wheel failed=$(( ${failed} + $? )) return ${failed}
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Sun May 31 13:45:47 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: Move files out of dhcpcd chroot To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri May 15 16:33:38 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Add a function to remove the debug bits of the stand files. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.20 src/usr.sbin/postinstall/postinstall.in:1.21 --- src/usr.sbin/postinstall/postinstall.in:1.20 Sun Apr 19 18:10:24 2020 +++ src/usr.sbin/postinstall/postinstall.in Fri May 15 12:33:38 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.20 2020/04/19 22:10:24 roy Exp $ +# $NetBSD: postinstall.in,v 1.21 2020/05/15 16:33:38 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -2295,19 +2295,20 @@ do_varshm() # # obsolete_stand # -adddisableditem obsolete_stand "remove obsolete files from /stand" -do_obsolete_stand() +obsolete_stand_internal() { - [ -n "$1" ] || err 3 "USAGE: do_obsolete_stnd fix|check" - op="$1" - failed=0 + local prefix="$1" + shift + [ -n "$1" ] || err 3 "USAGE: do_obsolete_stand fix|check" + local op="$1" + local failed=0 for dir in \ - /stand/${MACHINE} \ - /stand/${MACHINE}-4xx \ - /stand/${MACHINE}-booke \ - /stand/${MACHINE}-xen \ - /stand/${MACHINE}pae-xen + ${prefix}/stand/${MACHINE} \ + ${prefix}/stand/${MACHINE}-4xx \ + ${prefix}/stand/${MACHINE}-booke \ + ${prefix}/stand/${MACHINE}-xen \ + ${prefix}/stand/${MACHINE}pae-xen do [ -d "${DESTDIR}${dir}" ] && obsolete_stand "${dir}" done | obsolete_paths "${op}" @@ -2316,6 +2317,20 @@ do_obsolete_stand() return ${failed} } +adddisableditem obsolete_stand "remove obsolete files from /stand" +do_obsolete_stand() +{ + obsolete_stand_internal "" "$@" + return $? +} + +adddisableditem obsolete_stand_debug "remove obsolete files from /usr/libdata/debug/stand" +do_obsolete_stand_debug() +{ + obsolete_stand_internal "/usr/libdata/debug" "$@" + return $? +} + listarchsubdirs() { if ! $SOURCEMODE; then echo "@ARCHSUBDIRS@"
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Fri May 15 16:33:38 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Add a function to remove the debug bits of the stand files. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Sun Apr 19 22:10:24 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: ensure contents_owner fix fails on find errors The issue is that find won't pass anything to xargs and that returns 0. So replace the usage of xargs with -exec. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.19 src/usr.sbin/postinstall/postinstall.in:1.20 --- src/usr.sbin/postinstall/postinstall.in:1.19 Thu Apr 9 15:24:31 2020 +++ src/usr.sbin/postinstall/postinstall.in Sun Apr 19 22:10:24 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.19 2020/04/09 15:24:31 roy Exp $ +# $NetBSD: postinstall.in,v 1.20 2020/04/19 22:10:24 roy Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -750,8 +750,8 @@ contents_owner() fi elif [ "${_op}" = "fix" ]; then find "${_dir}" \( \( ! -user "${_user}" \) -o \ - \( ! -group "${_grp}" \) \) -a -print0 \ - | xargs -0 chown "${_user}:${_grp}" + \( ! -group "${_grp}" \) \) \ + -exec chown "${_user}:${_grp}" -- {} \; fi }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Sun Apr 19 22:10:24 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: ensure contents_owner fix fails on find errors The issue is that find won't pass anything to xargs and that returns 0. So replace the usage of xargs with -exec. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Thu Apr 9 15:24:31 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Fix dhcpcd $DEST_DIR support To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.18 src/usr.sbin/postinstall/postinstall.in:1.19 --- src/usr.sbin/postinstall/postinstall.in:1.18 Mon Apr 6 13:10:48 2020 +++ src/usr.sbin/postinstall/postinstall.in Thu Apr 9 15:24:31 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.18 2020/04/06 13:10:48 roy Exp $ +# $NetBSD: postinstall.in,v 1.19 2020/04/09 15:24:31 roy Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -945,7 +945,7 @@ do_dhcpcd() populate_dir "$op" true "${dir}" "${DEST_DIR}/etc" 644 dhcpcd.conf failed=$(( ${failed} + $? )) - dstdir="${DESTDIR}/var/chroot/dhcpcd" + dstdir="${DEST_DIR}/var/chroot/dhcpcd" check_dir "${op}" "${dstdir}/var/db/dhcpcd" 755 failed=$(( ${failed} + $? ))
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Thu Apr 9 15:24:31 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Fix dhcpcd $DEST_DIR support To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Mon Apr 6 13:10:48 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix contents_owner to return an error on error find returning nothing via stdout but does return an error is an error. Fixes the case where dhcpcd chroot db directory isn't owned by _dhcpcd. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Mon Apr 6 13:10:48 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: fix contents_owner to return an error on error find returning nothing via stdout but does return an error is an error. Fixes the case where dhcpcd chroot db directory isn't owned by _dhcpcd. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.17 src/usr.sbin/postinstall/postinstall.in:1.18 --- src/usr.sbin/postinstall/postinstall.in:1.17 Thu Apr 2 13:44:46 2020 +++ src/usr.sbin/postinstall/postinstall.in Mon Apr 6 13:10:48 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.17 2020/04/02 13:44:46 roy Exp $ +# $NetBSD: postinstall.in,v 1.18 2020/04/06 13:10:48 roy Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -738,10 +738,12 @@ contents_owner() _grp="$4" if [ "${_op}" = "check" ]; then - if [ ! -z "`find "${_dir}" \( ! -user "${_user}" \) -o \ - \( ! -group "${_grp}" \)`" ]; then - msg \ -"${_dir} and contents not all owned by ${_user}:${_grp}" + _files=$(find "${_dir}" \( \( ! -user "${_user}" \) -o \ + \( ! -group "${_grp}" \) \) ) + _error=$? + if [ ! -z "$_files" ] || [ $_error != 0 ]; then + msg "${_dir} and contents not all owned by" \ + "${_user}:${_grp}" return 1 else return 0
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Thu Apr 2 13:44:46 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: add checks for _dhcpcd to do_uid and do_gid Thanks to jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.16 src/usr.sbin/postinstall/postinstall.in:1.17 --- src/usr.sbin/postinstall/postinstall.in:1.16 Thu Apr 2 13:04:09 2020 +++ src/usr.sbin/postinstall/postinstall.in Thu Apr 2 13:44:46 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.16 2020/04/02 13:04:09 roy Exp $ +# $NetBSD: postinstall.in,v 1.17 2020/04/02 13:44:46 roy Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -1199,7 +1199,7 @@ do_gid() "${SRC_DIR}/etc/group" 14 \ named ntpd sshd SKIP _pflogd _rwhod staff _proxy _timedc \ _sdpd _httpd _mdnsd _tests _tcpdump _tss _gpio _rtadvd SKIP \ - _unbound _nsd nvmm + _unbound _nsd nvmm _dhcpcd } # @@ -1975,7 +1975,7 @@ do_uid() "${SRC_DIR}/etc/master.passwd" 12 \ postfix SKIP named ntpd sshd SKIP _pflogd _rwhod SKIP _proxy \ _timedc _sdpd _httpd _mdnsd _tests _tcpdump _tss SKIP _rtadvd \ - SKIP _unbound _nsd + SKIP _unbound _nsd SKIP _dhcpcd }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Thu Apr 2 13:44:46 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: add checks for _dhcpcd to do_uid and do_gid Thanks to jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Thu Apr 2 13:04:09 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: move dhcpcd files to the chroot To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.15 src/usr.sbin/postinstall/postinstall.in:1.16 --- src/usr.sbin/postinstall/postinstall.in:1.15 Tue Feb 25 10:27:01 2020 +++ src/usr.sbin/postinstall/postinstall.in Thu Apr 2 13:04:09 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.15 2020/02/25 10:27:01 nakayama Exp $ +# $NetBSD: postinstall.in,v 1.16 2020/04/02 13:04:09 roy Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -943,32 +943,59 @@ do_dhcpcd() populate_dir "$op" true "${dir}" "${DEST_DIR}/etc" 644 dhcpcd.conf failed=$(( ${failed} + $? )) - check_dir "${op}" "${DEST_DIR}/var/db/dhcpcd" 755 + dstdir="${DESTDIR}/var/chroot/dhcpcd" + + check_dir "${op}" "${dstdir}/var/db/dhcpcd" 755 failed=$(( ${failed} + $? )) move_file "${op}" \ "${DEST_DIR}/etc/dhcpcd.duid" \ - "${DEST_DIR}/var/db/dhcpcd/duid" + "${dstdir}/var/db/dhcpcd/duid" failed=$(( ${failed} + $? )) move_file "${op}" \ "${DEST_DIR}/etc/dhcpcd.secret" \ - "${DEST_DIR}/var/db/dhcpcd/secret" + "${dstdir}/var/db/dhcpcd/secret" failed=$(( ${failed} + $? )) move_file "${op}" \ "${DEST_DIR}/var/db/dhcpcd-rdm.monotonic" \ - "${DEST_DIR}/var/db/dhcpcd/rdm_monotonic" + "${dstdir}/var/db/dhcpcd/rdm_monotonic" failed=$(( ${failed} + $? )) for lease in "${DEST_DIR}/var/db/dhcpcd-"*.lease*; do [ -f "${lease}" ] || continue new_lease=$(basename "${lease}" | ${SED} -e 's/dhcpcd-//') - new_lease="${DEST_DIR}/var/db/dhcpcd/${new_lease}" + new_lease="${dstdir}/var/db/dhcpcd/${new_lease}" move_file "${op}" "${lease}" "${new_lease}" failed=$(( ${failed} + $? )) done + move_file "${op}" \ + "${DEST_DIR}/var/db/dhcpcd/duid" \ + "${dstdir}/var/db/dhcpcd/duid" + failed=$(( ${failed} + $? )) + + move_file "${op}" \ + "${DEST_DIR}/var/db/dhcpcd/secret" \ + "${dstdir}/var/db/dhcpcd/secret" + failed=$(( ${failed} + $? )) + + move_file "${op}" \ + "${DEST_DIR}/var/db/dhcpcd/rdm_monotonic" \ + "${dstdir}/var/db/dhcpcd/rdm_monotonic" + failed=$(( ${failed} + $? )) + + for lease in "${DEST_DIR}/var/db/dhcpcd/"*.lease*; do + [ -f "${lease}" ] || continue + new_lease="${dstdir}/var/db/dhcpcd/$(basename ${lease})" + move_file "${op}" "${lease}" "${new_lease}" + failed=$(( ${failed} + $? )) + done + + contents_owner "${op}" "${dstdir}/var/db/dhcpcd" _dhcpcd _dhcpcd + failed=$(( ${failed} + $? )) + return ${failed} }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: roy Date: Thu Apr 2 13:04:09 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: postinstall: move dhcpcd files to the chroot To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: nakayama Date: Tue Feb 25 10:27:01 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Fix the fixup script to follow the URL change in /etc/motd (http->https). PR install/54990, pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.14 src/usr.sbin/postinstall/postinstall.in:1.15 --- src/usr.sbin/postinstall/postinstall.in:1.14 Thu Jan 30 13:54:05 2020 +++ src/usr.sbin/postinstall/postinstall.in Tue Feb 25 10:27:01 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.14 2020/01/30 13:54:05 christos Exp $ +# $NetBSD: postinstall.in,v 1.15 2020/02/25 10:27:01 nakayama Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -1271,7 +1271,7 @@ do_motd() if ${GREP} -i 'http://www.NetBSD.org/Misc/send-pr.html' \ "${DEST_DIR}/etc/motd" >/dev/null 2>&1 \ - || ${GREP} -i 'http://www.NetBSD.org/support/send-pr.html' \ + || ${GREP} -i 'https*://www.NetBSD.org/support/send-pr.html' \ "${DEST_DIR}/etc/motd" >/dev/null 2>&1 then tmp1="$(mktemp /tmp/postinstall.motd.)"
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: nakayama Date: Tue Feb 25 10:27:01 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Fix the fixup script to follow the URL change in /etc/motd (http->https). PR install/54990, pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Jan 30 13:54:05 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: change the autofs file to be user writable. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Jan 30 13:54:05 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: change the autofs file to be user writable. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.13 src/usr.sbin/postinstall/postinstall.in:1.14 --- src/usr.sbin/postinstall/postinstall.in:1.13 Wed Jan 29 20:39:40 2020 +++ src/usr.sbin/postinstall/postinstall.in Thu Jan 30 08:54:05 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.13 2020/01/30 01:39:40 christos Exp $ +# $NetBSD: postinstall.in,v 1.14 2020/01/30 13:54:05 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -1046,12 +1046,12 @@ special_null failed=$(( ${failed} + $? )) populate_dir "$op" false "${SRC_DIR}/etc" \ "${DEST_DIR}/etc" \ - 444 \ + 644 \ auto_master failed=$(( ${failed} + $? )) populate_dir "$op" false "${SRC_DIR}/etc/autofs" \ "${DEST_DIR}/etc/autofs" \ - 444 \ + 644 \ ${autofs_files} return ${failed} }
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Jan 30 01:39:40 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: populate autofs files To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: christos Date: Thu Jan 30 01:39:40 UTC 2020 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: populate autofs files To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.12 src/usr.sbin/postinstall/postinstall.in:1.13 --- src/usr.sbin/postinstall/postinstall.in:1.12 Sun Dec 29 17:19:13 2019 +++ src/usr.sbin/postinstall/postinstall.in Wed Jan 29 20:39:40 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.12 2019/12/29 22:19:13 tsutsui Exp $ +# $NetBSD: postinstall.in,v 1.13 2020/01/30 01:39:40 christos Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -1024,6 +1024,40 @@ do_envsys() } # +# autofs config files +# +additem autofsconfig "automounter configuration files" +do_autofsconfig() +{ + [ -n "$1" ] || err 3 "USAGE: do_autofsconfig fix|check" + local autofs_files=" +include_ldap +include_nis +special_hosts +special_media +special_noauto +special_null +" + op="$1" + failed=0 + if [ "$op" = "fix" ]; then + mkdir -p "${DEST_DIR}/etc/autofs" + fi + failed=$(( ${failed} + $? )) + populate_dir "$op" false "${SRC_DIR}/etc" \ + "${DEST_DIR}/etc" \ + 444 \ + auto_master + failed=$(( ${failed} + $? )) + populate_dir "$op" false "${SRC_DIR}/etc/autofs" \ + "${DEST_DIR}/etc/autofs" \ + 444 \ + ${autofs_files} + return ${failed} +} + + +# # X11 fontconfig # additem fontconfig "X11 font configuration is up to date"
Re: CVS commit: src/usr.sbin/postinstall
(Cc'ed to source-changed-d@, not source-changes@) m...@eterna.com.au wrote: > "Izumi Tsutsui" writes: > > Module Name:src > > Committed By: tsutsui > > Date: Sun Dec 29 22:19:13 UTC 2019 > > > > Modified Files: > > src/usr.sbin/postinstall: postinstall.in > > > > Log Message: > > Make sure rc, rc.subr, and rc.shutdown are properly updated. > > > > Currently there is no info which rc* files should be updated > > or not on upgrade (at least rc.conf and rc.local shouldn't), > > so put back an explicit list in the postinstall script. > > "Go for it" by christos@ in PR/54741. > > > > Should be pulled up to netbsd-9. > > thanks for making this less bad. > > i wonder if we can have some system in place where we will > only update these files if we can check they're unmodified, > eg, each file would have some hash(es) of known versions, > and if they're found not to match, fail the 'fix' operation > and allow the user to update manually. (this will make it > trip every time, unfortunately, but this seems less bad > than overriding local changes - i've been known to change > rc and rc.subr for various reasons..) Maybe we should define which files can be configurable or not in rc(8) man page? The visible problem is checkyesnox() in rc.subr was added in netbsd-8 and src/etc/rc.d/network requires checkyesnox(). I.e. rc.d scripts and rc.subr need to be sync'ed on upgrade. Anyway maybe we need another PR for this. --- Izumi Tsutsui
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: tsutsui Date: Sun Dec 29 22:19:13 UTC 2019 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Make sure rc, rc.subr, and rc.shutdown are properly updated. Currently there is no info which rc* files should be updated or not on upgrade (at least rc.conf and rc.local shouldn't), so put back an explicit list in the postinstall script. "Go for it" by christos@ in PR/54741. Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.11 src/usr.sbin/postinstall/postinstall.in:1.12 --- src/usr.sbin/postinstall/postinstall.in:1.11 Sun Dec 22 18:41:36 2019 +++ src/usr.sbin/postinstall/postinstall.in Sun Dec 29 22:19:13 2019 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.11 2019/12/22 18:41:36 christos Exp $ +# $NetBSD: postinstall.in,v 1.12 2019/12/29 22:19:13 tsutsui Exp $ # # Copyright (c) 2002-2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -1415,6 +1415,14 @@ do_pwd_mkdb() # rc # +# There is no info in src/distrib or /etc/mtree which rc* files +# can be overwritten unconditionally on upgrade. See PR/54741. +rc_644_files=" +rc +rc.subr +rc.shutdown +" + rc_obsolete_vars=" amd amd_master btcontrol btcontrol_devices @@ -1510,8 +1518,9 @@ do_rc() local rc_external_files="blacklist nsd unbound" # rc* files in /etc/ - local rc_444_files="$(select_set_files /etc/rc \ - "/etc/\(rc[^[:space:]/]*\)" ${etcsets})" + # XXX: at least rc.conf and rc.local shouldn't be updated. PR/54741 + #local rc_644_files="$(select_set_files /etc/rc \ + #"/etc/\(rc[^[:space:]/]*\)" ${etcsets})" # no-obsolete rc files in /etc/rc.d local rc_555_files="$(select_set_files /etc/rc.d/ \
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: tsutsui Date: Sun Dec 29 22:19:13 UTC 2019 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Make sure rc, rc.subr, and rc.shutdown are properly updated. Currently there is no info which rc* files should be updated or not on upgrade (at least rc.conf and rc.local shouldn't), so put back an explicit list in the postinstall script. "Go for it" by christos@ in PR/54741. Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.