summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatías Fonzo <selk@dragora.org>2020-02-06 20:21:44 -0300
committerSlávek Banko <slavek.banko@axis.cz>2020-02-10 20:14:51 +0100
commit670087710a7af6f1c504db0ff84763cfcf15aed9 (patch)
tree95ae2002b775ad362b554e06a8eba1f2af2aaf65
parentac70ac954ad22bbfa10dfc4f550e44cf2b11329e (diff)
downloadtdebase-670087710a7af6f1c504db0ff84763cfcf15aed9.tar.gz
tdebase-670087710a7af6f1c504db0ff84763cfcf15aed9.zip
starttde: Replace -nt operator (bashishm) with a portable solution
Signed-off-by: Matías Fonzo <selk@dragora.org> (cherry picked from commit c7474d81e9149da23b9fd95bea74dc33171feb3f)
-rwxr-xr-xstarttde15
1 files changed, 14 insertions, 1 deletions
diff --git a/starttde b/starttde
index 82bdc84d1..846b8563c 100755
--- a/starttde
+++ b/starttde
@@ -68,6 +68,15 @@ remove_from_path() {
eval export $var=${NPATH#:}
}
+# Portable alternative to the file operator -nt (among shells)
+is_newer() {
+ if test -n "$(find $1 -prune -newer $2 -print)"
+ then
+ return 0
+ fi
+ return 1
+}
+
echo "[starttde] Starting starttde." 1>&2
echo "[starttde] This script is $0" 1>&2
@@ -689,10 +698,14 @@ EXIT_CODE="$?"
# Remove moodin cache if we have a new wallpaper installed, jriddell. Distro-specific.
if [ -d "$tdehome/share/apps/ksplash/cache/Moodin/kubuntu" ]; then
- if [ /usr/share/wallpapers/kubuntu-wallpaper.png -nt "$tdehome/share/apps/ksplash/cache/Moodin/kubuntu/" ]; then
+ if is_newer /usr/share/wallpapers/kubuntu-wallpaper.png \
+ "$tdehome/share/apps/ksplash/cache/Moodin/kubuntu/"
+ then
rm -rf "$tdehome/share/apps/ksplash/cache/Moodin/kubuntu/"
fi
fi
+# The is_newer function will no longer be used, so we unset it
+unset is_newer
if test -z "$dl"; then
# The splashscreen and progress indicator.