mirror of
https://github.com/ryantm/agenix.git
synced 2024-12-22 15:48:30 +03:00
fix: fix _agenix_generation being empty if readlink fails
This commit is contained in:
parent
f6291c5935
commit
2e80d9ddd1
2 changed files with 4 additions and 4 deletions
|
@ -11,7 +11,7 @@ with lib; let
|
||||||
ageBin = lib.getExe config.age.package;
|
ageBin = lib.getExe config.age.package;
|
||||||
|
|
||||||
newGeneration = ''
|
newGeneration = ''
|
||||||
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}")" || echo 0)"
|
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")"
|
||||||
(( ++_agenix_generation ))
|
(( ++_agenix_generation ))
|
||||||
echo "[agenix] creating new generation in ${cfg.secretsMountPoint}/$_agenix_generation"
|
echo "[agenix] creating new generation in ${cfg.secretsMountPoint}/$_agenix_generation"
|
||||||
mkdir -p "${cfg.secretsMountPoint}"
|
mkdir -p "${cfg.secretsMountPoint}"
|
||||||
|
@ -73,7 +73,7 @@ with lib; let
|
||||||
cfg.identityPaths;
|
cfg.identityPaths;
|
||||||
|
|
||||||
cleanupAndLink = ''
|
cleanupAndLink = ''
|
||||||
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}")" || echo 0)"
|
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")"
|
||||||
(( ++_agenix_generation ))
|
(( ++_agenix_generation ))
|
||||||
echo "[agenix] symlinking new secrets to ${cfg.secretsDir} (generation $_agenix_generation)..."
|
echo "[agenix] symlinking new secrets to ${cfg.secretsDir} (generation $_agenix_generation)..."
|
||||||
ln -sfT "${cfg.secretsMountPoint}/$_agenix_generation" "${cfg.secretsDir}"
|
ln -sfT "${cfg.secretsMountPoint}/$_agenix_generation" "${cfg.secretsDir}"
|
||||||
|
|
|
@ -29,7 +29,7 @@ with lib; let
|
||||||
mount -t ramfs none "${cfg.secretsMountPoint}" -o nodev,nosuid,mode=0751
|
mount -t ramfs none "${cfg.secretsMountPoint}" -o nodev,nosuid,mode=0751
|
||||||
'';
|
'';
|
||||||
newGeneration = ''
|
newGeneration = ''
|
||||||
_agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)"
|
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")"
|
||||||
(( ++_agenix_generation ))
|
(( ++_agenix_generation ))
|
||||||
echo "[agenix] creating new generation in ${cfg.secretsMountPoint}/$_agenix_generation"
|
echo "[agenix] creating new generation in ${cfg.secretsMountPoint}/$_agenix_generation"
|
||||||
mkdir -p "${cfg.secretsMountPoint}"
|
mkdir -p "${cfg.secretsMountPoint}"
|
||||||
|
@ -100,7 +100,7 @@ with lib; let
|
||||||
cfg.identityPaths;
|
cfg.identityPaths;
|
||||||
|
|
||||||
cleanupAndLink = ''
|
cleanupAndLink = ''
|
||||||
_agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)"
|
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")"
|
||||||
(( ++_agenix_generation ))
|
(( ++_agenix_generation ))
|
||||||
echo "[agenix] symlinking new secrets to ${cfg.secretsDir} (generation $_agenix_generation)..."
|
echo "[agenix] symlinking new secrets to ${cfg.secretsDir} (generation $_agenix_generation)..."
|
||||||
ln -sfT "${cfg.secretsMountPoint}/$_agenix_generation" ${cfg.secretsDir}
|
ln -sfT "${cfg.secretsMountPoint}/$_agenix_generation" ${cfg.secretsDir}
|
||||||
|
|
Loading…
Reference in a new issue