diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/Etbg_update_list | 68 | ||||
-rw-r--r-- | utils/Makefile.am | 6 |
2 files changed, 70 insertions, 4 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 diff --git a/utils/Makefile.am b/utils/Makefile.am index 29c33e9..6f6e373 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,7 +1,7 @@ # $Id$ bin_PROGRAMS = Esetroot Etbg Ettable -bin_SCRIPTS = Etcolors Etsearch kEsetroot +bin_SCRIPTS = Etcolors Etsearch kEsetroot Etbg_update_list Esetroot_SOURCES = Esetroot.c Esetroot_LDFLAGS = -rpath $(libdir):$(pkglibdir) @@ -9,6 +9,4 @@ Esetroot_LDFLAGS = -rpath $(libdir):$(pkglibdir) Etbg_SOURCES = Etbg.c Ettable_SOURCES = Ettable.c -EXTRA_DIST = Etbg.c Esetroot.c Ettable.c Makefile.am \ - Makefile.in Etcolors Etsearch kEsetroot.in - +EXTRA_DIST = Etcolors Etsearch kEsetroot.in Etbg_update_list |