From 244c033b05bb5e6a1bcaca19590c26444756c9c9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Mar 2007 10:44:08 +0100 Subject: [PATCH] Link packages into /usr/local --- link-subdir | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 link-subdir diff --git a/link-subdir b/link-subdir new file mode 100644 index 0000000..c0cc5ac --- /dev/null +++ b/link-subdir @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Nico Schottelius +# 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}" + +# test for existence, abort if conflicts are there +do_exit=0 +for file in "${basedir}/${subdir}"/*; do + basename=$(basename "$file") + dest="${ddir}/${basename}" + + if [ -e "${dest}" ]; then + echo "${dest} already exists, abort" + do_exit=1 + fi +done + +if [ "$do_exit" = 1 ]; then + exit 1 +fi + +# link! +for file in "${basedir}/${subdir}"/*; do + ln -s "$file" "$ddir" +done + +