annotate previous-work/more_control_helpers/lib/chown @ 1:d6bef198ae71

add work by Matthias S. Benkmann which is the inspiration for this project.
author Robert McIntyre <rlm@mit.edu>
date Tue, 08 Jan 2013 11:45:01 +0000
parents
children
rev   line source
rlm@1 1 #!/bin/bash
rlm@1 2 # Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>
rlm@1 3 # You may do everything with this code except misrepresent its origin.
rlm@1 4 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
rlm@1 5
rlm@1 6 DAISY_CHAIN=""
rlm@1 7
rlm@1 8 for p in $(type -ap chown) ; do
rlm@1 9 if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p ; break ; fi
rlm@1 10 done
rlm@1 11
rlm@1 12 if [ ! -n "$DAISY_CHAIN" ]; then
rlm@1 13 echo Cannot find real ${0##*/} command
rlm@1 14 exit 1
rlm@1 15 fi
rlm@1 16
rlm@1 17 if [ $UID == 0 ]; then
rlm@1 18 exec $DAISY_CHAIN "$@"
rlm@1 19 fi
rlm@1 20
rlm@1 21 # Package users can't chown anything at all, so
rlm@1 22 # having the script test for specific parameters
rlm@1 23 # is pointless.
rlm@1 24 #if [ "$1" == "root.root" ]; then
rlm@1 25 echo 1>&2 '***' chown "$@"
rlm@1 26 #else
rlm@1 27 # $DAISY_CHAIN "$@" || exit $?
rlm@1 28 #fi
rlm@1 29
rlm@1 30 exit 0