mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
nixos-container: do not touch os-release if it is a symlink
`/etc/os-release` of NixOS containers, which are `/var/lib/nixos-containers/*/etc/os-release` on the host, are usually symlinks to the absolute path `/etc/static/os-release` but it doesn't exist in non-NixOS host. Since `startScript` is evaluated by the host system, both `[ -e "$root/etc/os-release" ]` and `touch "$root/etc/os-release"` fail, so that the container fails to start on the second boot (on the first boot, the symlink doesn't exist, so the command succeeds). This commit avoids `touch "$root/etc/os-release"` if `$root/etc/os-release` is a symlink, so imperative NixOS containers are usable on non-NixOS host.
This commit is contained in:
parent
68a61b1bb6
commit
a009d2b73f
1 changed files with 1 additions and 1 deletions
|
@ -92,7 +92,7 @@ let
|
|||
chmod 0755 "$root/etc" "$root/var/lib"
|
||||
mkdir -p "$root/var/lib/private" "$root/root" /run/nixos-containers
|
||||
chmod 0700 "$root/var/lib/private" "$root/root" /run/nixos-containers
|
||||
if ! [ -e "$root/etc/os-release" ]; then
|
||||
if ! [ -e "$root/etc/os-release" ] && ! [ -h "$root/etc/os-release" ]; then
|
||||
touch "$root/etc/os-release"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue