summaryrefslogtreecommitdiff
path: root/common/mkiconlinks.sh
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-12-01 23:42:46 -0300
committerPerberos <[email protected]>2011-12-01 23:42:46 -0300
commitead8ef613ce66d51399a87d225b4cd52c6c7983e (patch)
tree28331e03ae7cced58068fc2a35dbf127d109a73e /common/mkiconlinks.sh
downloadmate-themes-ead8ef613ce66d51399a87d225b4cd52c6c7983e.tar.bz2
mate-themes-ead8ef613ce66d51399a87d225b4cd52c6c7983e.tar.xz
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'common/mkiconlinks.sh')
-rwxr-xr-xcommon/mkiconlinks.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/common/mkiconlinks.sh b/common/mkiconlinks.sh
new file mode 100755
index 00000000..b1573780
--- /dev/null
+++ b/common/mkiconlinks.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# usage:
+# mkiconlinks linkdata icondir
+#
+# Linkdata file consists of lines of the form:
+# filename1: filename2 filename3 ... filenameN
+#
+# For each line in the data file, the script creates a symbolic link to
+# $(icondir)/filename1 from each of $(icondir)/filename2,
+# $(icondir)/filename3 ... $(icondir)/filenameN.
+
+exec < $1
+cd $2
+
+read NEXTLINE
+while [ ! -z "$NEXTLINE" ] ; do
+
+ # Skip lines beginning with '#'
+ if [ ! "${NEXTLINE:0:1}" == '#' ]; then
+ #Extract first field, minus its trailing colon
+ ORIG_FILE=`echo $NEXTLINE | awk '/:/{print $1}' | sed -e 's/://'`
+
+ #Extract list of following fields
+ LINKTO=`echo $NEXTLINE | awk '/:/{for (i=2; i<=NF; i++) print $i}'`
+
+ if [ ! -z "$LINKTO" ] ; then
+ echo "Creating symlinks to `pwd`/$ORIG_FILE"
+ fi
+
+ fi
+
+ #Link each pair in turn
+ for i in $LINKTO ; do
+ ln -s -f "$ORIG_FILE" "$i"
+ done
+
+ read NEXTLINE
+done
+exit 0