summaryrefslogtreecommitdiff
path: root/utils/Etbg_update_list
diff options
context:
space:
mode:
Diffstat (limited to 'utils/Etbg_update_list')
-rwxr-xr-xutils/Etbg_update_list68
1 files changed, 68 insertions, 0 deletions
diff --git a/utils/Etbg_update_list b/utils/Etbg_update_list
new file mode 100755
index 0000000..b91249b
--- /dev/null
+++ b/utils/Etbg_update_list
@@ -0,0 +1,68 @@
+#!/bin/sh -x
+#
+# Eterm backgrounds list file update utility
+#
+# $Id$
+
+LISTFILE=pixmaps.list
+
+if [ $# -gt 1 -o "X$1" = "X-h" -o "X$1" = "X--help" ]; then
+ echo "Syntax: Etbg_update_list [path]"
+ echo " (The default path is the current directory.)"
+ echo
+ exit 0
+fi
+
+# Find the pixmap directory
+for i in "$1" "$PWD" "$PWD/pix" "$PWD/../pix" ; do
+ if [ -d "$i/tile" -o -d "$i/scale" ]; then
+ PIXDIR="$i"
+ break
+ fi
+done
+
+cd $PIXDIR
+
+# Generate new pixmap list from tile/ and scale/ directories
+echo "Etbg_update_list: Generating pixmap list file from images in tile/ and scale/..."
+true > $LISTFILE.new
+
+if [ -d tile ]; then
+ for i in `(cd tile && ls -1)` ; do
+ echo '"tile/'$i'@0x0+0+0:tile"' >> $LISTFILE.new
+ done
+fi
+
+if [ -d scale ]; then
+ for i in `(cd scale && ls -1)` ; do \
+ echo '"scale/'$i'@100x100"' >> $LISTFILE.new ; \
+ done
+fi
+
+# Check to see if the list has changed. If so, back up the old one.
+if [ -s $LISTFILE ]; then
+ if (diff $LISTFILE $LISTFILE.new >/dev/null 2>&1); then
+ echo "Pixmap list is unchanged."
+ rm -f $LISTFILE.new
+ else
+ echo "Old pixmap list will be saved in $LISTFILE.old"
+ mv -f $LISTFILE $LISTFILE.old
+ fi
+fi
+if [ -s $LISTFILE.new ]; then
+ mv -f $LISTFILE.new $LISTFILE
+fi
+
+# If there's no theme directory nearby, just quit.
+if [ ! -d "../themes" ]; then
+ exit 0
+fi
+
+# If there is, cd into it and make sure all the themes have list files.
+cd ../themes
+for i in `ls -1` ; do
+ if [ -f $i/theme.cfg -a ! -e $i/$LISTFILE ]; then
+ echo "Creating symlink to $LISTFILE for theme $i"
+ (cd $i && ln -sf ../../pix/$LISTFILE $LISTFILE)
+ fi
+done