···1919 # Add the closures of the top-level store objects.
2020 storePaths=$(perl ${pathsFromGraph} closure-*)
21212222+ # If a Hydra slave happens to have store paths with bad permissions/mtime,
2323+ # abort now so that they don't end up in ISO images in the channel.
2424+ # https://github.com/NixOS/nixpkgs/issues/32242
2525+ hasBadPaths=""
2626+ for path in $storePaths; do
2727+ if [ -h "$path" ]; then
2828+ continue
2929+ fi
3030+3131+ mtime=$(stat -c %Y "$path")
3232+ mode=$(stat -c %a "$path")
3333+3434+ if [ "$mtime" != 1 ]; then
3535+ echo "Store path '$path' has an invalid mtime."
3636+ hasBadPaths=1
3737+ fi
3838+ if [ "$mode" != 444 ] && [ "$mode" != 555 ]; then
3939+ echo "Store path '$path' has invalid permissions."
4040+ hasBadPaths=1
4141+ fi
4242+ done
4343+4444+ if [ -n "$hasBadPaths" ]; then
4545+ echo "You have bad paths in your store, please fix them."
4646+ exit 1
4747+ fi
4848+2249 # Also include a manifest of the closures in a format suitable
2350 # for nix-store --load-db.
2451 printRegistration=1 perl ${pathsFromGraph} closure-* > nix-path-registration