summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2014-03-11 22:45:12 (EDT)
committer P. J. McDermott <pjm@nac.net>2014-03-11 22:45:12 (EDT)
commit11db1e77523cf08c9ee528ca48d64a2ef122c315 (patch)
tree80d27389a51f37b5b88d394f4473ec8a9b77633f /config
parent525c51d120858b8aa3216fbcaccd6da80b2f15e2 (diff)
config: New file.
Diffstat (limited to 'config')
-rwxr-xr-xconfig62
1 files changed, 62 insertions, 0 deletions
diff --git a/config b/config
new file mode 100755
index 0000000..2a43cbc
--- /dev/null
+++ b/config
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+set -e
+set -u
+
+main()
+{
+ case "${1-}" in
+ '')
+ config
+ ;;
+ 'clean')
+ clean
+ ;;
+ esac
+}
+
+msg()
+{
+ printf 'config: '
+ printf "${@}"
+ printf '\n'
+}
+
+config()
+{
+ local plat=
+ local pkg=
+
+ plat="$(sed '1{s/^config-\([^ ][^ ]*\) (.*$/\1/;};1!q;' changelog)"
+
+ # Make "-common" package to provide source package documentation files.
+ mkdir -p "config-${plat}-common.pkg"
+ cat >"config-${plat}-common.pkg/control" <<-EOF
+ Architecture: all
+ Platform: all
+ Description: "${plat}" platform configuration - common files
+ EOF
+ >"config-${plat}-common.pkg/docs"
+ msg 'Metadata for package "%s" generated.' "config-${plat}-common"
+
+ # Make each config-*-* package.
+ for pkg in src/*; do
+ pkg="${pkg#src/}"
+ mkdir -p "config-${pkg}-${plat}.pkg"
+ cat >"config-${pkg}-${plat}.pkg/control" <<-EOF
+ Architecture: all
+ Platform: all
+ Depends: config-${plat}-common (= \${Binary-Version})
+ Description: "${plat}" platform configuration for ${pkg}
+ EOF
+ msg 'Metadata for package "%s" generated.' \
+ "config-${pkg}-${plat}"
+ done
+}
+
+clean()
+{
+ rm -Rf config-*-*.pkg/
+}
+
+main "${@}"