nsbin/link-subdir-hard
2007-03-13 11:10:25 +01:00

29 lines
552 B
Bash
Executable file

#!/bin/sh
#
# Nico Schottelius <nico-linux //@// schottelius.org>
# Date: 13-Mär-2007
# Last Modified: -
# Description: Links files from /usr/packages/$pkg/$dir/* to /usr/local/$dir
#
if [ "$#" -ne 2 ]; then
echo "$0: package (below /usr/packages/) subdir (like bin, lib or include)"
exit 1
fi
basedir="$1"
subdir="$2"
destination=/usr/local
ddir="${destination}/${subdir}"
# link!
for file in "${basedir}/${subdir}"/*; do
if [ -f "$file" ]; then
ln "$file" "$ddir"
else
# directory
ln -s "$file" "$ddir"
fi
done