genromfs icon indicating copy to clipboard operation
genromfs copied to clipboard

Update installation folder

Open valentinpy opened this issue 7 years ago • 6 comments

Update installation folder to /usr/local instead of /usr in Makefile (MacOS doesn't allow user writing to /usr/bin anymore)

valentinpy avatar Jan 02 '18 14:01 valentinpy

On FreeBSD prefix for non-base packages is also /usr/local the same as on macOS BSD mentioned by @valentinpy.

This hardcoded /usr prefix is really problematic, because even though you select make prefix=/usr/local files are installed into /usr/local/usr/bin and /usr/local/usr/man not the /usr/local/bin nor /usr/local/man/ :-(

What is more make does not respect envitonment PREFIX as it should.

cederom avatar Oct 18 '21 00:10 cederom

Also if you look at install-man:

 58     if [ -f $(PREFIX)$(binndir)/man8 ]; then \
 59         rm -f $(PREFIX)$(bindir)/man8; \
 60     fi

THIS IS A DISASTER!!!

  • There is an error in variables: $(bindir) in place of $(mandir)!
  • When run as root and mess up the prefix it will delete your system files without asking!!!!!

cederom avatar Oct 18 '21 01:10 cederom

Here are fixes: https://github.com/chexum/genromfs/pull/3

cederom avatar Oct 18 '21 02:10 cederom

Also if you look at install-man:

 58     if [ -f $(PREFIX)$(binndir)/man8 ]; then \
 59         rm -f $(PREFIX)$(bindir)/man8; \
 60     fi

THIS IS A DISASTER!!!

* There is an error in variables: `$(bindir)` in place of `$(mandir)`!

* When run as root and mess up the prefix it will delete your system files without asking!!!!!

Thank you for the reported concerns! However, maybe you are missing that rm -f will only ever remove a file - and this is even protected by the condition to ensure a single file exists with this name. If you have a file named /usr/local/bin/man8, yes, it will be removed, but no such file should be normally part of a sane system - if you have information on a system that does, I'd be happy to reconsider. This fragment is a workaround to clean up a mistake in the installation script in a previous release, when the manual was installed under this name incorrectly. No other file will be removed, and this should not have adverse effect on any running system.

However, this is not really useful, nowadays people don't generally install packages from source, even less so installing obsolete versions, then installing later versions to upgrade the packages, so in a later release this should indeed be removed.

chexum avatar Nov 02 '21 11:11 chexum

On FreeBSD prefix for non-base packages is also /usr/local the same as on macOS BSD mentioned by @valentinpy.

This hardcoded /usr prefix is really problematic, because even though you select make prefix=/usr/local files are installed into /usr/local/usr/bin and /usr/local/usr/man not the /usr/local/bin nor /usr/local/man/ :-(

What is more make does not respect envitonment PREFIX as it should.

The makefile is indeed predates best practices for simple builds. PREFIX is roughly covering the functionality of DESTDIR, but that's roughly the only confusing part.

The expected usage is something like: make prefix=/usr/local PREFIX=/mnt/mychroot

The defaults would be indeed better to install into /usr/local by default, to make sure accidental make && make install don't disturb the files provided by the operating system under /usr. I'll try to have some time later to consider this and a few other issues that still bug me.

chexum avatar Nov 02 '21 11:11 chexum

Thanks @chexum :-) My fixes are provided in https://github.com/chexum/genromfs/pull/3. In addition to prefix is also fixes cc vs gcc. We use automation called Port to build on FreeBSD and provide binary package to the users, still users can build it on their own using that automation :-)

cederom avatar Nov 02 '21 12:11 cederom