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

[Linux] Make INSTALL_ROOT_SYSTEMWIDE configurable #300

Closed
ONL opened this issue Jun 20, 2018 · 9 comments
Closed

[Linux] Make INSTALL_ROOT_SYSTEMWIDE configurable #300

ONL opened this issue Jun 20, 2018 · 9 comments
Assignees

Comments

@ONL
Copy link

ONL commented Jun 20, 2018

The install script defines several environment variables, some of which are configurable by the user, like UNATTENDED_INSTALLATION

However, the install script in oolite/installers/posix/setup.body defines INSTALL_ROOT_SYSTEMWIDE="/opt"

It would be nice, if this was customizable, like

if [ ! ${INSTALL_ROOT_SYSTEMWIDE} ]
then
INSTALL_ROOT_SYSTEMWIDE="/opt"
fi

to allow overriding the directory for a system wide installation. This would facilitate packaging the app as a flatpak, because it could directly be installed to /app

@KonstantinosSykas
Copy link
Contributor

Hello ONL.
I am currently working on adding a command-line parameter.

Example
$ oolite-1.86.linux-x86.run --systemwide-path /app

Would this do the trick for flatpak?

KonstantinosSykas added a commit that referenced this issue Jul 2, 2018
The argument --systemwide-directory has been added, for systemwide installations, to choose an installation directory other than the default /opt. Use -h or --help to get the proper syntax.

Updated some email addresses too.
@KonstantinosSykas
Copy link
Contributor

KonstantinosSykas commented Jul 2, 2018

Committed e1ffdb6 on that matter.
Checkout tonight's nightly build Linux binary.

Usage Example for 64bit distros
# ./oolite-trunk-1.87.0.e1ffdb6.linux-x86_64.run -- --systemwide-directory DIRECTORY

Note 1
'#' indicates root shell

Note 2
The '-- ' (dash dash space) before the actual argument, is NOT a typo. It is the correct syntax to differentiate between package arguments and setup arguments.

Note 3
If a preexisting /opt installation exists, it will remain as "orphan", and must be manually deleted, for the time being. Next version of script will try to remove a probable /opt installation too.

Edit01: add note on '--' strange syntax.
Edit02: updated usage example.

@ONL
Copy link
Author

ONL commented Jul 4, 2018

The automated build succeeds, going to test the generated flatpak on thursday but I don't expect any issues.

Thank you @KonstantinosSykas for the quick addition, this should be a major step to produce a flatpak, that would be accepted by flathub (it you guys are interested in having Oolite listed there).

My fallback was to use rsync (just like the updater) to populate /app, but that required building rsync from source inside flatpak-builder.

Update: Jul-05-2018
Seems to work fine. Since I clean up the uninstaller anyway, I am happy with the current state

@KonstantinosSykas
Copy link
Contributor

The flathub opportunity is interesting indeed. However, let's lay low for the time being. I will take it to the boards on the relevant thread you have opened (http://aegidian.org/bb/viewtopic.php?f=9&t=19746).

Concerning the installer enhancement, it was a quick fix, as clean as possible, but there are still some things to consider. I am still working on the following issue that the current fix presents.

How to replicate the issue:

  1. Install Oolite systemwide in one directory; e.g. /opt
  2. Without uninstalling the first installation, proceed in installing Oolite systemwide in another directory; e.g. /usr/local/games

at this point you have an orphan installation in /opt and all execution shortcuts (i.e. desktop, command line) are linked to the new installation. Let's continue the scenario.

  1. Execute /opt/Oolite/uninstall. This will uninstall the /opt/Oolite installation but... 😨
  2. Your /usr/local/games is now orphan and all execution shortcuts (i.e. desktop, command line) are removed by the uninstall operation performed in Step 3. 🤦‍♂️

I am working on handling this by making uninstall aware of an orphan installation.

@ONL
Copy link
Author

ONL commented Jul 5, 2018

Question is, whether you want to allow arbitrary locations for installation. The "old" method of installing to /opt works fine, except for special use cases like flatpak
Maybe it should be --flatpak-install defaulting to /app instead of --systemwide-directory DIRNAME

Another option would be to place an uninstall-wrapper in /usr/local/bin where the other oolite-wrappers are stored. Then try to invoke the uninstall-wrapper if --systemwide-directory DIRNAME is provided during next install, thus cleaning up old installations.

@KonstantinosSykas
Copy link
Contributor

Many thanks for the feedback @ONL ! 😎

Is the /app directory created by flatpak?
The installer assumes an existing system directory is given.
If the directory is not there then the installation is aborted.

@ONL
Copy link
Author

ONL commented Jul 6, 2018

Yes, /app already exists inside flatpak environments.

KonstantinosSykas added a commit that referenced this issue Jul 10, 2018
to handle the case where another systemwide installation is deployed to a different directory than the one that we are trying to install/uninstall.
@KonstantinosSykas
Copy link
Contributor

Orphan installations handled with commit 6174e69.
If no other objections exist, this case will be closed.

@KonstantinosSykas
Copy link
Contributor

KonstantinosSykas commented Jul 12, 2018

This is just to summarize the solution given, before closing the case.

The command line parameter [-- --systemwide-directory DIRECTORY] is now supported by the installer. This allows systemwide installations to be deployed to a configurable directory. The directory value used for DIRECTORY must exist or else the installation will terminate. The [-- ] (dash dash space) before the actual parameter is mandatory! The default systemwide installation directory is /opt.

Usage Example
# ./oolite-trunk-1.87.0.e1ffdb6.linux-x86_64.run -- --systemwide-directory /usr/local/games

Syntax help Example
To get help on the command line parameters syntax, use the --help parameter as shown in the example.
# ./oolite-trunk-1.87.0.e1ffdb6.linux-x86_64.run --help

Important Note
The installer will try to uninstall a previous systemwide installation deployed to a different directory. However, only some heuristics are applied on that purpose and not an exhaustive and explicit search.
It is strongly recommended to uninstall previous installations before proceeding to a new one.

Edited 12-Jul-2018 15:30 (UTC): Added syntax help example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants