Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get-fedora-coreos script to download files #763

Merged
merged 1 commit into from
Oct 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions scripts/get-fedora-coreos
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# USAGE: ./scripts/get-fedora-coreos
# USAGE: ./scripts/get-fedora-coreos stream version dest
#
set -eou pipefail

STREAM=${1:-"testing"}
VERSION=${2:-"30.20191002.0"}
DEST_DIR=${3:-"$PWD/examples/assets"}
DEST=$DEST_DIR/fedora-coreos
BASE_URL=https://builds.coreos.fedoraproject.org/prod/streams/$STREAM/builds/$VERSION/x86_64

# check stream/version exist based on the header response
if ! curl -s -I $BASE_URL/fedora-coreos-$VERSION-metal.x86_64.raw.xz | grep -q -E '^HTTP/[0-9.]+ [23][0-9][0-9]' ; then
echo "Stream or Version not found"
exit 1
fi

if [ ! -d "$DEST" ]; then
echo "Creating directory $DEST"
mkdir -p $DEST
fi

echo "Downloading Fedora CoreOS $STREAM $VERSION images to $DEST"

# PXE kernel
echo "fedora-coreos-$VERSION-installer-kernel-x86_64"
curl -# $BASE_URL/fedora-coreos-$VERSION-installer-kernel-x86_64 -o $DEST/fedora-coreos-$VERSION-installer-kernel-x86_64

# PXE initrd
echo "fedora-coreos-$VERSION-installer-initramfs.x86_64.img"
curl -# $BASE_URL/fedora-coreos-$VERSION-installer-initramfs.x86_64.img -o $DEST/fedora-coreos-$VERSION-installer-initramfs.x86_64.img

# Install image
echo "fedora-coreos-$VERSION-metal.x86_64.raw.xz"
curl -# $BASE_URL/fedora-coreos-$VERSION-metal.x86_64.raw.xz -o $DEST/fedora-coreos-$VERSION-metal.x86_64.raw.xz