firefox-gnome-theme/scripts/install.sh

60 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
THEMEDIRECTORY=$(cd `dirname $0` && cd .. && pwd)
2019-07-17 21:33:41 +03:00
FIREFOXFOLDER=~/.mozilla/firefox
PROFILENAME=""
GNOMISHEXTRAS=false
2019-07-12 19:07:20 +03:00
# Get options.
while getopts 'f:p:g' flag; do
case "${flag}" in
f) FIREFOXFOLDER="${OPTARG}" ;;
p) PROFILENAME="${OPTARG}" ;;
g) GNOMISHEXTRAS=true ;;
esac
done
2019-07-12 19:07:20 +03:00
# Define profile folder path.
if test -z "$PROFILENAME"
then
2019-07-17 21:33:41 +03:00
PROFILEFOLDER="$FIREFOXFOLDER/*.default*"
else
2019-07-12 19:07:20 +03:00
PROFILEFOLDER="$FIREFOXFOLDER/$PROFILENAME"
fi
2019-07-12 19:07:20 +03:00
# Enter Firefox profile folder.
if ! cd $PROFILEFOLDER ; then
echo "Error entering profile folder."
exit 1
fi
2019-07-12 19:07:20 +03:00
echo "Installing theme in $PWD"
# Create a chrome directory if it doesn't exist.
mkdir -p chrome
cd chrome
# Copy theme repo inside
echo "Coping repo in $PWD"
cp -R $THEMEDIRECTORY $PWD
# Create single-line user CSS files if non-existent or empty.
2019-07-12 19:07:20 +03:00
[[ -s userChrome.css ]] || echo >> userChrome.css
# Import this theme at the beginning of the CSS files.
2019-07-12 19:07:20 +03:00
sed -i '1s/^/@import "firefox-gnome-theme\/userChrome.css";\n/' userChrome.css
# If GNOMISH extras enabled, import it in customChrome.css.
if [ "$GNOMISHEXTRAS" = true ] ; then
2019-07-12 19:07:20 +03:00
echo "Enabling GNOMISH extra features"
[[ -s customChrome.css ]] || echo >> firefox-gnome-theme/customChrome.css
sed -i '1s/^/@import "theme\/hide-single-tab.css";\n/' firefox-gnome-theme/customChrome.css
sed -i '2s/^/@import "theme\/matching-autocomplete-width.css";\n/' firefox-gnome-theme/customChrome.css
fi
2019-07-12 19:07:20 +03:00
2019-07-12 19:38:16 +03:00
# Symlink user.js to firefox-gnome-theme one.
echo "Set configuration user.js file"
2019-07-12 19:45:29 +03:00
ln -s chrome/firefox-gnome-theme/configuration/user.js ../user.js
2019-07-12 19:38:16 +03:00
2019-07-12 19:07:20 +03:00
echo "Done."