#!/bin/sh
#
-# "$Id$"
-#
# Install a program, script, or datafile.
#
-# Copyright 2008-2009 by Apple Inc.
+# Copyright 2008-2012 by Apple Inc.
#
# This script is not compatible with BSD (or any other) install program, as it
# allows owner and group changes to fail with a warning and makes sure that the
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
+gzipprog="${GZIPPROG-gzip}"
transformbasename=""
transform_arg=""
dst=""
dir_arg=""
+gzipcp() {
+ # gzipcp from to
+ $gzipprog -9 <"$1" >"$2"
+}
+
while [ x"$1" != x ]; do
case $1 in
-c)
continue
;;
+ -z)
+ instcmd="gzipcp"
+ shift
+ continue
+ ;;
+
*)
if [ x"$src" = x ]; then
src="$1"
if [ x"$dir_arg" != x ]; then
dst="$src"
src=""
-
+
if [ -d "$dst" ]; then
instcmd=:
else
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
- # might cause directories to be created, which would be especially bad
+ # might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ ! -f "$src" -a ! -d "$src" ]; then
echo "install: $src does not exist"
exit 1
fi
-
+
if [ x"$dst" = x ]; then
echo "install: No destination specified"
exit 1
# Update permissions and strip as needed, then move to the final name.
# If the chmod, strip, rm, or mv commands fail, remove the installed
# file...
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripopt "$dsttmp" || echo "warning: Unable to strip $dst!"; fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp" || echo "warning: Unable to change owner of $dst!"; fi
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp" || echo "warning: Unable to change group of $dst!"; fi
trap "rm -f ${dsttmp}" 0 &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripopt "$dsttmp"; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; fi &&
$doit $rmcmd -f "$dstdir/$dstfile" &&
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"