Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/postinstall build dynamically the list of compat ar...
details: https://anonhg.NetBSD.org/src/rev/aee57b5fdc74
branches: trunk
changeset: 999672:aee57b5fdc74
user: christos <christos%NetBSD.org@localhost>
date: Fri Jun 14 01:06:33 2019 +0000
description:
build dynamically the list of compat archsubdirs.
diffstat:
usr.sbin/postinstall/Makefile | 16 +-
usr.sbin/postinstall/postinstall | 2561 ----------------------------------
usr.sbin/postinstall/postinstall.in | 2562 +++++++++++++++++++++++++++++++++++
3 files changed, 2577 insertions(+), 2562 deletions(-)
diffs (truncated from 5159 to 300 lines):
diff -r 5a31b87bf2d4 -r aee57b5fdc74 usr.sbin/postinstall/Makefile
--- a/usr.sbin/postinstall/Makefile Fri Jun 14 01:00:52 2019 +0000
+++ b/usr.sbin/postinstall/Makefile Fri Jun 14 01:06:33 2019 +0000
@@ -1,9 +1,23 @@
-# $NetBSD: Makefile,v 1.1 2005/04/17 15:15:49 lukem Exp $
+# $NetBSD: Makefile,v 1.2 2019/06/14 01:06:33 christos Exp $
+
+.include <bsd.own.mk>
FILES= postinstall
MAN= postinstall.8
FILESDIR= /usr/sbin
FILESMODE= ${BINMODE}
+FILESBUILD= yes
+
+ARCHSUBDIRS != ${MAKE} -f ${NETBSDSRCDIR}/compat/archdirs.mk \
+ ACTIVE_CC=clang -V ARCHDIR_SUBDIR | ${TOOL_SED} -e 's@[a-z0-9_]*/@@g'
+
+.SUFFIXES: .in
+.in:
+ ${_MKTARGET_CREATE}
+ @rm -f ${.TARGET}
+ ${TOOL_SED} -e "s#@ARCHSUBDIRS@#${ARCHSUBDIRS}#" < ${.ALLSRC} > ${.TARGET}
+
+CLEANFILES+= postinstall
.include <bsd.prog.mk>
diff -r 5a31b87bf2d4 -r aee57b5fdc74 usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall Fri Jun 14 01:00:52 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2561 +0,0 @@
-#!/bin/sh
-#
-# $NetBSD: postinstall,v 1.232 2019/06/13 21:20:05 christos Exp $
-#
-# Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
-# All rights reserved.
-#
-# This code is derived from software contributed to The NetBSD Foundation
-# by Luke Mewburn.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# postinstall
-# Check for or fix configuration changes that occur
-# over time as NetBSD evolves.
-#
-
-#
-# XXX BE SURE TO USE ${DEST_DIR} PREFIX BEFORE ALL REAL FILE OPERATIONS XXX
-#
-
-#
-# checks to add:
-# - sysctl(8) renames (net.inet6.ip6.bindv6only -> net.inet6.ip6.v6only)
-# - de* -> tlp* migration (/etc/ifconfig.de*, $ifconfig_de*, ...) ?
-# - support quiet/verbose mode ?
-# - differentiate between failures caused by missing source
-# and real failures
-# - install moduli into usr/share/examples/ssh and use from there?
-# - differentiate between "needs fix" versus "can't fix" issues
-#
-
-# This script is executed as part of a cross build. Allow the build
-# environment to override the locations of some tools.
-: ${AWK:=awk}
-: ${DB:=db}
-: ${GREP:=grep}
-: ${HOST_SH:=sh}
-: ${MAKE:=make}
-: ${PWD_MKDB:=/usr/sbin/pwd_mkdb}
-: ${SED:=sed}
-: ${SORT:=sort}
-: ${STAT:=stat}
-
-#
-# helper functions
-#
-
-err()
-{
- exitval=$1
- shift
- echo 1>&2 "${PROGNAME}: $*"
- if [ -n "${SCRATCHDIR}" ]; then
- /bin/rm -rf "${SCRATCHDIR}"
- fi
- exit ${exitval}
-}
-
-warn()
-{
- echo 1>&2 "${PROGNAME}: $*"
-}
-
-msg()
-{
- echo " $*"
-}
-
-mkdtemp()
-{
- # Make sure we don't loop forever if mkdir will always fail.
- [ -d /tmp ] || err 2 /tmp is not a directory
- [ -w /tmp ] || err 2 /tmp is not writable
-
- _base="/tmp/_postinstall.$$"
- _serial=0
-
- while true; do
- _dir="${_base}.${_serial}"
- mkdir -m 0700 "${_dir}" && break
- _serial=$((${_serial} + 1))
- done
- echo "${_dir}"
-}
-
-# Quote args to make them safe in the shell.
-# Usage: quotedlist="$(shell_quote args...)"
-#
-# After building up a quoted list, use it by evaling it inside
-# double quotes, like this:
-# eval "set -- $quotedlist"
-# or like this:
-# eval "\$command $quotedlist \$filename"
-#
-shell_quote()
-{(
- local result=''
- local arg qarg
- LC_COLLATE=C ; export LC_COLLATE # so [a-zA-Z0-9] works in ASCII
- for arg in "$@" ; do
- case "${arg}" in
- '')
- qarg="''"
- ;;
- *[!-./a-zA-Z0-9]*)
- # Convert each embedded ' to '\'',
- # then insert ' at the beginning of the first line,
- # and append ' at the end of the last line.
- # Finally, elide unnecessary '' pairs at the
- # beginning and end of the result and as part of
- # '\'''\'' sequences that result from multiple
- # adjacent quotes in he input.
- qarg="$(printf "%s\n" "$arg" | \
- ${SED:-sed} -e "s/'/'\\\\''/g" \
- -e "1s/^/'/" -e "\$s/\$/'/" \
- -e "1s/^''//" -e "\$s/''\$//" \
- -e "s/'''/'/g"
- )"
- ;;
- *)
- # Arg is not the empty string, and does not contain
- # any unsafe characters. Leave it unchanged for
- # readability.
- qarg="${arg}"
- ;;
- esac
- result="${result}${result:+ }${qarg}"
- done
- printf "%s\n" "$result"
-)}
-
-# Convert arg $1 to a basic regular expression (as in sed)
-# that will match the arg. This works by inserting backslashes
-# before characters that are special in basic regular expressions.
-# It also inserts backslashes before the extra characters specified
-# in $2 (which defaults to "/,").
-# XXX: Does not handle embedded newlines.
-# Usage: regex="$(bre_quote "${string}")"
-bre_quote()
-{
- local arg="$1"
- local extra="${2-/,}"
- printf "%s\n" "${arg}" | ${SED} -e 's/[][^$.*\\'"${extra}"']/\\&/g'
-}
-
-# unprefix dir
-# Remove any dir prefix from a list of paths on stdin,
-# and write the result to stdout. Useful for converting
-# from ${DEST_DIR}/path to /path.
-#
-unprefix()
-{
- [ $# -eq 1 ] || err 3 "USAGE: unprefix dir"
- local prefix="${1%/}"
- prefix="$(bre_quote "${prefix}")"
-
- ${SED} -e "s,^${prefix}/,/,"
-}
-
-# additem item description
-# Add item to list of supported items to check/fix,
-# which are checked/fixed by default if no item is requested by user.
-#
-additem()
-{
- [ $# -eq 2 ] || err 3 "USAGE: additem item description"
- defaultitems="${defaultitems}${defaultitems:+ }$1"
- eval desc_$1=\"\$2\"
-}
-
-# adddisableditem item description
-# Add item to list of supported items to check/fix,
-# but execute the item only if the user asks for it explicitly.
-#
-adddisableditem()
-{
- [ $# -eq 2 ] || err 3 "USAGE: adddisableditem item description"
- otheritems="${otheritems}${otheritems:+ }$1"
- eval desc_$1=\"\$2\"
-}
-
-# checkdir op dir mode
-# Ensure dir exists, and if not, create it with the appropriate mode.
-# Returns 0 if ok, 1 otherwise.
-#
-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"
- return 1
- elif ! mkdir -m "${_cdmode}" "${_cddir}" ; then
- msg "Can't create missing ${_cddir}"
- return 1
- else
- msg "Missing ${_cddir} created"
- fi
- return 0
-}
-
-# 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,
-# with the first name corresponding to numerical value "start",
-# and with the special name "SKIP" being used to mark gaps in the
-# sequence.
-# Returns 0 if ok, 1 otherwise.
-#
-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"
- shift 5
- #_ids="$@"
-
- 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}"
- return 1
- fi
- _notfixed=""
- if [ "${_op}" = "fix" ]; then
- _notfixed="${NOT_FIXED}"
- fi
- _missing="$(${AWK} -v start=$_start -F: '
- BEGIN {
- for (x = 1; x < ARGC; x++) {
- if (ARGV[x] == "SKIP")
- continue;
- idlist[ARGV[x]]++;
- value[ARGV[x]] = start + x - 1;
- }
- ARGC=1
- }
- {
- found[$1]++
Home |
Main Index |
Thread Index |
Old Index