1
0
Fork 0

firefox: tidy concatenating of user.js

This commit is contained in:
Alan Faubert 2023-08-22 17:59:05 -04:00
parent 78e2dcbcca
commit 91d033a013
1 changed files with 17 additions and 14 deletions

View File

@ -84,20 +84,23 @@ while :; do
;;
firefox-rebuild-win)
for dir in firefox/*; do
[ -d "$dir" ] || continue
config="$(basename "$dir")"
echo $'//\n// Generated at '"$(date)"$'\n//' > firefox/"$config"/user.js
IFS='+' read -a pieces <<< "$config"
for piece in "${pieces[@]}"; do
if [ -f firefox/"$piece".js ]; then
echo "// --- $piece.js ---" >> firefox/"$config"/user.js
cat firefox/"$piece".js >> firefox/"$config"/user.js
fi
if [ -f firefox/"$piece".pac ]; then
echo "// --- $piece.pac ---" >> firefox/"$config"/user.js
echo 'user_pref("network.proxy.autoconfig_url", "'file:///"$(wslpath -m .)"/firefox/"$piece".pac$'");\nuser_pref("network.proxy.type", 2);' >> firefox/"$config"/user.js
fi
done
[ -d "$dir" ] && {
echo '//'
echo "// Generated at $(date)"
echo '//'
IFS='+' read -a pieces <<< "$(basename "$dir")"
for piece in "${pieces[@]}"; do
if [ -f firefox/"$piece".js ]; then
echo "// --- $piece.js ---"
cat firefox/"$piece".js
fi
if [ -f firefox/"$piece".pac ]; then
echo "// --- $piece.pac ---"
echo "user_pref(\"network.proxy.autoconfig_url\", \"file:///$(wslpath -m .)/firefox/$piece.pac\");"
echo 'user_pref("network.proxy.type", 2);'
fi
done
} > "$dir"/user.js
done
true
;;