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 location #17

Closed
dfangx opened this issue Jul 5, 2021 · 10 comments
Closed

Install location #17

dfangx opened this issue Jul 5, 2021 · 10 comments

Comments

@dfangx
Copy link

dfangx commented Jul 5, 2021

Is it possible to change the install location? My understanding is that /usr/ really should be for system-installed packages, not packages manually installed by the user. Proper install location should be in /usr/local/* or in a directory owned by the user.

@filips123
Copy link
Owner

I decided to use /usr because I will probably release the package to some package repo (probably PPA or some third-party) where I think packages should be installed directly in /usr, and I didn't want to create multiple packages and instructions with multiple install locations.

I might add support for easier changing of install location in the future, but I'm not sure what's the best way to do that.

However, you can change the install location of you build the package from the source:

  1. Change directory and file locations in the Rust source code:

  2. Change the location of firefoxpwa-connector in the native app manifest:

  3. Either manually copy listed in README to their new locations or modify Cargo.toml and build and install DEB package.

    Important: You must not change the location of manifest files because Firefox expects them to be in a pre-defined location.

@dfangx
Copy link
Author

dfangx commented Jul 5, 2021

Thanks for the help (and for doing such a great project!).

Have you considered setting the install prefix with an environment variable? Something like this:

        let install = if let Some(prefix) = option_env!("FFPWA_PREFIX") {
            PathBuf::from(prefix)
        }
        else {
            PathBuf::from("/usr/)
        };

Then you can still use /usr/ as the default location and if another install location is wanted, the user can just specify it as an env variable.

Just a thought off the top of my head

@filips123
Copy link
Owner

This could partly work, but the remaining problem is the manifest which still links to the original path. Maybe I could do some configure-style script that automatically renames all required paths in the code and manifest or even changes the install instructions in readme.

@ghost
Copy link

ghost commented Jul 6, 2021

Hey, any way to change /usr/libexec/firefoxpwa-connector to /usr/lib/firefoxpwa/firefoxpwa-connector? According to the Arch wiki, that is the way to go. Sorry if that is stupid to ask, I'm still learning about compiling and packaging, which is why I found it.

Thanks @dfangx I don't know how I could not have seen it.

@dfangx
Copy link
Author

dfangx commented Jul 6, 2021

This could partly work, but the remaining problem is the manifest which still links to the original path. Maybe I could do some configure-style script that automatically renames all required paths in the code and manifest or even changes the install instructions in readme.

If using an environment variable, you could just ignore it when setting the manifest path and default to the hardcoded path, since it seems like that can't be changed.

@dfangx
Copy link
Author

dfangx commented Jul 6, 2021

@TheFooI maybe try using sed to replace the source code paths to the one you want?

@filips123
Copy link
Owner

I made it easier to configure most install locations in df05306. You still need to use sed or manually replace the source code, as using build-time env vars could complicate code and make some things harder (for example, using home directory as a path), but I documented what each directory is for, and added a quick example how (and where) paths can be changed. I will also update the wiki with more details about this change.

@dfangx
Copy link
Author

dfangx commented Jul 22, 2021

Is there a plan to do this without having to modify the source code eventually?

@filips123
Copy link
Owner

Yes. I have some idea how to handle home directories, but I first need to check if it works, and do some other things. If it works, I will probably add it in the next release.

@filips123
Copy link
Owner

I implemented support for changing most install locations using build-time environment variables (FFPWA_EXECUTABLES, FFPWA_SYSDATA, FFPWA_USERDATA). However, you will still need to manually edit the installation script and manifest to actually install files to the correct location. This probably can't be changed.

If the variable starts with ~/, it will be expanded to the user home directory at the run-time.

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

2 participants