4 # A minimal replacement for 'install' that supports installing symbolic links.
5 # Only a limited number of options are supported:
6 # -d dir Create a directory
7 # -m mode Sets a file's mode when installing
10 # If these commands aren't portable, we'll need some "if (arch)" type stuff
17 if [ "$1" = "-d" ] ; then
18 # make a directory path
23 if [ "$1" = "-m" ] ; then
29 # install file(s) into destination
30 if [ $# -ge 2 ] ; then
32 # Last cmd line arg is the dest dir
37 # Loop over args, moving them to DEST directory
41 # stop, don't want to install $DEST into $DEST
45 # determine file's type
46 if [ -h "$FILE" ] ; then
47 #echo $FILE is a symlink
48 # Unfortunately, cp -d isn't universal so we have to
51 # Use ls -l to find the target that the link points to
56 #echo $FILE is a symlink pointing to $TARGET
58 FILE=`basename "$FILE"`
59 # Go to $DEST and make the link
63 $SYMLINK "$TARGET" "$FILE"
66 elif [ -f "$FILE" ] ; then
67 #echo "$FILE" is a regular file
70 FILE=`basename "$FILE"`
71 chmod $MODE "$DEST/$FILE"
74 echo "Unknown type of argument: " "$FILE"
84 # If we get here, we didn't find anything to do
86 echo " install -d dir Create named directory"
87 echo " install [-m mode] file [...] dest Install files in destination"