aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAndré Erdmann <dywi@mailerd.de>2014-03-31 19:51:40 +0200
committerAndré Erdmann <dywi@mailerd.de>2014-04-01 18:36:36 +0200
commitf7b9302ecf014c0699f9114556755a7294ef2974 (patch)
tree27f03ebef3cb62c361d1c02d533225c1e0ed53ac /bin
parentMakefile: parallel generate-config (diff)
downloadR_overlay-f7b9302ecf014c0699f9114556755a7294ef2974.tar.gz
R_overlay-f7b9302ecf014c0699f9114556755a7294ef2974.tar.bz2
R_overlay-f7b9302ecf014c0699f9114556755a7294ef2974.zip
Makefile: $ROVERLAY_TARGET_TYPE
ROVERLAY_TARGET_TYPE controls which files get installed: when gentoo: => config/R-overlay.conf.install => no licenses file when others: => config/R-overlay.conf.install.others => install files/licenses to $DATADIR/licenses Also added a "generate-licenses" target for creating files/licenses.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build/make-licenses.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/build/make-licenses.sh b/bin/build/make-licenses.sh
new file mode 100755
index 0000000..77ae1d0
--- /dev/null
+++ b/bin/build/make-licenses.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# Creates a license list file for roverlay.
+#
+# Usage: make-licenses [dest_file] [compression]
+#
+# Environment variables:
+# * PORTDIR: path to the main tree (= root of the "licenses" dir)
+#
+set -u
+
+die() { echo "${1:-error}" 1>&2; exit ${2:-2}; }
+
+mkmap() {
+ local x
+ # find -type f, ls -1, ...
+ set +f
+ for x in "${PORTDIR}/licenses/"*; do
+ [ ! -f "${x}" ] || echo "${x##*/}"
+ done
+}
+
+mkmap_bz2() { mkmap | bzip2 -c; }
+mkmap_xz() { mkmap | xz -c; }
+mkmap_gz() { mkmap | gzip -c; }
+
+get_mkmap_func() {
+ case "${1-}" in
+ '') func=mkmap ;;
+ bz2|xz|gz) func=mkmap_${1} ;;
+ *) die "unknown compression '${1-}'." 64 ;;
+ esac
+}
+
+if [ -z "${PORTDIR-}" ]; then
+ PORTDIR="$(portageq get_repo_path / gentoo)"
+ #PORTDIR="$(portageq get_repo_path $(portageq envvar EROOT) gentoo)"
+ [ -n "${PORTDIR}" ] || PORTDIR="$(portageq envvar PORTDIR)"
+ [ -n "${PORTDIR}" ] || die "failed to get \$PORTDIR"
+fi
+
+case "${1-}" in
+ ''|'-')
+ get_mkmap_func "${2-}" && ${func}
+ ;;
+ *.bz2|*.xz|*.gz)
+ [ -z "${2-}" ] || [ "${2}" = "${1##*.}" ] || die
+ get_mkmap_func "${1##*.}" && ${func} > "${1}"
+ ;;
+ *)
+ get_mkmap_func "${2-}" && ${func} > "${1}"
+ ;;
+esac