mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 03:00:13 +02:00
Cleanup: the VR pet's tmpfs icon link (artifact pet)
<runtimeDir>/steam-frame-nix/vr-pet: icon.png when it links to a *-vr-pet-icons store icon, its empty .lock and stray .icon.tmp.* links, then the directory; kept by --orphans --keep pet. The empty runtime directory now also goes with --orphans.
This commit is contained in:
1 parent
57ed00e29c
commit
fbf9519be0
2 files changed
+47
-6
No files matched your search
+27
-4
@@ -75,7 +75,7 @@ Commands:
|
|||||||
or before removing it.
|
or before removing it.
|
||||||
--orphans what the configuration no longer uses (run by the Home
|
--orphans what the configuration no longer uses (run by the Home
|
||||||
Manager module on every switch); keeps saved choices.
|
Manager module on every switch); keeps saved choices.
|
||||||
--keep still in use (with --orphans): debugger, screenshots
|
--keep still in use (with --orphans): debugger, screenshots, pet
|
||||||
--dry-run only print what would be done
|
--dry-run only print what would be done
|
||||||
--quiet print only actions, deferrals and warnings
|
--quiet print only actions, deferrals and warnings
|
||||||
SteamVR's VRWebHelper.DebuggerEnabled can't be changed while SteamVR
|
SteamVR's VRWebHelper.DebuggerEnabled can't be changed while SteamVR
|
||||||
@@ -825,6 +825,26 @@ clean_screenshots() { # keep
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --- VR pet "+" menu icon link (tmpfs) ---
|
||||||
|
|
||||||
|
clean_pet() { # keep
|
||||||
|
local d=$SFN_RUNTIME/vr-pet l f
|
||||||
|
(( $1 )) && return 0
|
||||||
|
[[ -d $d && ! -L $d ]] || return 0
|
||||||
|
l=$d/icon.png
|
||||||
|
if [[ -L $l ]]; then
|
||||||
|
if [[ $(readlink "$l") == /nix/store/*-vr-pet-icons/*.png ]]; then
|
||||||
|
c_rm "$l" "link to the VR pet's \"+\" menu icon"
|
||||||
|
else
|
||||||
|
c_left "$l (not a link to a VR pet icon)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
while IFS= read -r -d '' f; do
|
||||||
|
c_rm "$f" "the VR pet icon's lock or unfinished link"
|
||||||
|
done < <(find "$d" -mindepth 1 -maxdepth 1 \( -name .lock -type f -empty -o -name '.icon.tmp.*' -type l \) -print0)
|
||||||
|
c_rmdir "$d"
|
||||||
|
}
|
||||||
|
|
||||||
# --- dashboard patch state ---
|
# --- dashboard patch state ---
|
||||||
|
|
||||||
clean_ui_state() { # all
|
clean_ui_state() { # all
|
||||||
@@ -845,7 +865,7 @@ clean_ui_state() { # all
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_cleanup() {
|
cmd_cleanup() {
|
||||||
local mode='' all=0 keep_debugger=0 keep_screenshots=0 keeps=0 k
|
local mode='' all=0 keep_debugger=0 keep_screenshots=0 keep_pet=0 keeps=0 k
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
--all) mode=all; shift ;;
|
--all) mode=all; shift ;;
|
||||||
@@ -858,7 +878,8 @@ cmd_cleanup() {
|
|||||||
case $k in
|
case $k in
|
||||||
debugger) keep_debugger=1 ;;
|
debugger) keep_debugger=1 ;;
|
||||||
screenshots) keep_screenshots=1 ;;
|
screenshots) keep_screenshots=1 ;;
|
||||||
*) die "cleanup: unknown artifact '$k' for --keep (debugger, screenshots)" ;;
|
pet) keep_pet=1 ;;
|
||||||
|
*) die "cleanup: unknown artifact '$k' for --keep (debugger, screenshots, pet)" ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
-h|--help) usage; exit 0 ;;
|
-h|--help) usage; exit 0 ;;
|
||||||
*) die "cleanup: unknown option '$1' (see --help)" ;;
|
*) die "cleanup: unknown option '$1' (see --help)" ;;
|
||||||
@@ -880,7 +901,9 @@ cmd_cleanup() {
|
|||||||
clean_ui_state "$all"
|
clean_ui_state "$all"
|
||||||
c_rmdir "$SFN_STATE"
|
c_rmdir "$SFN_STATE"
|
||||||
clean_screenshots "$keep_screenshots"
|
clean_screenshots "$keep_screenshots"
|
||||||
if (( all )); then clean_launchers; c_rmdir "$SFN_RUNTIME"; fi
|
clean_pet "$keep_pet"
|
||||||
|
(( all )) && clean_launchers
|
||||||
|
c_rmdir "$SFN_RUNTIME"
|
||||||
(( CLEAN_ACTIONS || ${#CLEAN_DEFERRED[@]} || CLEAN_QUIET )) || info "nothing to clean up"
|
(( CLEAN_ACTIONS || ${#CLEAN_DEFERRED[@]} || CLEAN_QUIET )) || info "nothing to clean up"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ pkgs.runCommand "cleanup-check" { nativeBuildInputs = [ cleanup pkgs.jq ]; } ''
|
|||||||
: > $root/run/steam-frame-nix/applications/.lock
|
: > $root/run/steam-frame-nix/applications/.lock
|
||||||
ln -s $HOME/.local/share/Steam/userdata/1/760/remote/250820/screenshots \
|
ln -s $HOME/.local/share/Steam/userdata/1/760/remote/250820/screenshots \
|
||||||
$root/run/steam-frame-nix/screenshots # steamFrame.screenshots
|
$root/run/steam-frame-nix/screenshots # steamFrame.screenshots
|
||||||
|
mkdir -p $root/run/steam-frame-nix/vr-pet # steamFrame.pet
|
||||||
|
ln -s /nix/store/00000000000000000000000000000000-vr-pet-icons/ginger.png $root/run/steam-frame-nix/vr-pet/icon.png
|
||||||
|
: > $root/run/steam-frame-nix/vr-pet/.lock
|
||||||
echo old > $root/run/systemd/user/steamvr.service.d/50-steam-frame-nix-debugger.conf
|
echo old > $root/run/systemd/user/steamvr.service.d/50-steam-frame-nix-debugger.conf
|
||||||
echo keep > $root/run/systemd/user/steamvr.service.d/other.conf
|
echo keep > $root/run/systemd/user/steamvr.service.d/other.conf
|
||||||
ln -s /nix/store/00000000000000000000000000000000-breeze-icons-6.30.0/share/icons/breeze/apps/64/utilities-terminal.svg $I/utilities-terminal.svg
|
ln -s /nix/store/00000000000000000000000000000000-breeze-icons-6.30.0/share/icons/breeze/apps/64/utilities-terminal.svg $I/utilities-terminal.svg
|
||||||
@@ -80,6 +83,7 @@ pkgs.runCommand "cleanup-check" { nativeBuildInputs = [ cleanup pkgs.jq ]; } ''
|
|||||||
mkdir -p $HOME/.var/app/org.jellyfin.JellyfinDesktop
|
mkdir -p $HOME/.var/app/org.jellyfin.JellyfinDesktop
|
||||||
echo so > $HOME/.var/app/org.jellyfin.JellyfinDesktop/mpv-hwdec-shim.so; touch $S/jellyfin-hwdec-shim
|
echo so > $HOME/.var/app/org.jellyfin.JellyfinDesktop/mpv-hwdec-shim.so; touch $S/jellyfin-hwdec-shim
|
||||||
echo '{"a":1}' > $S/ui-patches/frame-controls.json; echo '{' > $S/ui-patches/vr-cat.json.tmp
|
echo '{"a":1}' > $S/ui-patches/frame-controls.json; echo '{' > $S/ui-patches/vr-cat.json.tmp
|
||||||
|
echo '{"model":"shiba"}' > $S/ui-patches/vr-pet.json
|
||||||
echo mine > $S/ui-patches/notes.txt
|
echo mine > $S/ui-patches/notes.txt
|
||||||
|
|
||||||
exec 9< $F/d.busy/.parentlock # Firefox "uses" d.busy
|
exec 9< $F/d.busy/.parentlock # Firefox "uses" d.busy
|
||||||
@@ -118,7 +122,7 @@ pkgs.runCommand "cleanup-check" { nativeBuildInputs = [ cleanup pkgs.jq ]; } ''
|
|||||||
there $O/org.example.Other
|
there $O/org.example.Other
|
||||||
gone $HOME/.var/app/org.jellyfin.JellyfinDesktop/mpv-hwdec-shim.so $S/jellyfin-hwdec-shim
|
gone $HOME/.var/app/org.jellyfin.JellyfinDesktop/mpv-hwdec-shim.so $S/jellyfin-hwdec-shim
|
||||||
# ui state: ours gone, foreign file kept (so the dirs stay)
|
# ui state: ours gone, foreign file kept (so the dirs stay)
|
||||||
gone $S/ui-patches/frame-controls.json $S/ui-patches/vr-cat.json.tmp
|
gone $S/ui-patches/frame-controls.json $S/ui-patches/vr-cat.json.tmp $S/ui-patches/vr-pet.json
|
||||||
there $S/ui-patches/notes.txt
|
there $S/ui-patches/notes.txt
|
||||||
noop --all
|
noop --all
|
||||||
exec 9<&-
|
exec 9<&-
|
||||||
@@ -200,10 +204,24 @@ pkgs.runCommand "cleanup-check" { nativeBuildInputs = [ cleanup pkgs.jq ]; } ''
|
|||||||
there $root/run/steam-frame-nix/screenshots
|
there $root/run/steam-frame-nix/screenshots
|
||||||
res=$(steam-frame-nix-cleanup --orphans)
|
res=$(steam-frame-nix-cleanup --orphans)
|
||||||
gone $root/run/steam-frame-nix/screenshots
|
gone $root/run/steam-frame-nix/screenshots
|
||||||
ln -s /elsewhere $root/run/steam-frame-nix/screenshots
|
mkdir -p $root/run/steam-frame-nix; ln -s /elsewhere $root/run/steam-frame-nix/screenshots
|
||||||
res=$(steam-frame-nix-cleanup --orphans)
|
res=$(steam-frame-nix-cleanup --orphans)
|
||||||
has "$res" "left alone: $root/run/steam-frame-nix/screenshots"
|
has "$res" "left alone: $root/run/steam-frame-nix/screenshots"
|
||||||
rm -r $root/run/steam-frame-nix
|
rm -r $root/run/steam-frame-nix
|
||||||
|
# VR pet icon link: kept while used, a foreign link and file left alone
|
||||||
|
P=$root/run/steam-frame-nix/vr-pet; mkdir -p $P
|
||||||
|
ln -s /nix/store/00000000000000000000000000000000-vr-pet-icons/fox.png $P/icon.png
|
||||||
|
: > $P/.lock; ln -s /nix/store/00000000000000000000000000000000-vr-pet-icons/fox.png $P/.icon.tmp.123
|
||||||
|
res=$(steam-frame-nix-cleanup --orphans --keep pet)
|
||||||
|
there $P/icon.png $P/.lock $P/.icon.tmp.123
|
||||||
|
res=$(steam-frame-nix-cleanup --orphans)
|
||||||
|
gone $P
|
||||||
|
noop --orphans
|
||||||
|
mkdir -p $P; ln -s /elsewhere.png $P/icon.png; echo mine > $P/notes
|
||||||
|
res=$(steam-frame-nix-cleanup --orphans)
|
||||||
|
has "$res" "left alone: $P/icon.png"
|
||||||
|
there $P/icon.png $P/notes
|
||||||
|
rm -r $root/run/steam-frame-nix
|
||||||
! steam-frame-nix-cleanup --all --keep debugger 2>/dev/null || fail "--all --keep accepted"
|
! steam-frame-nix-cleanup --all --keep debugger 2>/dev/null || fail "--all --keep accepted"
|
||||||
! steam-frame-nix-cleanup --orphans --keep bogus 2>/dev/null || fail "unknown --keep accepted"
|
! steam-frame-nix-cleanup --orphans --keep bogus 2>/dev/null || fail "unknown --keep accepted"
|
||||||
echo "C ok"
|
echo "C ok"
|
||||||
|
|||||||
Reference in new issue
Block a user