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

Expand the multi-user installer to support Linuxes with systemd #2026

Merged
merged 4 commits into from Mar 30, 2018

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Mar 29, 2018

  • darwin installer: delete hardware report, not necessary
  • moves os-specific code from the darwin installer to to poly_*
    functions
  • adds profile.d support to the profile targets, which automatically
    handles many distros which don't have a /etc/bashrc but do have an
    /etc/profile.d
  • /bin/bash -> /usr/bin/env bash
  • document why each excluded shellcheck check is excluded
  • rename the multi-user to Daemon-based

Tested on:

  • Arch: Works
  • CentOS 7: Works
  • Debian Jessie: Works
  • Debian Stretch: Works
  • Debian Wheezy: falls back to the single user installer (not systemd)
  • Ubuntu Artful: Works
  • Ubuntu Wily: Works
  • Ubuntu Xenial: Works
  • Ubuntu Trusty: falls back to the single user installer (not systemd)
  • MacOS Sierra: Still works :)

 - darwin installer: delete hardware report, not necessary
 - moves os-specific code from the darwin installer to to `poly_*`
   functions
 - adds profile.d support to the profile targets, which automatically
   handles many distros which don't have a /etc/bashrc but do have an
   /etc/profile.d
 - /bin/bash -> /usr/bin/env bash
 - document why each excluded shellcheck check is excluded
 - rename the multi-user to Daemon-based
@grahamc
Copy link
Member Author

grahamc commented Mar 29, 2018

The diff is a bit tedious to read, but essentially the install-multi-user script is calls poly_* functions which implement platform-specific behavior, like creating a user, fetching a user's attribute, or setting a user's attribute.

@shlevy
Copy link
Member

shlevy commented Mar 29, 2018

Reviewed by downloading install-multi-user and diffing with a local copy of install-darwin-multi-user

@grahamc
Copy link
Member Author

grahamc commented Mar 29, 2018

@shlevy would you mind posting that diff?

@shlevy
Copy link
Member

shlevy commented Mar 29, 2018

https://gist.github.com/shlevy/b07809061307f0b93170fcbe11aea352

@edolstra
Copy link
Member

Can we do something about the extreme verbosity of the installer? Why is it necessary to tell the user about every sudo command separately? What useful information do messages like 'in order to give $1 a safe home directory' convey? ("Rule of Silence: When a program has nothing surprising to say, it should say nothing.")

In fact, why don't we just re-exec most of the installer under sudo, rather than invoke sudo a gazillion times?

@grahamc
Copy link
Member Author

grahamc commented Mar 30, 2018

I've heard from a number of people that they really like the verbosity, because they feel like they can look back and know exactly what happened, should they want to undo it. I've even been contracted to make other installers for other tools be similarly chatty... I have also heard the opposite, of course. Maybe there is a happy medium?

Maybe we could cut down the # of lines per sudo? or a --quiet?

…ons Nix

Grep would ignore files that didn't exist, but would complain
about files in a directory if the directory didn't exist. Simply check
for the directory first, prior to grepping it.
We use grep instead of an equality check because it is difficult
to extract _just_ the user's note, instead it is prefixed with
some plist junk. This was causing the user note to always be set,
even if there was no reason for it.
@grahamc
Copy link
Member Author

grahamc commented Mar 30, 2018

After some non-blocking cleanup patches, it is confirmed working on (this is a todo list):

  • macOS High Sierra
  • macOS Sierra
  • Arch
  • CentOS 7
  • Debian Jessie
  • Debian Stretch
  • Debian Wheezy (falls back to single user)
  • Ubuntu Artful
  • Ubuntu Xenial
  • Ubuntu Trusty (falls back to single user)

@grahamc
Copy link
Member Author

grahamc commented Mar 30, 2018

This is ready to go as far as my testing reveals, and I've opened #2027 to backport it to the maintenance branch.

@dezgeg
Copy link
Contributor

dezgeg commented Mar 30, 2018

To me doing this much stuff in a curl-piped-to-bash style script sounds scary when it comes to uninstallation, upgrads and such. E.g. currently the uninstall process is a dead simple rm -rf /nix but after this you need to manually remove the added users, etc...

I wonder if anybody has looked into https://github.com/jordansissel/fpm for building multi-user installer packages for Deb/RPM/Pacman?

@grahamc grahamc merged commit 3fbaa23 into NixOS:master Mar 30, 2018
grahamc added a commit that referenced this pull request Mar 30, 2018
Backport #2026: Expand the multi-user installer to support Linuxes with systemd
@grahamc grahamc deleted the multi-user-linux branch March 30, 2018 20:04
@dtzWill
Copy link
Member

dtzWill commented Mar 31, 2018

To me doing this much stuff in a curl-piped-to-bash style script sounds scary when it comes to uninstallation, upgrads and such. E.g. currently the uninstall process is a dead simple rm -rf /nix but after this you need to manually remove the added users, etc...

Good call: this does make it very unclear how to uninstall! I don't think the answer is an equally magic "uninstaller" (there be dragons) so exploring how to leverage package manager on each system would be very valuable.

(the package manager solutions might help provide an upgrade path as well?)


".... who would uninstall Nix?!" 😁

Continuing such thoughts.... "We've upgraded you to NixOS as well, you're welcome" 😉
(insert automatic kexec magic here)

@Mic92
Copy link
Member

Mic92 commented Mar 31, 2018

@dezgeg #1141 <- @abbradar invested some effort in improving rpm/deb packages.

@dezgeg
Copy link
Contributor

dezgeg commented Apr 19, 2018

Yeah I'm aware of that. I don't think it's an optimal approach though, so I've created a competing implementation: https://github.com/dezgeg/nix-fpm-multiuser

@Mic92
Copy link
Member

Mic92 commented Apr 22, 2018

@dezgeg I think it would make sense to also provide pre-build packages. Otherwise there is a bootstrap issue to build packages without having nix. The nix support in Travis + uploading release artifacts to github should allow to automate this.

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

Successfully merging this pull request may close these issues.

None yet

6 participants