#!/usr/bin/env fish set ignoreProfiles "test|clean" # Regex (since fish still lacks a "string join") set lines "user_pref(\"network.cookie.cookieBehavior\", 1)" "user_pref(\"network.cookie.lifetimePolicy\", 2)" cd $HOME/.mozilla/firefox # Ignore "prefs.js" in extension subdirs and in test/clean profiles set prefsFiles (find . -regextype posix-egrep -name prefs.js -a -not -regex "\./($ignoreProfiles)/.*" -a -not -wholename '*/extensions/*') # Export X DISPLAY for notify-send set -x DISPLAY (who -u | awk '/\s:[0-9]\s/ {print $2}') for file in $prefsFiles for line in $lines if not grep $line $file >/dev/null ^&1 set errors $errors "File:$file NOT FOUND:$line" end end end if set -q errors for error in $errors echo $error end notify-send -i security-medium -u critical -t 5 "Firefox cookie settings changed" "$errors" exit 1 else exit 0 end