69 lines
1.6 KiB
Bash
Executable File
69 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# 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 -f -s ../../pix/$LISTFILE $LISTFILE)
|
|
fi
|
|
done
|