ports/sysutils/radmind/files/patch-contrib__specialist
Thomas Zander 79c08ab7c5 - Update to new revision 2014052201
- Stagify
- Add LICENSE*
- Remove IGNORE_TIMESTAMPS option
- Handle file ownerships via pkg-plist macros
- Silence superfluous warnings
- Handle stripping of installed binaries
- Pet portlint

PR:		190120
Submitted by:	mikeg@bsd-box.net (maintainer)
Reviewed by:	riggs
Approved by:	mentors (implicit), maintainer (timeout)
2014-07-12 09:31:02 +00:00

82 lines
1.3 KiB
Text

--- ./contrib/specialist.orig 2014-06-29 12:15:04.244544161 +0200
+++ ./contrib/specialist 2014-06-29 12:15:04.245544128 +0200
@@ -0,0 +1,79 @@
+#! /bin/sh
+
+# specialist: assist creation of special files.
+
+PATH=/bin:/usr/bin:/usr/local/bin; export PATH
+
+SCRIPT=`basename "$0"`
+INPUT_FORMAT=${INPUT_FORMAT:=path}
+
+usage() {
+ echo "usage: ${SCRIPT} [ -T ]" 1>&2
+ exit 1
+}
+
+die() {
+ msg=$*
+
+ echo "${msg}" 1>&2
+ exit 2
+}
+
+# create a special transcript line for the given path.
+specialize() {
+ local path="$1"
+
+ [ -n "${path}" -a -f "${path}" ] || die "Invalid path: ${path}"
+
+ fsdiff -1 -c sha1 "${path}"
+ return $?
+}
+
+specialize_transcript() {
+ local path=""
+ status=0
+
+ while read type path remainder; do
+ if [ x"${type}" != x"f" ]; then
+ continue
+ fi
+
+ specialize "${path}"
+ done
+}
+
+specialize_paths() {
+ local path=""
+ status=0
+
+ while read path; do
+ specialize "${path}"
+ if [ $? -ne 0 ]; then
+ status=1
+ fi
+ done
+
+ return "${status}"
+}
+
+while getopts T opt; do
+ case $opt in
+ T)
+ INPUT_FORMAT="transcript"
+ ;;
+
+ *)
+ usage
+ ;;
+
+ esac
+done
+shift $((OPTIND - 1))
+
+if [ x"${INPUT_FORMAT}" = x"transcript" ]; then
+ specialize_transcript
+else
+ specialize_paths
+fi
+
+exit $?