From 3168a8b06f15a4f7b719dca5af4701f48608caee Mon Sep 17 00:00:00 2001 From: Robert Peichaer Date: Tue, 26 Aug 2014 20:19:27 +0000 Subject: Create etc set during 'make build' and embed it in base set to make it available during a regular install or upgrade so that it doesn't need to be independently fetched. Idea, directions and OK deraadt@ Feedback and Ok halex@ and aja@ --- Makefile | 3 ++- distrib/miniroot/install.sub | 17 ++++++++++------- distrib/notes/m4.common | 39 ++++++++++++--------------------------- distrib/sets/checkflist | 19 +++++++++++++------ distrib/sets/lists/base/mi | 2 ++ distrib/sets/lists/etc/mi | 1 - distrib/sets/makeetcset | 44 ++++++++++++++++++++++++++++++++++++++++++++ distrib/sets/makeflist | 37 ------------------------------------- distrib/sets/maketars | 4 ++-- etc/Makefile | 18 ++++++++++-------- 10 files changed, 95 insertions(+), 89 deletions(-) create mode 100644 distrib/sets/makeetcset delete mode 100644 distrib/sets/makeflist diff --git a/Makefile b/Makefile index c82d992fca1..675c7c7c7ac 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.122 2014/07/09 19:23:28 espie Exp $ +# $OpenBSD: Makefile,v 1.123 2014/08/26 20:19:25 rpe Exp $ # # For more information on building in tricky environments, please see @@ -80,6 +80,7 @@ build: cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \ NOMAN=1 exec ${SUDO} ${MAKE} install ${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install + ${SUDO} /bin/sh ${.CURDIR}/distrib/sets/makeetcset ${.CURDIR} ${MAKE} .endif CROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \ diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index a6b697be5a1..2d48233e4fb 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.791 2014/08/10 20:54:17 rpe Exp $ +# $OpenBSD: install.sub,v 1.792 2014/08/26 20:19:26 rpe Exp $ # # Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback # All rights reserved. @@ -1287,7 +1287,12 @@ install_files() { _fsrc="$_src/$_f" [[ -f $_tmpsrc/$_f ]] && _fsrc="file://$_tmpsrc/$_f" case $_fsrc in - *.tgz) ftp -D Installing -Vmo - "$_fsrc" | tar -zxphf - -C /mnt;; + *.tgz) ftp -D Installing -Vmo - "$_fsrc" | tar -zxphf - -C /mnt + if [[ $_f == base*.tgz && $MODE == install ]]; then + ftp -D Extracting -Vmo - \ + file:///mnt/usr/share/sysmerge/etc.tgz | + tar -zxphf - -C /mnt + fi;; *) ftp -D Installing -Vmo "/mnt/$_f" "$_fsrc";; esac if (($?)); then @@ -2036,15 +2041,13 @@ md_consoleinfo # the contents of the other sets, not the other way around. THESETS="bsd bsd.rd bsd.mp $MDSETS" : ${DEFAULTSETS:="bsd bsd.rd"} -for _set in base etc comp man game xbase xetc xshare xfont xserv site; do - [[ $MODE == upgrade && $_set == @(etc|xetc) ]] && continue +for _set in base comp man game xbase xetc xshare xfont xserv site; do + [[ $MODE == upgrade && $_set == xetc ]] && continue THESETS="$THESETS ${_set}${VERSION}.tgz" isin $_set site && continue DEFAULTSETS="$DEFAULTSETS ${_set}${VERSION}.tgz" done -# Since etc${VERSION}.tgz is not in DEFAULTSETS for upgrades, it can always be -# in SANESETS. -SANESETS="${SANESETS:-bsd} base${VERSION}.tgz etc${VERSION}.tgz" +SANESETS="${SANESETS:-bsd} base${VERSION}.tgz" # prepare COLUMNS sanely COLUMNS=$(stty -a dnl @@ -123,20 +123,6 @@ define({:-OpenBSDcomp-:}, manual pages.showsize($1,$2)-:})dnl dnl dnl -dnl OpenBSDetc( compressed size, uncompressed size [, noupgrade]) -dnl Describes etcXX.tgz. -dnl -define({:-OpenBSDetc-:}, -{:- etc{:--:}OSrev This distribution set contains the system configuration - files that reside in /etc and in several other places. - This set MUST be installed{:--:}ifelse(X$3,X,{:- if you are installing the - system from scratch, but should NOT be used if you are - upgrading. (If you are upgrading, it's recommended that - you get a copy of this set and CAREFULLY upgrade your - configuration files by hand; see the section named - "Upgrading a previously-installed OpenBSD System" below.)-:},.)showsize($1,$2)-:})dnl -dnl -dnl dnl OpenBSDgame( compressed size, uncompressed size ) dnl Describes gameXX.tgz. dnl @@ -720,13 +706,12 @@ define({:-OpenBSDInstallWrapup-:}, ifelse(MDTZ,,dnl {:- The last thing you'll need to configure is the time zone your system will be using. For this to work properly, it is expected that you - have installed at least the "base{:--:}OSrev", "etc{:--:}OSrev", - and "bsd" distribution sets. + have installed at least the "base{:--:}OSrev" and "bsd" distribution sets. -:},dnl {:- The last thing you might need to configure, if you did not get the chance to earlier, is the time zone your system will be using. For this work properly, it is expected that you have installed at - least the "base{:--:}OSrev", "etc{:--:}OSrev", and "bsd" distribution sets. + least the "base{:--:}OSrev" and "bsd" distribution sets. -:})dnl dnl install.sh finish_up() @@ -865,15 +850,15 @@ new system in. It will also use your existing network parameters. From then, the upgrade procedure is very close to the installation procedure described earlier in this document. Note that the upgrade -procedure will not let you pick neither the ``etc{:--:}OSrev.tgz'' nor the -``xetc{:--:}OSrev.tgz'' sets, so as to preserve your files in `/etc' which -you are likely to have customized since a previous installation. - -However, it is strongly advised that you unpack the etc{:--:}OSrev.tgz and -xetc{:--:}OSrev.tgz sets in a temporary directory and merge changes by hand, or -with the help of the sysmerge(8) helper script, since all components of -your system may not function correctly until your files in `/etc' are -updated.-:})dnl +procedure will not let you pick the ``xetc{:--:}OSrev.tgz'' set, so as to +preserve your files in `/etc' which you are likely to have customized +since a previous installation. + +However, it is strongly advised that you unpack the etc{:--:}.tgz file +found in /usr/share/sysmerge and the xetc{:--:}OSrev.tgz in a temporary +directory and merge changes by hand, or with the help of the sysmerge(8) +helper script, since all components of your system may not function +correctly until your files in `/etc' are updated.-:})dnl dnl dnl dnl ========== Installation media preparation diff --git a/distrib/sets/checkflist b/distrib/sets/checkflist index 60ca1a17fe4..9536d97bc67 100644 --- a/distrib/sets/checkflist +++ b/distrib/sets/checkflist @@ -1,5 +1,5 @@ -#!/bin/sh -x -# $OpenBSD: checkflist,v 1.11 2009/04/17 03:58:54 deraadt Exp $ +#!/bin/sh +# $OpenBSD: checkflist,v 1.12 2014/08/26 20:19:26 rpe Exp $ # # Copyright (c) 2001 Theo de Raadt # All rights reserved. @@ -29,9 +29,16 @@ if [ "X${DESTDIR}" = "X" ]; then exit 1 fi -TMP=`mktemp /tmp/_ckr.XXXXXXXXXX` || exit 1 -trap 'rm -f $TMP' 0 1 15 +TMP1=`mktemp /tmp/_ckr.XXXXXXXXXX` || exit 1 + +trap '[ -f "$TMP1" ] && rm -f $TMP1' EXIT +trap 'exit' HUP TERM + +arch=`machine` + +for i in base comp etc game man; do + cat ./lists/$i/mi ./lists/$i/md.${arch} +done | sort >$TMP1 -sh makeflist > $TMP ( cd $DESTDIR ; find . \( -type d -o -type f -o -type l \) ) | \ - grep -v -e '^.$' | sort -H | diff $TMP - + fgrep -vx '.' | sort -H | diff $TMP1 - diff --git a/distrib/sets/lists/base/mi b/distrib/sets/lists/base/mi index 3afb5a4dc24..ee432cf3968 100644 --- a/distrib/sets/lists/base/mi +++ b/distrib/sets/lists/base/mi @@ -115,6 +115,7 @@ ./etc/magic ./etc/mail ./etc/mail/README +./etc/mail/helpfile ./etc/moduli ./etc/monthly ./etc/mtree @@ -3336,6 +3337,7 @@ ./usr/share/snmp/mibs/OPENBSD-SENSORS-MIB.txt ./usr/share/snmp/mibs/OPENBSD-SNMPD-CONF.txt ./usr/share/sysmerge +./usr/share/sysmerge/etc.tgz ./usr/share/tabset ./usr/share/tabset/std ./usr/share/tabset/stdcrt diff --git a/distrib/sets/lists/etc/mi b/distrib/sets/lists/etc/mi index 0d4117ff1d4..57707d25043 100644 --- a/distrib/sets/lists/etc/mi +++ b/distrib/sets/lists/etc/mi @@ -24,7 +24,6 @@ ./etc/mail/aliases.db ./etc/mail/genericstable ./etc/mail/genericstable.db -./etc/mail/helpfile ./etc/mail/local-host-names ./etc/mail/localhost.cf ./etc/mail/mailertable diff --git a/distrib/sets/makeetcset b/distrib/sets/makeetcset new file mode 100644 index 00000000000..dcc000b981e --- /dev/null +++ b/distrib/sets/makeetcset @@ -0,0 +1,44 @@ +#!/bin/sh +# $OpenBSD: makeetcset,v 1.1 2014/08/26 20:19:26 rpe Exp $ +# +# Copyright (c) 2014 Robert Peichaer +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +set -e + +CURDIR=$1 +MAKE=$2 + +cleanup() { + [ "X$ETCDIR" != "X" -a -d "/tmp/${ETCDIR#/tmp/}" ] && + rm -rf "/tmp/${ETCDIR#/tmp/}" +} + +if [ "X$CURDIR" = "X" -o "X$MAKE" = "X" ]; then + echo "Usage: `basename $0` " + exit 1 +fi + +ETCDIR=`mktemp -d /tmp/_etcdir.XXXXXXXXXX` +ETCSET=$ETCDIR/usr/share/sysmerge/etc.tgz + +trap 'cleanup' EXIT +trap 'exit' HUP INT QUIT TERM + +cd $CURDIR/etc +$MAKE DESTDIR=$ETCDIR distribution-etc-root-var +[ -s "$ETCSET" ] +cp $ETCSET /usr/share/sysmerge/ + +exit 0 diff --git a/distrib/sets/makeflist b/distrib/sets/makeflist deleted file mode 100644 index 570e2295b5f..00000000000 --- a/distrib/sets/makeflist +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# $OpenBSD: makeflist,v 1.10 2010/10/18 04:11:15 deraadt Exp $ -# -# Copyright (c) 2001 Theo de Raadt -# All rights reserved. -# -# 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 AUTHOR ``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 AUTHOR 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. - -arch=`machine` - -TMP=`mktemp /tmp/_mkr.XXXXXXXXXX` || exit 1 -trap 'rm -f $TMP' 0 1 15 - -for i in base comp etc game; do - cat ./lists/$i/mi ./lists/$i/md.${arch} >> $TMP -done -cat ./lists/man/mi ./lists/man/md.${arch} >> $TMP - -sort $TMP diff --git a/distrib/sets/maketars b/distrib/sets/maketars index 945b7ea2f4d..b8ff0e1f92b 100644 --- a/distrib/sets/maketars +++ b/distrib/sets/maketars @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: maketars,v 1.23 2014/07/09 19:23:28 espie Exp $ +# $OpenBSD: maketars,v 1.24 2014/08/26 20:19:26 rpe Exp $ # # Copyright (c) 2001 Theo de Raadt # All rights reserved. @@ -53,7 +53,7 @@ trap 'rm -f $TMP $TMP2; exit 1' 1 15 cd $fsdir -for i in base comp etc game man; do +for i in base comp game man; do echo -n "$i: " sort ${lists}/$i/mi ${lists}/$i/md.${arch} > $TMP cat $TMP | grep '^./usr/lib/lib' > $TMP2 diff --git a/etc/Makefile b/etc/Makefile index c2fee1cad01..6e72a18f376 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.390 2014/08/26 19:33:48 robert Exp $ +# $OpenBSD: Makefile,v 1.391 2014/08/26 20:19:26 rpe Exp $ TZDIR= /usr/share/zoneinfo LOCALTIME= Canada/Mountain @@ -60,8 +60,7 @@ RCDAEMONS= amd apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd \ wsmoused xdm ypbind ypldap yppasswdd ypserv nfsd mountd lockd \ statd spamlogd sndiod tftpd tftpproxy ldomd unbound iscsid -MISETS= base${OSrev}.tgz comp${OSrev}.tgz \ - man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz +MISETS= base${OSrev}.tgz comp${OSrev}.tgz man${OSrev}.tgz game${OSrev}.tgz all clean cleandir depend etc install lint: @@ -215,14 +214,10 @@ distribution-etc-root-var: distrib-dirs ${DESTDIR}/etc/rc.d && \ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \ ${DESTDIR}/etc/rc.d - -distribution: - exec ${SUDO} ${MAKE} distribution-etc-root-var - cd .. && exec ${SUDO} ${MAKE} install touch ${DESTDIR}/usr/share/sysmerge/etcsum touch ${DESTDIR}/usr/share/sysmerge/examplessum ETCLIST=`mktemp /tmp/_etclist.XXXXXXXXXX` || exit 1; \ - sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${ETCLIST}; \ + sort ${.CURDIR}/../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${ETCLIST}; \ cd ${DESTDIR} && \ xargs sha256 -h ${DESTDIR}/usr/share/sysmerge/etcsum < $${ETCLIST} || true; \ rm -f $${ETCLIST} @@ -231,6 +226,13 @@ distribution: cd ${DESTDIR} && \ xargs sha256 -h ${DESTDIR}/usr/share/sysmerge/examplessum < $${EGLIST} || true; \ rm -f $${EGLIST} + cd ${DESTDIR} && \ + sort ${.CURDIR}/../distrib/sets/lists/etc/{mi,md.${MACHINE}} | \ + pax -w -d | gzip -9 > ${DESTDIR}/usr/share/sysmerge/etc.tgz + +distribution: + exec ${SUDO} ${MAKE} distribution-etc-root-var + cd .. && exec ${SUDO} ${MAKE} install distrib-dirs: if [ ! -d ${DESTDIR}/. ]; then \ -- cgit v1.2.3