Unverified Commit d8d66448 authored by Sefa Eyeoglu's avatar Sefa Eyeoglu Committed by GitHub
Browse files

nixos/paperless: fix shellcheck findings with enableStrictShellChecks enabled (#349559)

parents d7216383 c4a7c0fa
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -290,11 +290,12 @@ in
      ''
      + optionalString (cfg.passwordFile != null) ''
        export PAPERLESS_ADMIN_USER="''${PAPERLESS_ADMIN_USER:-admin}"
        export PAPERLESS_ADMIN_PASSWORD=$(cat $CREDENTIALS_DIRECTORY/PAPERLESS_ADMIN_PASSWORD)
        PAPERLESS_ADMIN_PASSWORD=$(cat "$CREDENTIALS_DIRECTORY/PAPERLESS_ADMIN_PASSWORD")
        export PAPERLESS_ADMIN_PASSWORD
        superuserState="$PAPERLESS_ADMIN_USER:$PAPERLESS_ADMIN_PASSWORD"
        superuserStateFile="${cfg.dataDir}/superuser-state"

        if [[ $(cat "$superuserStateFile" 2>/dev/null) != $superuserState ]]; then
        if [[ $(cat "$superuserStateFile" 2>/dev/null) != "$superuserState" ]]; then
          ${cfg.package}/bin/paperless-ngx manage_superuser
          echo "$superuserState" > "$superuserStateFile"
        fi
@@ -353,7 +354,8 @@ in
            tr -dc A-Za-z0-9 < /dev/urandom | head -c64 | ${pkgs.moreutils}/bin/sponge '${secretKeyFile}'
          )
        fi
        export PAPERLESS_SECRET_KEY=$(cat '${secretKeyFile}')
        PAPERLESS_SECRET_KEY="$(cat '${secretKeyFile}')"
        export PAPERLESS_SECRET_KEY
        if [[ ! $PAPERLESS_SECRET_KEY ]]; then
          echo "PAPERLESS_SECRET_KEY is empty, refusing to start."
          exit 1