summaryrefslogtreecommitdiff
path: root/distrib/sets/makeetcset
diff options
context:
space:
mode:
authorRobert Peichaer <rpe@cvs.openbsd.org>2014-08-26 20:19:27 +0000
committerRobert Peichaer <rpe@cvs.openbsd.org>2014-08-26 20:19:27 +0000
commit3168a8b06f15a4f7b719dca5af4701f48608caee (patch)
tree6ce1714ddbbf654ed9dd90f3c6d611aaa7dde79f /distrib/sets/makeetcset
parent1011e5941bf5ceacc24b6fc393a693c653a59a00 (diff)
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@
Diffstat (limited to 'distrib/sets/makeetcset')
-rw-r--r--distrib/sets/makeetcset44
1 files changed, 44 insertions, 0 deletions
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 <rpe@openbsd.org>
+#
+# 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` <CURDIR> <MAKE>"
+ 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