about summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-2-init.sh
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-08-04 20:41:11 +0300
committerArtturin <Artturin@artturin.com>2023-08-04 20:54:18 +0300
commit103bb49f84536d8fedc2b88a8ad81ff59342d400 (patch)
tree8739467dbbbcb0d8966a09eb81d4c2718555106c /nixos/modules/system/boot/stage-2-init.sh
parent5b3975cc66cefd3c199505c7a5780c5bbba95bce (diff)
nixos/stage-2-init: Change permission of /etc/nixos only if it exists
When I boot there's a warning `stage-2-init: install: cannot change permissions of '/etc/nixos': No such file or directory`
because my /etc/nixos is a symlink to $HOME/dotfiles.

```
/etc/nixos -> /home/artturin/dotfiles
```

These lines were added in 56b465390449926626d3378e05b8e507061cd828
Diffstat (limited to 'nixos/modules/system/boot/stage-2-init.sh')
-rwxr-xr-xnixos/modules/system/boot/stage-2-init.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index f9a2084ea9e8b..c0af29e3b9909 100755
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -104,7 +104,10 @@ fi
 
 
 # Required by the activation script
-install -m 0755 -d /etc /etc/nixos
+install -m 0755 -d /etc
+if [ -d "/etc/nixos" ]; then
+    install -m 0755 -d /etc/nixos
+fi
 install -m 01777 -d /tmp