Preserve existing user.js in profile folder when applying theme prefs
This commit is contained in:
parent
0cc285bf22
commit
cb871e5055
|
@ -78,10 +78,24 @@ function saveProfile(){
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Symlink user.js to firefox-gnome-theme one.
|
echo "Set configuration to user.js file" >&2
|
||||||
echo "Set configuration user.js file" >&2
|
|
||||||
ln -is chrome/firefox-gnome-theme/configuration/user.js user.js
|
|
||||||
|
|
||||||
|
mapfile -t theme_prefs < <( grep "user_pref" chrome/firefox-gnome-theme/configuration/user.js )
|
||||||
|
mapfile -t theme_prefs_unvalued < <( grep "user_pref" chrome/firefox-gnome-theme/configuration/user.js|cut -d'"' -f 2 )
|
||||||
|
if [ ! -f "user.js" ]; then
|
||||||
|
mv chrome/firefox-gnome-theme/configuration/user.js .
|
||||||
|
else
|
||||||
|
cp user.js user.js.bak
|
||||||
|
OLDIFS=$IFS
|
||||||
|
IFS='/'
|
||||||
|
for t in "${theme_prefs_unvalued[@]}"; do
|
||||||
|
sed -i "/$t/d" "user.js"
|
||||||
|
done
|
||||||
|
for f in "${theme_prefs[@]}"; do
|
||||||
|
echo "$f" >> "user.js"
|
||||||
|
done
|
||||||
|
IFS=$OLDIFS
|
||||||
|
fi
|
||||||
echo "Done." >&2
|
echo "Done." >&2
|
||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
|
@ -122,6 +136,5 @@ else
|
||||||
echo "Installing ${THEME} theme for $(sed 's/SPACECHARACTER/ /g' <<< $i) profile.";
|
echo "Installing ${THEME} theme for $(sed 's/SPACECHARACTER/ /g' <<< $i) profile.";
|
||||||
saveProfile "$(sed 's/SPACECHARACTER/ /g' <<< $i)"
|
saveProfile "$(sed 's/SPACECHARACTER/ /g' <<< $i)"
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue