From 92b8071dc368d0b6897d68c46336b76d52e4c312 Mon Sep 17 00:00:00 2001 From: Francois Andriot Date: Sun, 18 Aug 2013 07:54:09 -0500 Subject: Fix xscreensaver integration missing files. This resolves bug report 141. --- tdescreensaver/kxsconfig/update_hacks.sh | 40 ++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) mode change 100755 => 100644 tdescreensaver/kxsconfig/update_hacks.sh (limited to 'tdescreensaver') diff --git a/tdescreensaver/kxsconfig/update_hacks.sh b/tdescreensaver/kxsconfig/update_hacks.sh old mode 100755 new mode 100644 index 2f88d1f2..7d4deca7 --- a/tdescreensaver/kxsconfig/update_hacks.sh +++ b/tdescreensaver/kxsconfig/update_hacks.sh @@ -1,18 +1,50 @@ #!/bin/sh -scsvs=`cd /usr/lib/xscreensaver/ && ls -1 | grep -v config` + +# Checks for Xscreensaver directory (may vary on different distributions) +if [ -d /usr/libexec/xscreensaver ]; then + XSDIR=/usr/libexec/xscreensaver +elif [ -d /usr/lib64/xscreensaver ]; then + XSDIR=/usr/lib64/xscreensaver +else + XSDIR=/usr/lib/xscreensaver +fi + +# Gets list of screensavers. Exclude 'config'. +scsvs="" +pushd "${XSDIR}" >/dev/null +for i in *; do + if [ "${i}" != "config" ]; then + scsvs="${scsvs} ${i}" + fi +done +popd >/dev/null + echo $scsvs + +# Removes useless .desktop files, if any +for f in ScreenSavers/*.desktop; do + # Gets the command line for this screensaver + Exec="$(sed -n '/^Exec=kxsconfig / s/.* \(.*\)/\1/' $f)" + if [ ! -x "${XSDIR}/${Exec}" ]; then + echo "Removing ${f}" + rm -f "${f}" + fi +done + +# Creates missing screensavers .desktop files for name in $scsvs; do - if test -f /usr/lib/xscreensaver/$name && test -f /usr/share/xscreensaver/config/$name.xml && test ! -f ScreenSavers/$name.desktop; then + if test -f "${XSDIR}/$name" && test -f "/usr/share/xscreensaver/config/$name.xml" && test ! -f "ScreenSavers/$name.desktop"; then echo "name: $name" label=`grep ' $f - if ldd /usr/lib/xscreensaver/$name 2>&1 | grep libGL; then + if ldd "${XSDIR}/$name" 2>&1 | grep libGL; then sed -e "s,@GL1@,X-TDE-Category=OpenGL Screen Savers,; s,@GL2@,X-TDE-Type=OpenGL," $f > $f.new else grep -v @GL $f > $f.new fi mv $f.new $f fi -done +done + -- cgit v1.2.1