sane-wipe-*: consolidate into one sane-wipe binary

This commit is contained in:
Colin 2023-12-03 14:25:35 +00:00
parent b1b1f8d659
commit 9e51d7f150
7 changed files with 76 additions and 61 deletions

View File

@ -47,9 +47,7 @@ in
"sane-scripts.tag-music"
"sane-scripts.vpn"
"sane-scripts.which"
"sane-scripts.wipe-browser"
"sane-scripts.wipe-flare"
"sane-scripts.wipe-fractal"
"sane-scripts.wipe"
];
"sane-scripts.sys-utils" = declPackageSet [
"sane-scripts.ip-port-forward"

View File

@ -8,7 +8,7 @@
# - console shows error messages. quite possibly an endianness mismatch somewhere
# - moby (partially-emulated flare-signal): works! pairs and can send/receive messages, same as desko.
#
# error signatures (to reset, run `sane-wipe-fractal`):
# error signatures (to reset, run `sane-wipe flare`):
# - upon sending a message, the other side receives it, but Signal desktop gets "A message from Colin could not be delivered" and the local CLI shows:
# ```
# ERROR libsignal_service::websocket] SignalWebSocket: Websocket error: SignalWebSocket: end of application request stream; socket closing

View File

@ -212,19 +212,10 @@ let
src = ./src;
pkgs = [ "coreutils-full" "file" ];
};
wipe-browser = static-nix-shell.mkBash {
pname = "sane-wipe-browser";
wipe = static-nix-shell.mkBash {
pname = "sane-wipe";
src = ./src;
};
wipe-flare = static-nix-shell.mkBash {
pname = "sane-wipe-flare";
src = ./src;
pkgs = [ "dconf" "libsecret" ];
};
wipe-fractal = static-nix-shell.mkBash {
pname = "sane-wipe-fractal";
src = ./src;
pkgs = [ "libsecret" "systemd" ];
pkgs = [ "dconf" "libsecret" "systemd" ];
};
};
in sane-bin // {

View File

@ -0,0 +1,71 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p dconf -p libsecret -p systemd
help() {
echo "usage: sane-wipe <resource>"
echo "resource:"
echo " browser: kill and remove cache for firefox, chromium, brave, etc"
echo " flare: remove account settings/secrets and data for flare-signal messenger"
echo " fractal: remove account settings/secrets and data for fractal matrix messenger"
exit 1
}
wipe_browser() {
# remove firefox/librewolf/chromium artifacts
rm -rf \
~/.cache/BraveSoftware/* \
~/.cache/chromium \
~/.cache/librewolf/* \
~/.cache/mozilla/firefox/* \
~/.config/BraveSoftware/* \
~/.config/chromium \
~/.librewolf/default/* \
~/.mozilla/* \
|| true # in case no matches
# browsers like to stick around in the background so they can load faster
sudo pkill brave || true
sudo pkill firefox || true
sudo pkill librewolf || true
}
wipe_flare() {
secret-tool search --all --unlock 'xdg:schema' 'de.schmidhuberj.Flare'
secret-tool clear 'xdg:schema' 'de.schmidhuberj.Flare'
dconf reset -f /de/schmidhuberj/Flare/
rm -rf ~/.local/share/flare
echo "you may repair Flare. after doing so, mv ~/.local/share/flare ~/private/.local/share/flare to persist"
}
wipe_fractal() {
systemctl --user stop fractal
# first, ensure the relevant secrets are unlocked
secret-tool search --all --unlock 'xdg:schema' 'org.gnome.Fractal'
secret-tool search --all --unlock 'xdg:schema' 'org.gnome.Fractal.Hack'
# then, delete them
secret-tool clear 'xdg:schema' 'org.gnome.Fractal'
secret-tool clear 'xdg:schema' 'org.gnome.Fractal.Hack'
# N.B.: it may be necessary still to delete ~/.local/share/fractal/* (unsure)
}
case "$1" in
browser)
wipe_browser
;;
flare)
wipe_flare
;;
fractal)
wipe_fractal
;;
*)
help
esac

View File

@ -1,18 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash
# remove firefox/librewolf/chromium artifacts
rm -rf \
~/.cache/BraveSoftware/* \
~/.cache/chromium \
~/.cache/librewolf/* \
~/.cache/mozilla/firefox/* \
~/.config/BraveSoftware/* \
~/.config/chromium \
~/.librewolf/default/* \
~/.mozilla/* \
|| true # in case no matches
# browsers like to stick around in the background so they can load faster
sudo pkill brave || true
sudo pkill firefox || true
sudo pkill librewolf || true

View File

@ -1,12 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p dconf -p libsecret
# deletes Flare account, which is easy to break during setup
secret-tool search --all --unlock 'xdg:schema' 'de.schmidhuberj.Flare'
secret-tool clear 'xdg:schema' 'de.schmidhuberj.Flare'
dconf reset -f /de/schmidhuberj/Flare/
rm -rf ~/.local/share/flare
echo "you may repair Flare. after doing so, mv ~/.local/share/flare ~/private/.local/share/flare to persist"

View File

@ -1,15 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p libsecret -p systemd
# deletes Fractal accounts, which are prone to breakages
systemctl --user stop fractal
# first, ensure the relevant secrets are unlocked
secret-tool search --all --unlock 'xdg:schema' 'org.gnome.Fractal'
secret-tool search --all --unlock 'xdg:schema' 'org.gnome.Fractal.Hack'
# then, delete them
secret-tool clear 'xdg:schema' 'org.gnome.Fractal'
secret-tool clear 'xdg:schema' 'org.gnome.Fractal.Hack'
# N.B.: it may be necessary still to delete ~/.local/share/fractal/* (unsure)