mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 01:00:13 +02:00
Cleanup: a prefs.js that can't be read is left as is, not emptied
grep's read error (status 2) was swallowed with || true, so the profile's prefs.js could be rewritten with nothing. Now it warns and keeps both prefs.js and user.js for the next run.
This commit is contained in:
1 parent
32bd719284
commit
eb8206f4ee
1 file changed
+3
-2
+3
-2
@@ -716,7 +716,7 @@ ff_keys() { sed -n 's/^[[:space:]]*user_pref(\("[^"]*"\),.*/\1/p' "$1" 2>/dev/nu
|
||||
ff_in_use() { [[ -n $(find /proc/[0-9]*/fd -lname "$1/.parentlock" -print -quit 2>/dev/null) ]]; }
|
||||
|
||||
clean_firefox() { # all
|
||||
local all=$1 prof name u t kind keys pats left
|
||||
local all=$1 prof name u t kind keys pats left rc
|
||||
[[ -d $FF_DIR ]] || return 0
|
||||
for prof in "$FF_DIR"/*/; do
|
||||
prof=${prof%/}; name=${prof##*/}; u=$prof/user.js
|
||||
@@ -750,7 +750,8 @@ clean_firefox() { # all
|
||||
c_defer "$u: Firefox is using profile $name; close it and run this again"
|
||||
continue
|
||||
fi
|
||||
left="$(grep -vF "$pats" "$prof/prefs.js" || true)"
|
||||
rc=0; left="$(grep -vF "$pats" "$prof/prefs.js")" || rc=$?
|
||||
if (( rc > 1 )); then warn "could not read $prof/prefs.js; left as is"; continue; fi
|
||||
c_write "$prof/prefs.js" "values of the $kind: ${keys//$'\n'/ }" "$left"
|
||||
fi
|
||||
c_rm "$u" "$kind"
|
||||
|
||||
Reference in new issue
Block a user