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

updated to fedora-29 #3607

Merged
merged 2 commits into from
Jan 30, 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
# https://github.com/coreos/toolbox

set -e
set -o pipefail
Expand All @@ -8,12 +7,12 @@ machine=$(uname -m)

case ${machine} in
aarch64 )
TOOLBOX_NAME=fedora-base-24-1.1.aarch64
TOOLBOX_DOCKER_ARCHIVE="https://dl.fedoraproject.org/pub/fedora-secondary/releases/24/Docker/aarch64/images/Fedora-Docker-Base-24-1.1.aarch64.tar.xz"
TOOLBOX_DOCKER_IMAGE=arm64v8/fedora
TOOLBOX_DOCKER_TAG=29
;;
x86_64 )
TOOLBOX_DOCKER_IMAGE=fedora
TOOLBOX_DOCKER_TAG=24
TOOLBOX_DOCKER_TAG=29
;;
* )
echo "Warning: Unknown machine type ${machine}" >&2
Expand Down Expand Up @@ -51,24 +50,21 @@ if [ ! -f "${osrelease}" ] || systemctl is-failed -q "${machinename}" ; then
sudo chown "${USER}:" "${machinepath}"

if [[ -n "${have_docker_image}" ]]; then
riid=$(sudo rkt --insecure-options=image fetch "docker://${TOOLBOX_DOCKER_IMAGE}:${TOOLBOX_DOCKER_TAG}")
sudo rkt image extract --overwrite --rootfs-only "${riid}" "${machinepath}"
sudo rkt image rm "${riid}"
elif [[ -n "${TOOLBOX_DOCKER_ARCHIVE}" ]]; then
tmpdir=$(mktemp -d -p /var/tmp/)
trap "sudo rm -rf ${tmpdir}" EXIT PIPE
wget -O- "${TOOLBOX_DOCKER_ARCHIVE}" | xz -cd | tar -C ${tmpdir} -xf -
layer=$(find ${tmpdir} -name layer.tar -type f)
sudo tar -C ${machinepath} -xf ${layer}
trap - EXIT PIPE
sudo rm -rf ${tmpdir}
riid=$(sudo --preserve-env rkt --insecure-options=image fetch "docker://${TOOLBOX_DOCKER_IMAGE}:${TOOLBOX_DOCKER_TAG}")
sudo --preserve-env rkt image extract --overwrite --rootfs-only "${riid}" "${machinepath}"
sudo --preserve-env rkt image rm "${riid}"
else
echo "Error: No toolbox filesystem specified." >&2
exit 1
fi
sudo touch "${osrelease}"
fi

# Special case for when SSH tries to pass a shell command with -c
if [ "x${1-}" == x-c ]; then
set /bin/sh "$@"
fi

sudo systemd-nspawn \
--directory="${machinepath}" \
--capability=all \
Expand Down