Skip to content

Commit

Permalink
fix: fix _agenix_generation being empty if readlink fails
Browse files Browse the repository at this point in the history
  • Loading branch information
teatwig committed Sep 10, 2024
1 parent f6291c5 commit 370c98a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/age.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ with lib; let
mount -t ramfs none "${cfg.secretsMountPoint}" -o nodev,nosuid,mode=0751
'';
newGeneration = ''
_agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)"
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")"
(( ++_agenix_generation ))
echo "[agenix] creating new generation in ${cfg.secretsMountPoint}/$_agenix_generation"
mkdir -p "${cfg.secretsMountPoint}"
Expand Down Expand Up @@ -100,7 +100,7 @@ with lib; let
cfg.identityPaths;

cleanupAndLink = ''
_agenix_generation="$(basename "$(readlink ${cfg.secretsDir})" || echo 0)"
_agenix_generation="$(basename "$(readlink "${cfg.secretsDir}" || echo 0)")"
(( ++_agenix_generation ))
echo "[agenix] symlinking new secrets to ${cfg.secretsDir} (generation $_agenix_generation)..."
ln -sfT "${cfg.secretsMountPoint}/$_agenix_generation" ${cfg.secretsDir}
Expand Down

0 comments on commit 370c98a

Please sign in to comment.