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

nixos-prepare-root: chmod if dir already exists, fixes #22413 #31071

Merged
merged 1 commit into from Nov 11, 2017

Conversation

lukateras
Copy link
Member

Motivation for this change

Fixes #22413. Please note that while I have tested the new setupDir function separately, I haven't tested nixos-install or nixos-prepare-root, so testing is appreciated!

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@lukateras lukateras changed the title nixos-prepare-root: chmod if dir already exists nixos-prepare-root: chmod if dir already exists, fixes #22413 Nov 1, 2017
shift

for dir in $@; do
if [ -d "$dir" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd indentaton

mkdir -m 01777 -p $mountPoint/tmp
mkdir -m 0755 -p $mountPoint/tmp/root
mkdir -m 0755 -p $mountPoint/var
mkdir -m 0700 -p $mountPoint/root
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the install command does both creating a directory and change permission in one shot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, install -d does that.

@lukateras
Copy link
Member Author

lukateras commented Nov 4, 2017

Switched to install -d. Is there a way to test this script in a prefix without running nixos-install?

@Mic92
Copy link
Member

Mic92 commented Nov 7, 2017

we have nix-build nixos/tests/installer.nix for nixos-install tests.

@copumpkin
Copy link
Member

Looks good to me if the tests pass 👍

@orivej
Copy link
Contributor

orivej commented Nov 11, 2017

NixOS installer tests pass. Thank you!

@orivej orivej merged commit 2dd9588 into NixOS:master Nov 11, 2017
@copumpkin
Copy link
Member

Thanks!

@lukateras lukateras deleted the nixos-install/mkdir-or-chmod branch December 18, 2017 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants