fenix-fox/fenix-fox.sh

111 lines
3.4 KiB
Bash
Executable file

#!/bin/sh
#
## Variables
#
# firefox dirs
firefox_root="$HOME/.mozilla/firefox"
firefox_profiledir="*.default-release"
installdir=`find $firefox_root -name $firefox_profiledir`
# git repo
fenix_fox="https://git.datenkastl.org/pmOS-tweaks/fenix-fox.git"
clonedir="/tmp/fenix-fox"
#
## Funktions
#
enable_profile_customizations() {
echo "Enable *toolkit.legacyUserProfileCustomizations.stylesheets* with user.js"
if [ ! -e "${installdir}/user.js" ]; then
echo 'user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);' \
> $installdir/user.js
elif grep -q toolkit.legacyUserProfileCustomizations.stylesheets $installdir/user.js
then
echo "user.js with *toolkit.legacyUserProfileCustomizations.stylesheets* already there"
echo "Do nothing! Please enable manually if not enabled!"
else
echo "Enable *toolkit.legacyUserProfileCustomizations.stylesheets* with user.js"
echo 'user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);' \
>> $installdir/user.js
fi
}
installcss() {
if [[ ! -n "$2" ]]; then
config="true-mobile"
else
config=$1
fi
case $config in
true-mobile)
deploy_true_mobile
;;
fenix-fox)
deploy_fenix_fox
;;
*)
echo "Available options: true-mobile, fenix-fox"
exit 1
;;
esac
}
deploy_fenix_fox() {
echo "Copy files in place and enable fenix-fox"
if [ -d "${installdir}/chrome" ]; then
echo "dir chrome already there, take backup"
mv $installdir/chrome $installdir/chrome.original
fi
mkdir $installdir/chrome
cp -r src/userChrome/fenix_fox.css $installdir/chrome/
cp -r src/userChrome/dynamic_popups_pro.css $installdir/chrome/
cp src/userChrome/userChrome-fenix_fox.css $installdir/chrome/userChrome.css
cp src/userContent/theme-fenix.css $installdir/chrome/userContent.css
}
deploy_true_mobile() {
echo "Copy files in place and enable true-mobile"
if [ -d "${installdir}/chrome" ]; then
echo "dir chrome already there, take backup"
mv $installdir/chrome $installdir/chrome.original
fi
mkdir $installdir/chrome
cp src/userChrome/{true_mobile_landscape.css,appMenu.css,editBookmarkPanel.css,findbar.css,popups.css,root.css,tabmenu.css,urlbar.css,extensions_menu.css,alt-browser-alt.css,custom_rules.css,iconized_main_menu.css,round_ui_items.css,numbered_tabs.css,tab_counter.css,true_mobile_mode.css,dynamic_popups_pro.css} $installdir/chrome
cp src/userChrome/userChrome-true-mobile.css $installdir/chrome/userChrome.css
cp src/userContent/theme-fenix.css $installdir/chrome/userContent.css
}
showhelp() {
echo "It's in progress... See https://git.datenkastl.org/pmOS-tweaks/fenix-fox"
}
# Clonerepo not in use
clonerepo() {
echo "clone fenix-fox to /tmp"
mkdir -p $clonedir
git clone $fenix_fox $clonedir
}
#
## Main
#
case "$1" in
--install)
enable_profile_customizations
installcss
echo "Finished! Restart firefox and enjoy your new design!"
exit 0
;;
*)
showhelp
exit 0
;;
esac