Live data from Hacker News

sudo make install

bvnf.space

11–20 of 38 posts

Re: sudo make install

#11

sudo make install is failure to use package management and an acceptance of unmanaged and increase system entropy. Tools like checkinstall are the way to go, at a minimum.

Indeed. Also, scripts (especially Dockerfiles) which run `apt-get install foo bar baz`; usually mixed in with a bunch of other commands, and file copying/editing. That's literally what package formats like .deb, .rpm, etc. are for! For example:

- Write your dependencies in a `my-package/DEBIAN/control` file

- If you want any extra files, put those in your `my-package/` folder too (e.g. `my-package/etc/some_config_file`, `my-package/usr/bin/some_executable`, etc.)

- If you want to run other commands, you can write a `my-package/DEBIAN/preinst` and/or `my-package/DEBIAN/postinst` script

- Run `dpkg-deb --build` to make your .deb file

Voila! Using a declarative format gives us an uninstaller "for free", lets us query which version is installed, and the installation will notify us of any conflicting files. Packages also tend to be more robust across different machines/environments, and don't drag in a whole extra OS plus VM/container-manager/etc.

More features are unlocked with a little extra specification, e.g. package conflicts (to avoid known-bad setups); dependency alternatives (e.g. prefer Caddy, accept Nginx, fall back to Apache); etc. I'm sure there are more quick-wins too, e.g. Googling gives me https://www.internalpointers.com/post/build-binary-deb-packa...

Disclaimer: Whilst I used to use Debian heavily (even on my phone!) I switched to Nix/NixOS about a decade ago, which I find even better. It's just infuriating to see the industry ignoring well crafted solutions, which have been around for decades, in favour of half-baked anti-patterns like Dockerfiles. Especially when the latter is often just a layer of crap on top of the former (like running `apt-get` in a script; rather than what it's designed for!)

Re: sudo make install

#12
> In my opinion, the best solution that POSIX.1-202x should use is to require make to set the PWD macro itself. The whole SCCS stuff in POSIX already requires make to think about PWD, so I don't see why this shouldn't happen

It should't happen because make isn't the problem, it's sudo not setting PWD to what you expect by default. This isn't a make bug, it's a sudo bug. Author even explicitly says this. They just prefer to modify make, for.... reasons.

Re: sudo make install

#13
post #10

Earlier quoted context omitted.

sed -i '' .... is compatible with both. It's not a big deal.

Doesn't work with `GNU sed`: $ sed -i '' 's/foo/FOO/' ip.txt sed: can't read s/foo/FOO/: No such file or directory See also: https://stackoverflow.com/questions/5694228/sed-in-place-fla...

But this works:

  $ sed -e 's/foo/FOO/' -i 'ip.txt'

Re: sudo make install

#14

sudo make install is failure to use package management and an acceptance of unmanaged and increase system entropy. Tools like checkinstall are the way to go, at a minimum.

[deleted]

Re: sudo make install

#15

sudo make install is failure to use package management and an acceptance of unmanaged and increase system entropy. Tools like checkinstall are the way to go, at a minimum.

It depends. For one off stuff that isn't expected to be a maintenance burden, adding an extra package step can be a higher burden.

That said, some things have a install-rpm or similar target in Makefile which can be handy.

Re: sudo make install

#16

sudo make install is failure to use package management and an acceptance of unmanaged and increase system entropy. Tools like checkinstall are the way to go, at a minimum.

That tool is really good to know about. I despise `sudo make install` because it can drop stuff anywhere, making it difficult to perform the inverse operation. You also always run the risk of conflicts with other applications. A package manager at best might bail out if it realizes it's going to clobber something it doesn't expect, but `sudo make install` on a different project is going to happily overwrite whatever it wants.

Re: sudo make install

#17
post #10

Earlier quoted context omitted.

Doesn't work with `GNU sed`: $ sed -i '' 's/foo/FOO/' ip.txt sed: can't read s/foo/FOO/: No such file or directory See also: https://stackoverflow.com/questions/5694228/sed-in-place-fla...

But this works: $ sed -e 's/foo/FOO/' -i 'ip.txt'

That's same as `sed -i 's/foo/FOO/' ip.txt` on GNU sed.

Question is about inplace editing command that works on both GNU and MacOS (without needing a backup, with backup `-i.bkp` works on both). I don't have a Mac to check if `sed -e 's/foo/FOO/' -i 'ip.txt'` works there.

Re: sudo make install

#18
post #16

sudo make install is failure to use package management and an acceptance of unmanaged and increase system entropy. Tools like checkinstall are the way to go, at a minimum.

That tool is really good to know about. I despise `sudo make install` because it can drop stuff anywhere, making it difficult to perform the inverse operation. You also always run the risk of conflicts with other applications. A package manager at best might bail out if it realizes it's going to clobber something it doesn't expect, but `sudo make install` on a different project is going to happily overwrite whatever…

> I despise `sudo make install` because it can drop stuff anywhere, making it difficult to perform the inverse operation.

It can, but I can't recall seeing it install anything outside of $PREFIX in my usage. At least not in recent memory. Of course it depends on how the Makefile was written, but most things I deal with use GNU autotools which makes it easy to specify where things go in general. Also a number of Makefiles come with an uninstall target which can be handy.

Re: sudo make install

#19

> In my opinion, the best solution that POSIX.1-202x should use is to require make to set the PWD macro itself. The whole SCCS stuff in POSIX already requires make to think about PWD, so I don't see why this shouldn't happen It should't happen because make isn't the problem, it's sudo not setting PWD to what you expect by default. This isn't a make bug, it's a sudo bug. Author even explicitly says this. They just pre…

I would say it is a make bug in that POSIX make has no good way to get PWD. Not necessarily a bug even, but an annoyance.

Re: sudo make install

#20

sudo make install is failure to use package management and an acceptance of unmanaged and increase system entropy. Tools like checkinstall are the way to go, at a minimum.

I mostly agree (I was working with sudo make install in order to package neatroff). However, most of the build scripts which generate binary packages for distros etc use `make install`, usually with DESTDIR set, so it's not irrelevant.

I also think `sudo make install` should at least work as expected in this one case, especially because this project isn't widely packaged so most users will be building from source.

Post reply on HN