From aba727e205493737a00ab153a60ffbca41b6ff21 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 26 Feb 2024 00:24:28 -0500 Subject: [PATCH] Use $HOME/.tmp instead of /tmp Works better with termux, etc --- fake_home/.zshrc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 6bbf9e4..d65013d 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -113,8 +113,8 @@ function push-dconf { echo "An alias for scpace has not been defined on this device!" return 1 fi - dconf-dump > /tmp/dconf-dump || return 1 - scp -P 11275 /tmp/dconf-dump 'sage@sagev.space:~/dconf-dump' + dconf-dump > $HOME/.tmp/dconf-dump || return 1 + scp -P 11275 $HOME/.tmp/dconf-dump 'sage@sagev.space:~/dconf-dump' } function push-extensions { @@ -122,13 +122,13 @@ function push-extensions { echo "gnome-extensions is not installed!" return fi - mv /tmp/gnome-extension-list /tmp/prev-gnome-extension-list &> /dev/null - gnome-extensions list > /tmp/gnome-extension-list + mv $HOME/.tmp/gnome-extension-list $HOME/.tmp/prev-gnome-extension-list &> /dev/null + gnome-extensions list > $HOME/.tmp/gnome-extension-list # If there is NO difference, skip scp - if [[ "$1" != "--force" ]] && diff /tmp/gnome-extension-list /tmp/prev-gnome-extension-list &> /dev/null; then + if [[ "$1" != "--force" ]] && diff $HOME/.tmp/gnome-extension-list $HOME/.tmp/prev-gnome-extension-list &> /dev/null; then return fi - scp -P 11275 /tmp/gnome-extension-list 'sage@sagev.space:~/gnome-extension-list' + scp -P 11275 $HOME/.tmp/gnome-extension-list 'sage@sagev.space:~/gnome-extension-list' } function merge-hist { @@ -136,12 +136,12 @@ function merge-hist { } function sync-history { - if ! scp -P 11275 'sage@sagev.space:~/histfile' "/tmp/.histfile"; then + if ! scp -P 11275 'sage@sagev.space:~/histfile' "$HOME/.tmp/.histfile"; then scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile' return fi - merge-hist "$HOME/.histfile" "/tmp/.histfile" > "/tmp/$(whoami).histfile" - mv "/tmp/$(whoami).histfile" "$HOME/.histfile" + merge-hist "$HOME/.histfile" "$HOME/.tmp/.histfile" > "$HOME/.tmp/$(whoami).histfile" + mv "$HOME/.tmp/$(whoami).histfile" "$HOME/.histfile" scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile' } @@ -150,9 +150,9 @@ function load-extensions { echo "gnome-extensions is not installed!" return fi - scp -P 11275 'sage@sagev.space:~/gnome-extension-list' /tmp/gnome-extension-list + scp -P 11275 'sage@sagev.space:~/gnome-extension-list' $HOME/.tmp/gnome-extension-list local existing="$(gnome-extensions list)" - for ext in $(cat /tmp/gnome-extension-list); do + for ext in $(cat $HOME/.tmp/gnome-extension-list); do if grep "$ext" <(echo $existing) &> /dev/null; then continue fi @@ -189,19 +189,19 @@ function sync-dconf { echo "System does not use dconf" return fi - rm /tmp/dconf-dump &> /dev/null - scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump - dconf-dump > /tmp/current-dconf-dump - if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then + rm $HOME/.tmp/dconf-dump &> /dev/null + scp -P 11275 'sage@sagev.space:~/dconf-dump' $HOME/.tmp/dconf-dump + dconf-dump > $HOME/.tmp/current-dconf-dump + if ! git --no-pager diff --no-index $HOME/.tmp/current-dconf-dump $HOME/.tmp/dconf-dump &> /dev/null; then echo echo "Incoming conf changes:" echo - git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump + git --no-pager diff --no-index $HOME/.tmp/current-dconf-dump $HOME/.tmp/dconf-dump echo bash -c 'read -p "Press enter to continue, or Ctrl-C to cancel."' || return 1 echo "Applying changes..." fi - dconf load / < /tmp/dconf-dump || return 1 + dconf load / < $HOME/.tmp/dconf-dump || return 1 } function getdot { @@ -227,7 +227,7 @@ if which starship &> /dev/null; then eval "$(starship init zsh)" fi -last_get_file="/tmp/.$(whoami)-dotfiles-last-get" +last_get_file="$HOME/.tmp/.$(whoami)-dotfiles-last-get" current_date="$(date '+%Y-%m-%d')" if test -d "$DOT_DIR" && [[ "$current_date" != "$(cat "$last_get_file")" ]] &> /dev/null; then echo "$current_date" > "$last_get_file"