Mercurial > pkg
view previous-work/more_control_helpers/lib/install @ 31:2ea43f89d84f
supress output.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 15 Jan 2013 12:24:31 +0000 |
parents | d6bef198ae71 |
children |
line wrap: on
line source
1 #!/bin/bash2 # Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>3 # You may do everything with this code except misrepresent its origin.4 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!6 manpagesowner=man-pages7 localedir=/usr/share/locale8 cmdline="$@"10 DAISY_CHAIN=""12 for p in $(type -ap install) ; do13 if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p ; break ; fi14 done16 if [ ! -n "$DAISY_CHAIN" ]; then17 echo Cannot find real ${0##*/} command18 exit 119 fi21 if [ $UID == 0 ]; then22 exec $DAISY_CHAIN "$@"23 fi25 #kill unused -c parameter if we get it26 if [ z"$1" = z"-c" ]; then shift 1 ; fi28 #********** test if we create directories ********************29 if [ \( z"$1" = z"-d" \) -o \( z"$1" = z"-m" -a z"$3" = z"-d" \) ]; then30 locdirs=""31 notify=032 havedir=033 for((i=$#; $i>0; ))34 do35 a="$1"36 shift 1; i=$(($i-1))37 case "$a" in38 -o|-g|--owner|--group) notify=139 shift 1; i=$(($i-1))40 set -- "$@"41 ;;42 $localedir/*) if [ ! -d "$a" ]; then43 locdirs="$locdirs ""`expr $a : "$localedir/\(.*\)"`"44 set -- "$@" "$a"45 havedir=146 else47 notify=148 set -- "$@"49 fi50 ;;51 */*|/sbin) if [ ! -d "$a" ]; then52 set -- "$@" "$a"53 havedir=154 else55 notify=156 set -- "$@"57 fi58 ;;59 *) set -- "$@" "$a" ;;60 esac61 done63 test $notify -eq 1 -o z"$locdirs" != z && \64 echo 1>&2 '***' install "$cmdline"66 test $havedir -eq 0 && exit 068 $DAISY_CHAIN "$@" || exit $?70 test z"$locdirs" != z &&71 for dir in $locdirs ; do72 cumuldir=""73 for d in `echo $locdirs | sed 's#/# #g' -` ; do74 cumuldir=$cumuldir$d/75 if [ -d $localedir/$cumuldir ]; then76 chgrp install $localedir/$cumuldir77 chmod g+w,o+t $localedir/$cumuldir78 fi79 done80 done82 else #if "$1" != "-d" ,i.e. we do not create directories *****************83 notify=084 for((i=$# ; $i>0; ))85 do86 a="$1"87 shift 1; i=$(($i-1))88 case "$a" in89 -m) set -- "$@" "$a"90 a="$1"91 shift 1; i=$(($i-1))92 case "$a" in93 4755) notify=1 ; set -- "$@" "755" ;;94 4775) notify=1 ; set -- "$@" "755" ;;95 4711) notify=1 ; set -- "$@" "711" ;;96 *) set -- "$@" "$a" ;;97 esac98 ;;99 -m4755) notify=1 ; set -- "$@" "-m755" ;;100 -m4775) notify=1 ; set -- "$@" "-m755" ;;101 -m4711) notify=1 ; set -- "$@" "-m711" ;;102 -o|-g|--owner|--group) notify=1103 shift 1; i=$(($i-1))104 set -- "$@"105 ;;106 */man/man?/*)107 if [ -e "$a" -a ! -O "$a" ]; then108 if [ `find "$a" -printf \%u` = $manpagesowner ]; then109 notify=1110 set -- "$@" not_installed111 else112 set -- "$@" "$a"113 fi114 else115 set -- "$@" "$a"116 fi117 ;;118 *) set -- "$@" "$a" ;;119 esac120 done122 test $notify -eq 1 && echo 1>&2 '***' install "$cmdline"124 $DAISY_CHAIN "$@" || exit $?125 fi127 exit 0