Files
blackbox/tools/mk_macports
tlimoncelli@stackexchange.com a772aea1d7 First attempt at a MacPorts config
2015-02-03 12:18:01 -05:00

39 lines
970 B
Bash
Executable File

#! /usr/bin/env bash
# Install files into MacPorts DESTDIR
# Usage:
# mk_macports MANIFEST MANIFEST1 ...
# Where "manifest.txt" contains:
# exec /usr/bin/stack_makefqdn misc/stack_makefqdn.py
# exec /usr/bin/bar bar/bar.sh
# read /usr/man/man1/bar.1 bar/bar.1.man
# 0444 /etc/foo.conf bar/foo.conf
# (NOTE: "exec" means 0755; "read" means 0744)
set -e
# Parameters for this RPM:
DESTDIR="${DESTDIR?"Envvar DESTDIR must be set to destination dir."}"
# -- Now the real work can be done.
# Copy the files into place:
cat """$@""" | while read -a arr ; do
PERM="${arr[0]}"
case $PERM in
\#*) continue ;; # Skip comments.
exec) PERM=0755 ;;
read) PERM=0744 ;;
*) ;;
esac
DST="$DESTDIR/${arr[1]}"
SRC="${arr[2]}"
if [[ $SRC == "cmd/"* || $SRC == *"/cmd/"* ]]; then
( cd $(dirname "$SRC" ) && go build -a -v )
fi
echo install -m "$PERM" "$SRC" "$DST"
install -m "$PERM" "$SRC" "$DST"
done