Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install script broken on Linux #83

Open
simonbcn opened this issue Jan 30, 2023 · 0 comments
Open

Install script broken on Linux #83

simonbcn opened this issue Jan 30, 2023 · 0 comments

Comments

@simonbcn
Copy link

Arch Linux
❯ ./scripts/install.sh
./scripts/install.sh: line 26: cd: /home/juan/.mozilla/firefox//*.default: No such file or directory
Installing theme in /home/juan/fuentes/firefox-sweet-theme
Coping repo in /home/juan/fuentes/firefox-sweet-theme/chrome
cp: cannot copy a directory, '/home/juan/fuentes/firefox-sweet-theme', into itself, '/home/juan/fuentes/firefox-sweet-theme/chrome/firefox-sweet-theme'
Set configuration user.js file
Done.

I have checked the installation script and fixed it:

#!/bin/bash

THEMEDIRECTORY=$(cd `dirname $0` && cd .. && pwd)
FIREFOXFOLDER=~/.mozilla/firefox
PROFILENAME=""
GNOMISHEXTRAS=false

# Get options.
while getopts 'f:p:g' flag; do
	case "${flag}" in    
		f) FIREFOXFOLDER="${OPTARG}" ;;
		p) PROFILENAME="${OPTARG}" ;;
		g) GNOMISHEXTRAS=true ;;
	esac
done

# Define profile folder path.
if test -z "$PROFILENAME" 
	then
		PROFILEFOLDER="$FIREFOXFOLDER/*.default*"
	else
		PROFILEFOLDER="$FIREFOXFOLDER/$PROFILENAME"
fi

if [ -d $PROFILEFOLDER ]; then
	# Enter Firefox profile folder.
	cd $PROFILEFOLDER
	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.
	[[ -s userChrome.css ]] || echo >> userChrome.css

	# Import this theme at the beginning of the CSS files.
	sed -i '1s/^/@import "firefox-sweet-theme\/userChrome.css";\n/' userChrome.css

	# If GNOMISH extras enabled, import it in customChrome.css.
	if [ "$GNOMISHEXTRAS" = true ] ; then
		echo "Enabling GNOMISH extra features"
		[[ -s customChrome.css ]] || echo >> firefox-sweet-theme/customChrome.css
		sed -i '1s/^/@import "theme\/hide-single-tab.css";\n/' firefox-sweet-theme/customChrome.css
		sed -i '2s/^/@import "theme\/matching-autocomplete-width.css";\n/' firefox-sweet-theme/customChrome.css
	fi

	# Symlink user.js to firefox-sweet-theme one.
	echo "Set configuration user.js file"
	ln -s chrome/firefox-sweet-theme/configuration/user.js ../user.js

	echo "Done."
else
	echo "Error: Profile folder ($PROFILEFOLDER) doesn't exist"
fi

The end / was left over in the first FIREFOXFOLDER.
A final * was missing in the first PROFILEFOLDER. Generally, installations from the corresponding Linux package create a folder ending in .default-release.
And it is very important to check that the folder really exists before modifying things in the file system: if [ -d $PROFILEFOLDER ]; then.

@simonbcn simonbcn changed the title Install script broken Install script broken on Linux Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant