From 3bedff357a38f965be91b9a88cbe0a82be4a1b4c Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Mon, 8 Jan 2018 19:08:02 +0100 Subject: [PATCH] etc: make link warnings more noticable Hopefully this helps to make it more obvious that the file will not be created by nix-darwin. See #65 --- modules/system/etc.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/system/etc.nix b/modules/system/etc.nix index b99ca99..242570e 100644 --- a/modules/system/etc.nix +++ b/modules/system/etc.nix @@ -45,14 +45,14 @@ in ln -sfn "$(readlink -f $systemConfig/etc)" /etc/static for f in $(find /etc/static/* -type l); do - l="$(echo $f | sed 's,/etc/static/,/etc/,')" - d="$(dirname $l)" + l=/etc/''${f#/etc/static/} + d=''${l%/*} if [ ! -e "$d" ]; then mkdir -p "$d" fi if [ -e "$l" ]; then if [ "$(readlink $l)" != "$f" ]; then - echo "warning: not linking $l because $l exists, skipping..." >&2 + echo "warning: not linking environment.etc.\"''${l#/etc/}\" because $l exists, skipping..." >&2 fi else ln -s "$f" "$l" @@ -61,6 +61,7 @@ in for l in $(find /etc/* -type l 2> /dev/null); do f="$(echo $l | sed 's,/etc/,/etc/static/,')" + f=/etc/static/''${l#/etc/} if [ "$(readlink $l)" = "$f" -a ! -e "$(readlink -f $l)" ]; then rm "$l" fi