racket/makefiles/installsh
Andy Keep a80f0fb0b3 - added custom install options. workarea creates an empty config.h,
and configure creates a config.h that sets the default scheme heap
  path and scheme-script name based on the actual configuration.
    configure, newrelease, workarea, checkin,
    c/Mf-base, scheme.c, main.c,
    Mf-install.in
- renamed the installed example directory from lib to examples.
    Mf-install.in,
    scheme.1.in
- added force option to gzip during man page install to prevent gzip from
  asking for permission to overwrite existing man page files.
    Mf-install.in
- removed ~/lib/csv%v/%m from the default scheme heap path on unix-like
  systems.  documented inclusion of %x\..\..\boot\%m in the Windows
  default scheme heap path.
    main.c,
    use.stex
- added new configuration options: --installbin, --installlib,
  --installschemename, --installpetitename, and --installscriptname.
    configure
- updated the example library link to the nanopass framework.
    CONTRIBUTING.md
- now cleaning up petite.1 and scheme.1 left behind by make install
    Makefile-workarea.in, checkin
- now removing workarea after cleaning csug and release_notes so
  Mf-stex (included from csug/Makefile and release_notes/Makefile)
  doesn't complain trying to determine the machine type.
    Makefile.in
- added installsh support for --ifdiff so the csug make file can use it
  for the install target.
    installsh,
    csug/Makefile
- added instructions for building (cross-compiling) a boot file for
  a supported machine type for which a boot file is not built by default.
    BUILDING

original commit: df4194c83a9e67d1ec20165fc3e2def4ed8e8986
2016-05-06 18:30:06 -04:00

79 lines
1.9 KiB
Bash
Executable File

#! /bin/sh
if [ -x /bin/true ]; then TRUE=/bin/true;
elif [ -x /usr/bin/true ]; then TRUE=/usr/bin/true;
else echo "Can't find /bin/true or /usr/bin/true" ; exit 1;
fi
while ${TRUE} ; do
mkdirs=0
ifdiff=0
while [ $# -ge 0 ] ; do
case $1 in
-d) mkdirs=1 ;;
-o) shift; owner=$1 ;;
-g) shift; group=$1 ;;
-m) shift; mode=$1 ;;
--ifdiff) ifdiff=1 ;;
-*) break 2 ;;
*) break ;;
esac
shift
done
if [ $mkdirs -eq 1 ] && [ $ifdiff -eq 1 ] ; then
break
fi
if [ $mkdirs -eq 1 ] ; then
dirs=$*
for dir in $dirs ; do
stack=""
while [ "$dir" != "/" -a "$dir" != "." -a "$dir" != ".." ] ; do
stack="$dir $stack"
dir=`dirname $dir`
done
for dir in $stack ; do
if [ ! -d $dir ] ; then
if mkdir $dir ; then
if [ "$owner" != "" ] ; then chown $owner $dir ; fi
if [ "$group" != "" ] ; then chgrp $group $dir ; fi
if [ "$mode" != "" ] ; then chmod $mode $dir ; fi
fi
fi
done
done
else
nargs=$#
if [ $nargs -lt 2 ] ; then break ; fi
files=""
while [ $# -ne 1 ] ; do
files="$files $1"
shift
done
dest=$1
if [ ! -d $dest -a $nargs -ne 2 ] ; then break ; fi
for file in $files ; do
destfile=$dest
if [ -d $destfile ] ; then destfile=$destfile/`basename $file` ; fi
if [ $ifdiff == 1 ] && cmp -s $file $destfile || cp -f -p $file $destfile ; then
if [ "$owner" != "" ] ; then chown $owner $destfile ; fi
if [ "$group" != "" ] ; then chgrp $group $destfile ; fi
if [ "$mode" != "" ] ; then chmod $mode $destfile ; fi
fi
done
fi
exit 0
done
echo "usage: $0 [ -o owner] [ -g group ] [ -m mode ] [ --ifdiff] file dest"
echo " $0 [ -o owner] [ -g group ] [ -m mode ] [ --ifdiff] file file ... dir"
echo " $0 -d [ -o owner] [ -g group ] [ -m mode ] dir dir ..."
exit 1