fenix-fox/fenix-fox.sh

118 lines
3.2 KiB
Bash
Raw Normal View History

2023-11-19 10:25:38 +00:00
#!/bin/sh
2023-11-19 22:07:05 +00:00
#
## Variables
#
# firefox dirs
2023-11-20 11:55:03 +00:00
firefox_root="$HOME/.mozilla/firefox"
2023-11-19 22:07:05 +00:00
firefox_profiledir="*.default-release"
2023-11-20 11:55:03 +00:00
installdir=`find $firefox_root -name $firefox_profiledir`
2023-11-19 22:07:05 +00:00
# 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
}
2023-11-22 23:16:31 +00:00
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
}
2023-11-22 22:17:01 +00:00
installcss() {
2023-11-22 22:57:27 +00:00
if [[ ! -n "$arg2" ]]; then
2023-11-22 22:17:01 +00:00
config="true-mobile"
else
2023-11-22 22:57:27 +00:00
config=$arg2
2023-11-22 22:17:01 +00:00
fi
case $config in
true-mobile)
deploy_true_mobile
;;
fenix-fox)
deploy_fenix_fox
;;
*)
echo "Available options: true-mobile, fenix-fox"
exit 1
;;
esac
}
2023-11-19 22:07:05 +00:00
deploy_fenix_fox() {
echo "Copy files in place and enable fenix-fox"
2023-11-22 23:16:31 +00:00
takebackup
2023-11-22 22:31:21 +00:00
mkdir $installdir/chrome
2023-11-22 20:52:52 +00:00
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
2023-11-19 22:07:05 +00:00
}
2023-11-22 22:17:01 +00:00
deploy_true_mobile() {
echo "Copy files in place and enable true-mobile"
2023-11-22 23:16:31 +00:00
takebackup
2023-11-22 22:31:21 +00:00
mkdir $installdir/chrome
2023-11-22 23:16:31 +00:00
cp src/userChrome/* $installdir/chrome/
2023-11-22 22:17:01 +00:00
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"
}
2023-11-19 22:07:05 +00:00
# Clonerepo not in use
clonerepo() {
echo "clone fenix-fox to /tmp"
mkdir -p $clonedir
git clone $fenix_fox $clonedir
}
#
## Main
#
2023-11-22 22:57:27 +00:00
# fix not passing by arguments
arg1=$1
arg2=$2
case "$arg1" in
2023-11-22 22:17:01 +00:00
--install)
enable_profile_customizations
installcss
echo "Finished! Restart firefox and enjoy your new design!"
exit 0
;;
2023-11-19 22:07:05 +00:00
2023-11-22 22:17:01 +00:00
*)
showhelp
exit 0
;;
esac