News for hackers. Stuff that matters.
Re:Is curl|bash insecure? by Karunamon on Friday September 25, 2015 @12:58PM (#10279272)
Why the heck are you writing a custom installer like this?

One possible example: User specific installs. Interaction with the system package manager requires root rights, and isn't something that is a good fit for something like, say, RVM or rbenv. If I'm a nonprivileged user on someone else's general purpose system, I shouldn't have to bug the administrator to install something useful to me.

Re:Is curl|bash insecure? by Filligree on Friday September 25, 2015 @01:06PM (#10279309)
Nix solves this problem neatly.

Not saying that's answering your question, since Nix is woefully underused, but it's something to look at.

Re:Is curl|bash insecure? by codemac on Friday September 25, 2015 @02:03PM (#10279650)
Yeah I've been using arch for my "root" and guix for my users and it's a wonderland of excellence.

If you're interested in nix / guix, installing them and using them without the whole OS is a great way to get started.

Re:Is curl|bash insecure? by peterwwillis on Friday September 25, 2015 @02:03PM (#10279651)
All package managers allow user-specific installs.
Re:Is curl|bash insecure? by Karunamon on Friday September 25, 2015 @02:06PM (#10279667)
As a special case, sure.

http://askubuntu.com/questions/339/how-can-i-install-a-packa...

http://askubuntu.com/questions/28619/how-do-i-install-an-app...

But if you're going to extract deb files, why not just extract tarballs? Or better yet, just curl|bash? :)

Re:Is curl|bash insecure? by peterwwillis on Friday September 25, 2015 @02:28PM (#10279809)
There's lots of reasons to use packages. Verification, versioning, bug tracking, offline use, system-install, user-install, dependency tracking, rollback, sanity checking, custom install steps, and being tested and certified for a particular repository and software branch, among others. But, you know, if you just want to install something and not know what it is, what it does, how to fix it or remove it, much less whether it's even the software you expected, curl|bash is okay.
Re:Is curl|bash insecure? by Karunamon on Friday September 25, 2015 @02:38PM (#10279877)
We're talking about extracting packages in a one-off, unsupported configuration that literally nobody does, not using them as intended, so 90% of those things you mentioned are off the table.
Re:Is curl|bash insecure? by peterwwillis on Friday September 25, 2015 @02:48PM (#10279934)
What is off the table, exactly? You asked why you would extract a deb instead of extracting a tarball or curl|bash, right?

Because the deb is verifiable, because the deb can be inspected, because the deb is versioned, because the deb can be bug-reported, because the deb has dependency info, because you know what the deb was built for and supports, because the deb has clear scripts which tell you how to install and uninstall it, because it can be unpacked offline, etc.

Maybe you don't care about any of this. That is fine. I'm just telling you what the Deb gives you that a tarball or curl|bash won't.

Re:Is curl|bash insecure? by Karunamon on Monday September 28, 2015 @03:51PM (#10292713)
* Just about every .tgz I've ever downloaded had instructions on the downloading page to verify its signature

* I can inspect a .tgz easier than a .deb (tar -tzf)

* More often than not, the tgz version is in its filename (foobar.1.3.0-24.amd64.tgz)

* With that info, I can bug report it

* Fair 'nuff on depdencies

* I know what the tgz was built for and supports by either the download page or the filename

* Just about every tgz package I've ever downloaded included a Makefile that handled installation and uninstallation

* Offline unpacking is the only way to handle tgz's

Literally the only benefit to offline unpacking a .deb vs offline unpacking a .tgz is that the former includes a CONTROL file that lists dependencies in it.

Re:Is curl|bash insecure? by peterwwillis on Monday September 28, 2015 @05:51PM (#10293464)
So we both agree that RPM is superior to all these methods, and that curl|bash is effectively not even worth talking about; great. It seems the question you're posing is: why would I use a deb when I could just make a Slackware package (which is what you're using as an example of a 'tarball', which is actually just another name for a tar file, but I digress) and 'unpack' that.

As you must be aware, both Slackware and Debian have methods to install a package locally: 'dpkg -x package.deb $HOME/` for Debian, and 'installpkg --root=$HOME/ package.tgz` for Slackware. This is effectively an easier way to 'unpack' the packaged files without performing any other operations.

You mention verifying signatures? That's built into the deb. It isn't built into the tgz.

You mention 'inspecting' the deb is more difficult. Yet 'dpkg -c package.deb` is not only less characters to type, it gives you more detail due to the nature of the deb's file layout.

You mention the version is in the tgz file name 'more often than not'. Doesn't really give me the warm and fuzzies compared to having a file with real metadata about the origin of the package, like deb provides.

And a random version number does not give you the info to report a bug. If it's not official, you have no idea who built it, unless the author added their e-mail to a file inside the package, which most don't. And even with the version and author, you still don't know what system the package was built for! If you're lucky the version was bumped from one distro version to the next, and with luck they never built the same version for more than one distro version!

HOW do you know what the tgz was built for? Sometimes the architecture is included, but you don't know what distro, what version, or any other platform or build-specific information. A 'download page' is not reliable metadata, nor is it included with the package, thus the package does not have the information, thus it is irrelevant to this conversation.

Slackware packages do not come with Makefiles for installation nor uninstallation. In fact, almost no precompiled tarball i've ever seen has had a Makefile for installation or uninstallation. And i've manually packaged well over 10,000 pieces of software for various distributions.

Comparing Slackware packages and debs is like comparing a bicycle to a Ford F-150. Sure, the bicycle is lightweight and easy to use. But a pickup truck is way more useful.

Re:Is curl|bash insecure? by daxelrod on Friday September 25, 2015 @02:13PM (#10279714)
How would I install a package from one of the repositories as a non-root user for RPM or dpkg? I am not aware of any way to do this within either of those package managers.
Re:Is curl|bash insecure? by peterwwillis on Friday September 25, 2015 @02:21PM (#10279770)
You could use google for five minutes and find the answer. RedHat/Fedora have it as part of their guide on using RPM. (Hint: it involves making your own .rpmrc file)

Dpkg supports something similar but I forget when I last used it. Worst case you can just unpack the files into a local directory, add to your PATH and run it.

Re:Is curl|bash insecure? by daxelrod on Friday September 25, 2015 @03:17PM (#10280110)
I asked this only after googling, and having done previous research.

The best I was able to find for RPM is https://www.redhat.com/archives/rpm-list/2001-December/msg00... , which involves creating your own RPM database in your user directory, and using --prefix. Unfortunately, --prefix requires an RPM to have been built with relocatability http://www.rpm.org/max-rpm/s1-rpm-reloc-building-relocatable... in mind, and my experience is that most RPMs I've found from RedHat, EPEL, and Fedora aren't actually relocatable. Further many of them depend upon other root-specific things like creating new users, editing init files, chowning, etc. Of course, with this approach, you also need to create a dummy package to provide dependencies for all of the root-installed things on the system, and keep it up to date yourself.

I looked through https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentat... at your suggestion, but was unable to find the section you're talking about. Perhaps I overlooked it?

I'll also note that yum requires root unless you're willing to make substantial modifications to its source code, a process that I started but was never able to finish. This is outside of the scope of what I asked, however.

I'm less familiar with dpkg, but everything I've found so far simply suggests going around the package manager and instead unpacking the package and dealing with it manually.

Re:Is curl|bash insecure? by peterwwillis on Monday September 28, 2015 @02:41PM (#10292155)
Well you are right that the information isn't succinctly stated in the Fedora RPM guide or Maximum RPM, though different parts of these manuals go over the different things needed to set up a local install.

However, these are the results on the first page for a google of "installing rpms in local home directory". Some explain the rpm database, some talk about relocatability, and some talk about unpacking with cpio. There is no 100% reproducible solution. But you are taking software which was built to be installed on the system level and installing it on the user level, which never maps 100% on any operating system (as most users don't/shouldn't have admin privileges).

Installing a package locally to a user - best practices? https://unix.stackexchange.com/questions/73653/installing-a-...

Linux: Building RPMs without root access http://www.techonthenet.com/linux/build_rpm.php

yum install in user home for non-admins https://unix.stackexchange.com/questions/61283/yum-install-i...

How can I install an RPM without being root? https://superuser.com/questions/209808/how-can-i-install-an-...

rpm without root https://serverfault.com/questions/100189/rpm-without-root