summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/pdcmac/pinstall
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/plain/contrib/pdcmac/pinstall
Initial commit
Diffstat (limited to 'macros/plain/contrib/pdcmac/pinstall')
-rw-r--r--macros/plain/contrib/pdcmac/pinstall86
1 files changed, 86 insertions, 0 deletions
diff --git a/macros/plain/contrib/pdcmac/pinstall b/macros/plain/contrib/pdcmac/pinstall
new file mode 100644
index 0000000000..c9b6b95638
--- /dev/null
+++ b/macros/plain/contrib/pdcmac/pinstall
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+# I can't figure out how I'm supposed to use a builtin "install"
+# program in a makefile given that every Unix has an incompatible version!
+
+# This script shall behave similarly to GNU "install".
+
+version="1.1 Time-stamp: <pdc 1995-03-24>"
+
+echo=
+strip=:
+
+while test $# -gt 0; do
+ case $1 in
+ -c) ;;
+ -n|--no-create)
+ echo=echo ;;
+ --g*=*)
+ group=`expr $1 : '.*=\(.*\)$'` ;;
+ -g|--g*)
+ group=$2; shift ;;
+ -g*)
+ group=`expr $1 : '-.\(.*\)$'` ;;
+ --o*=*)
+ owner=`expr $1 : '.*=\(.*\)$'` ;;
+ -o|--o*)
+ owner=$2; shift ;;
+ -o*)
+ owner=`expr $1 : '-.\(.*\)$'` ;;
+ --m*=*)
+ mode=`expr $1 : '.*=\(.*\)$'` ;;
+ -m|--m*)
+ mode=$2; shift ;;
+ -m*)
+ mode=`expr $1 : '-.\(.*\)$'` ;;
+ -s|--strip)
+ strip=strip ;;
+ -h|--help)
+ cat <<@EOF
+$0 -- install files
+usage:
+ $0 [ OPTION ]... FILE1 FILE2
+ $0 [ OPTION ]... FILE1...FILEn DIR
+ $0 --help | --version
+options:
+ -c ignored
+ --group=GROUP --owner=USER --mode=MODE -g GROUP -o USER -m MODE
+ --strip -s
+@EOF
+ exit 0 ;;
+ -V|--version)
+ echo "PDCMAC install ($0) version $version"
+ exit 0 ;;
+ -*)
+ echo >&2 $0: $1: not understood -- try $0 --help
+ exit 2 ;;
+ *)
+ files="$files $lastfile"
+ lastfile=$1 ;;
+ esac
+ shift
+done
+
+#echo group=$group owner=$owner mode=$mode lastfile=$lastfile files=$files
+
+$echo cp -p $files $lastfile || exit 1
+if test -d "$lastfile"; then
+ $echo cd $lastfile
+else
+ files="$lastfile"
+fi
+
+if test -n "$group"; then
+ $echo chgrp $group $files || exit 1
+fi
+
+if test -n "$owner"; then
+ $echo chown $owner $files || exit 1
+fi
+
+if test -n "$mode"; then
+ $echo chmod $mode $files || exit 1
+fi
+$echo $strip $files
+
+exit 0