aboutsummaryrefslogtreecommitdiff
path: root/src/makealias.sh
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2007-03-19 15:56:56 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2007-03-19 15:56:56 +0000
commit0bcda635cb0d2b90e6f7d1718486e9ffeb1d3a71 (patch)
treef5c8bb254c3700ba787540413884f43e30831a1a /src/makealias.sh
parent5e02a5596fc9af6903b1b7ba950d83eb7e11a711 (diff)
added an aliasing "system": only the master objects are kept in CVS;
aliases are copied (or linked) from the master objects svn path=/trunk/externals/zexy/; revision=7507
Diffstat (limited to 'src/makealias.sh')
-rwxr-xr-xsrc/makealias.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/makealias.sh b/src/makealias.sh
new file mode 100755
index 0000000..4617bc9
--- /dev/null
+++ b/src/makealias.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+EXTENSIONS=".pd -help.pd .pd_linux .pd_darwin .pd_freebsd .dll .b_i386 .l_ia64 .l_i386 .d_fat .d_i386 .d_ppc .m_i386"
+
+ALIASFILE=$1
+shift
+
+if [ "x$ALIASFILE" = "x-clean" ]
+then
+ CLEANMODE=yes
+ ALIASFILE=$1
+ shift
+else
+ CLEANMODE=
+fi
+
+
+if [ -e "${ALIASFILE}" ]; then :; else
+ echo cannot find alias-file ${ALIASFILE}
+ exit 1
+fi
+
+
+function debug() {
+ :
+# echo $@
+}
+
+function do_makealias() {
+ if [ "x${CLEANMODE}" = "xyes" ]
+ then
+ if [ -e "$2" ]; then
+ debug "removing alias $2"
+ rm $2
+ else
+ debug "alias $2 does not exist"
+ fi
+ else
+ debug "aliasing $1 to $2"
+ ln -s $1 $2
+ fi
+}
+
+function do_makealiases() {
+ local dir
+ local master
+ local slave
+ local extension
+
+ dir=$1
+ master=$2
+ shift; shift
+
+ if [ "x${master}" = "x" ]; then
+ # no realname provided
+ return
+ fi
+
+ if [ "x$@" = "x" ]; then
+ # no aliases provided...
+ return
+ fi
+
+ for extension in ${EXTENSIONS}
+ do
+# echo "checking aliases for ${dir}/${master}${extension}"
+ if [ -f "${dir}/${master}${extension}" ]
+ then
+ for slave in $@
+ do
+ do_makealias ${dir}/${master}${extension} ${dir}/${slave}${extension}
+ done
+ fi
+ done
+}
+
+for d in $@
+do
+ if [ -d "$d" ]
+ then
+ debug "scanning directory $d for aliases"
+ cat ${ALIASFILE} | while read line
+ do
+ do_makealiases $d $line
+ done
+ else
+ echo "skipping non-directory $d"
+ fi
+done
+