From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/plain/contrib/pdcmac/pinstall | 86 ++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 macros/plain/contrib/pdcmac/pinstall (limited to 'macros/plain/contrib/pdcmac/pinstall') 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: " + +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 -- cgit v1.2.3