Make pushing optional
This commit is contained in:
+7
-2
@@ -20,7 +20,10 @@ in writeShellApplication {
|
|||||||
packer
|
packer
|
||||||
];
|
];
|
||||||
text = ''
|
text = ''
|
||||||
mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET"
|
push="''${1:-yes}"
|
||||||
|
if [ "$push" == "yes" ]; then
|
||||||
|
mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET"
|
||||||
|
fi
|
||||||
mkdir -p cache
|
mkdir -p cache
|
||||||
'' + (concatStringsSep "\n" (
|
'' + (concatStringsSep "\n" (
|
||||||
map (d: ''
|
map (d: ''
|
||||||
@@ -29,7 +32,9 @@ in writeShellApplication {
|
|||||||
# shellcheck disable=SC2143
|
# shellcheck disable=SC2143
|
||||||
if [ -z "$(mc ls storage/isos/cache/ | grep "$sha")" ]; then
|
if [ -z "$(mc ls storage/isos/cache/ | grep "$sha")" ]; then
|
||||||
curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url"
|
curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url"
|
||||||
mc put "cache/$sha.iso" "storage/isos/cache/$sha.iso"
|
if [ "$push" == "yes" ]; then
|
||||||
|
mc put "cache/$sha.iso" "storage/isos/cache/$sha.iso"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Skipping ${d.distro} - cache/$sha.iso"
|
echo "Skipping ${d.distro} - cache/$sha.iso"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user