mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
nixos/zerotierone: clean up local.conf symlinks unconditionally
This commit is contained in:
parent
0e4209dd43
commit
f09ab69a7e
@ -60,14 +60,16 @@ in
|
||||
mkdir -p /var/lib/zerotier-one/networks.d
|
||||
chmod 700 /var/lib/zerotier-one
|
||||
chown -R root:root /var/lib/zerotier-one
|
||||
|
||||
# cleans up old symlinks also if we unset localConf
|
||||
if [[ -L "${localConfFilePath}" && "$(readlink "${localConfFilePath}")" =~ ^${builtins.storeDir}.* ]]; then
|
||||
rm ${localConfFilePath}
|
||||
fi
|
||||
'' + (concatMapStrings (netId: ''
|
||||
touch "/var/lib/zerotier-one/networks.d/${netId}.conf"
|
||||
'') cfg.joinNetworks) + optionalString (cfg.localConf != {}) ''
|
||||
if [ -L "${localConfFilePath}" ]
|
||||
then
|
||||
rm ${localConfFilePath}
|
||||
elif [ -f "${localConfFilePath}" ]
|
||||
then
|
||||
'') cfg.joinNetworks) + lib.optionalString (cfg.localConf != {}) ''
|
||||
# in case the user has applied manual changes to the local.conf, we backup the file
|
||||
if [ -f "${localConfFilePath}" ]; then
|
||||
mv ${localConfFilePath} ${localConfFilePath}.bak
|
||||
fi
|
||||
ln -s ${localConfFile} ${localConfFilePath}
|
||||
|
Loading…
Reference in New Issue
Block a user