Fixed cp and ln errors messages

Fixed:
	- Now cp and ln will overwrite their targets
	- Duplicated imports when calling the script after the first install
This commit is contained in:
Reberti Carvalho Soares 2020-10-21 20:23:31 -03:00
parent c770570549
commit 97890066b5
No known key found for this signature in database
GPG Key ID: 8ACAD4697E4924A6
1 changed files with 23 additions and 22 deletions

View File

@ -53,32 +53,33 @@ cd chrome
# Copy theme repo inside
echo "Copying repo in $PWD"
cp -R $THEMEDIRECTORY $PWD
cp -fR $THEMEDIRECTORY $PWD
# Create single-line user CSS files if non-existent or empty.
[[ -s userChrome.css ]] || echo >> userChrome.css
if [ -s userChrome.css ]; then
# Remove older theme imports
sed 's/@import "firefox-gnome-theme.*.//g' userChrome.css | sed '/^\s*$/d' > userChrome.css
echo >> userChrome.css
else
echo >> userChrome.css
fi
# Import this theme at the beginning of the CSS files.
sed -i '1s/^/@import "firefox-gnome-theme\/userChrome.css";\n/' userChrome.css
if [ $THEME != "DEFAULT" ]; then
if [ $THEME = "yaru" ]; then
echo "Setting $THEME theme."
echo '@import "firefox-gnome-theme\/theme/colors/light-yaru.css";' >> userChrome.css
echo '@import "firefox-gnome-theme\/theme/colors/dark-yaru.css";' >> userChrome.css
fi
else
if [ $THEME = "DEFAULT" ]; then
echo "No theme set, using default adwaita."
else
echo "Setting $THEME theme."
echo "@import \"firefox-gnome-theme\/theme/colors/light-$THEME.css\";" >> userChrome.css
echo "@import \"firefox-gnome-theme\/theme/colors/dark-$THEME.css\";" >> userChrome.css
fi
cd ..
# Symlink user.js to firefox-gnome-theme one.
echo "Set configuration user.js file"
if ! ln -s chrome/firefox-gnome-theme/configuration/user.js user.js ; then
echo "Please, manually copy theme's user.js contents to yours."
fi
ln -fs chrome/firefox-gnome-theme/configuration/user.js user.js
echo "Done."