#!/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 } takebackup() { 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.`date +%Y%m%d-%H%M%S` fi } installcss() { if [[ ! -n "$arg2" ]]; then config="true-mobile" else config=$arg2 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" takebackup 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" takebackup mkdir $installdir/chrome cp src/userChrome/* $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 # # fix not passing by arguments arg1=$1 arg2=$2 case "$arg1" in --install) enable_profile_customizations installcss echo "Finished! Restart firefox and enjoy your new design!" exit 0 ;; *) showhelp exit 0 ;; esac