From 89fc6d39e0ef5428de6b355e80565b03812d1af5 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Thu, 22 Jan 2026 09:13:46 +0200 Subject: [PATCH] {homebrew,syncplay}: avoid /tmp here as well, while unnecessary --- bash/usr-local-bin/homebrew | 11 ++++++++--- bash/usr-local-bin/syncplay | 10 ++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bash/usr-local-bin/homebrew b/bash/usr-local-bin/homebrew index 4a1e7e1..0d260ab 100755 --- a/bash/usr-local-bin/homebrew +++ b/bash/usr-local-bin/homebrew @@ -8,8 +8,13 @@ if [ -d /var/roothome ]; then set -x export LC_ALL=C.utf8 - if [ -f "/tmp/brew.$(id -u).$(date -I)" ]; then - echo "Homebrew has been patched today. If this is wrong, rm /tmp/brew.$(id -u).$(date -I)" + if ! hash xdg-user-dir 2> /dev/null; then + echo "xdg-user-dir is required for my laziness" + exit 1 + fi + + if [ -f "$(xdg-user-dir RUNTIME)/brew.$(date -I)" ]; then + echo "Homebrew has been patched today. If this is wrong, rm $(xdg-user-dir RUNTIME)/brew.$(date -I)" else if [ ! -d "/home/linuxbrew/.linuxbrew" ]; then echo "Homebrew not found." @@ -19,7 +24,7 @@ if [ -d /var/roothome ]; then cd /home/linuxbrew/.linuxbrew/bin/ cp /home/linuxbrew/.linuxbrew/bin/brew /home/linuxbrew/.linuxbrew/bin/brew2 sed -i 's/pwd\ \-P/pwd/g' /home/linuxbrew/.linuxbrew/bin/brew2 - touch "/tmp/brew.$(id -u).$(date -I)" + touch "$(xdg-user-dir RUNTIME)/brew.$(date -I)" fi /home/linuxbrew/.linuxbrew/bin/brew2 $@ diff --git a/bash/usr-local-bin/syncplay b/bash/usr-local-bin/syncplay index 30fc31e..c86c5e5 100755 --- a/bash/usr-local-bin/syncplay +++ b/bash/usr-local-bin/syncplay @@ -5,7 +5,12 @@ set -x export LC_ALL=C.utf8 -if [ -f "/tmp/syncplay.$(id -u).$(date -I)" ]; then +if ! hash xdg-user-dir 2> /dev/null; then + echo "xdg-user-dir is required for my laziness" + exit 1 +fi + +if [ -f "$(xdg-user-dir RUNTIME)/syncplay.$(date -I)" ]; then echo "Syncplay has been touched today" else # If syncplay doesn't exist, get it @@ -36,7 +41,7 @@ else pip3 install pip --upgrade pip3 install -r requirements.txt --upgrade pip3 install -r requirements_gui.txt --upgrade - touch /tmp/syncplay.$(id -u).$(date -I) + touch $(xdg-user-dir RUNTIME)/syncplay.$(date -I) fi # finally launch the syncplay with any flags specified @@ -44,5 +49,6 @@ fi ~/src/github.com/syncplay/syncplay/syncplayClient.py "$@" # my syncplay launcher says this is a terminal app, so in case something goes # wrong, let it stay open for a moment for me to see what. +echo "" sleep 5 set +x