-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 support for opensuse #3298
base: master
Are you sure you want to change the base?
Add support for opensuse #3298
Changes from all commits
9d117d7
6c0c10f
39bbc6a
c2d64ca
85bc5e0
8a380c8
65a785e
963eb92
e664c13
dff5a88
98ab387
2c1da7d
0f8c8ca
79472fb
3cc2fc1
9d68d80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh -e | ||
# Copyright (c) 2016 The crouton Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# This is a distro-specific bootstrap script, sourced from main.sh, and as such | ||
# has access to all of the variables set by main.sh, namely $tmp (the temporary | ||
# directory), $INSTALLERDIR/$DISTRO, $RELEASE, $BOOTSTRAP_RELEASE (if different | ||
# from $RELEASE), $ARCH, and $MIRROR. | ||
|
||
# Tumbleweed | ||
url_tumbleweed_armv7hl="http://download.opensuse.org/ports/armv7hl/tumbleweed/images/openSUSE-Tumbleweed-ARM-JeOS.armv7hl-rootfs.armv7l-Current.tbz" | ||
url_tumbleweed_aarch64="http://download.opensuse.org/ports/aarch64/tumbleweed/images/openSUSE-Tumbleweed-ARM-JeOS.aarch64-rootfs.aarch64-Current.tbz" | ||
|
||
# Leap | ||
url_leap_42_2_armv7hl="http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/appliances/openSUSE-Leap42.2-ARM-JeOS.armv7-rootfs.armv7l.tbz" | ||
url_leap_42_2_aarch64="http://download.opensuse.org/ports/aarch64/distribution/leap/42.2/appliances/openSUSE-Leap42.2-ARM-JeOS.aarch64-rootfs.aarch64.tbz" | ||
url_leap_42_3_aarch64="http://download.opensuse.org/ports/aarch64/distribution/leap/42.3/appliances/openSUSE-Leap42.3-ARM-JeOS.aarch64-rootfs.aarch64.tbz" | ||
|
||
BOOTSTRAP_ARCH="$ARCH" | ||
BOOTSTRAP_RELEASE="$RELEASE" | ||
|
||
# Rename factory to tumbleweed | ||
if [ "$RELEASE" = "factory" ]; then | ||
BOOTSTRAP_RELEASE=tumbleweed | ||
elif [ "${RELEASE#leap}" != "$RELEASE" ]; then | ||
BOOTSTRAP_RELEASE=$(echo "$RELEASE" | tr - _ | tr . _) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. quoting (and line below) |
||
echo $BOOTSTRAP_RELEASE | ||
fi | ||
|
||
# fix up the good old toolchain/kernel naming conflict | ||
if [ "$ARCH" = "arm64" ]; then | ||
BOOTSTRAP_ARCH=aarch64 | ||
fi | ||
|
||
eval "URL=\"\${url_${BOOTSTRAP_RELEASE}_${BOOTSTRAP_ARCH}-}\"" | ||
|
||
if [ -z "$URL" ]; then | ||
echo "Unknown Distribution / Architecture: $BOOTSTRAP_RELEASE $BOOTSTRAP_ARCH" >&2 | ||
exit 1 | ||
fi | ||
|
||
mkdir -p "$tmp/$subdir" | ||
curl -# -L --connect-timeout 60 --retry 2 "$URL" | tar -jx -C "$tmp/$subdir" | ||
|
||
rm -rf "$tmp/$subdir/dev/"* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh -e | ||
# Copyright (c) 2016 The crouton Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# This file is sourced from main.sh to update distro-specific defaults. | ||
# It must set at least ARCH and MIRROR if not already specified. | ||
|
||
if [ -z "$ARCH" ]; then | ||
ARCH="$(uname -m)" | ||
fi | ||
|
||
case "$ARCH" in | ||
arm64 | aarch64) ARCH="arm64";; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs to be above the arm* line, otherwise arm64 won't be matched properly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch! |
||
arm*) ARCH="armv7hl";; | ||
*) error 2 "Invalid architecture '$ARCH'.";; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wait what happened to the x86 architectures There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dropped it for now, as there does no JeOS image exist, but just a installer image. That's something for the future. Creating an x86 image in the open build service and use it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. definitely need x86 support before we can merge; this would confuse most of our users |
||
esac | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/sh -e | ||
# Copyright (c) 2017 The crouton authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
USAGE="${0##*/} -a|-r /path/to/chroot | ||
|
||
Detects the release (-r) or arch (-a) of the chroot and prints it on stdout. | ||
Fails with an error code of 1 if the chroot does not belong to this distro." | ||
|
||
if [ "$#" != 2 ] || [ "$1" != '-a' -a "$1" != '-r' ]; then | ||
echo "$USAGE" 1>&2 | ||
exit 2 | ||
fi | ||
|
||
sources="${2%/}/etc/os-release" | ||
if [ ! -s "$sources" ]; then | ||
exit 1 | ||
fi | ||
|
||
# Create release name from /etc/os-release file | ||
# sed specialist can make that more elegant... | ||
rel="$(grep CPE_NAME "$sources" | cut -d ":" -f 4)" | ||
if [ "$rel" = "opensuse" -o "$rel" = "tumbleweed" ]; then | ||
rel=tumbleweed | ||
elif [ "$rel" = "leap" ]; then | ||
ver="$(grep CPE_NAME "$sources" | cut -d ":" -f 5)" | ||
rel="$rel-${ver%\"}" | ||
else | ||
exit 1 | ||
fi | ||
|
||
# Print the architecture if requested | ||
# Why use sed if you know cut... | ||
sources="${2%/}/etc/products.d/openSUSE.prod" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fail if this doesn't exist? |
||
if [ ! -s "$sources" ]; then | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" = '-a' ]; then | ||
arch="$(grep "<arch>" "$sources" | cut -d '>' -f 2 | cut -d '<' -f 1)" | ||
if [ "$arch" = "aarch64" ]; then | ||
arch="arm64" | ||
fi | ||
echo "$arch" | ||
else | ||
echo "$rel" | ||
fi | ||
|
||
exit 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/bin/sh -e | ||
# Copyright (c) 2016 The crouton Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# This is a distro-specific continuation of the prepare.sh script. | ||
|
||
PKGEXT='rpm' | ||
DISTROAKA='opensuse' | ||
|
||
|
||
# install_dist: see install() in prepare.sh for details. | ||
install_dist() { | ||
local pkgs='' params='' asdeps='' | ||
while [ "$#" != 0 ]; do | ||
if [ "$1" = "--minimal" ]; then | ||
params='--no-recommends' | ||
elif [ "$1" = "--asdeps" ]; then | ||
shift | ||
continue | ||
else | ||
break | ||
fi | ||
shift | ||
done | ||
while [ "$#" != 0 ]; do | ||
if [ "$1" = '--' ]; then | ||
shift | ||
break | ||
fi | ||
pkgs="$pkgs $1" | ||
shift | ||
done | ||
zypper -q install -y $params $pkgs $(list_uninstalled_dist - "$@") || return $? | ||
} | ||
|
||
|
||
# install_pkg_dist: see install_pkg() in prepare.sh for details. | ||
install_pkg_dist() { | ||
local params='' | ||
if [ "$1" = '--minimal' ]; then | ||
params='--no-recommends' | ||
shift | ||
fi | ||
if [ "$#" != 0 ]; then | ||
zypper -q install -y $params "$@" || return $? | ||
fi | ||
} | ||
|
||
|
||
# install_dummy_dist: see install_dummy() in prepare.sh for details. | ||
install_dummy_dist() { | ||
if [ "$#" = 0 ]; then | ||
return | ||
fi | ||
local pkgname="crouton-$1" pkgprovides="$1" requires="" | ||
shift | ||
while [ "$#" != 0 ]; do | ||
if [ "$1" = '--' ]; then | ||
shift | ||
break | ||
fi | ||
pkgprovides="$pkgprovides, $1" | ||
shift | ||
done | ||
local pkgdepends="$1" | ||
if [ "$#" != 0 ]; then | ||
shift | ||
while [ "$#" != 0 ]; do | ||
pkgdepends="$pkgdepends, $1" | ||
shift | ||
done | ||
fi | ||
|
||
if [ -n "$pkgdepends" ]; then | ||
requires="Requires: ${pkgdepends}" | ||
fi | ||
|
||
local tmp="$(mktemp -d crouton.XXXXXX --tmpdir=/tmp)" | ||
addtrap "rm -rf '$tmp'" | ||
cat > "$tmp/dummy.spec" <<EOF | ||
Name: $pkgname | ||
Version: 1.0.0 | ||
Release: 1.0.0 | ||
Group: dummy | ||
Vendor: dummy | ||
License: %{vendor} | ||
Provides: $pkgprovides | ||
$requires | ||
Summary: Provides a dummy ${pkgname#*-} for crouton | ||
BuildRoot: %{_tmppath}/%{name}-%{version}-build | ||
|
||
%description | ||
%{summary} | ||
|
||
%files | ||
EOF | ||
rpmbuild --define='_rpmdir "$tmp"' -bb "$tmp/dummy.spec" > "$tmp/build.log" | ||
if [ $? != 0 ]; then | ||
echo "ERROR: Could not build dummy rpm!" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non-fatal? |
||
exit 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spaces, not tabs |
||
fi | ||
pkg="$(awk '/^wrote:/ { print $2 }' < "$tmp/build.log")" | ||
rm "$tmp/build.log" | ||
zypper -q install -y --force-resolution "$pkg" | ||
} | ||
|
||
|
||
# remove_dist: see remove() in prepare.sh for details. | ||
remove_dist() { | ||
zypper -q remove --clean-deps -y "$@" | ||
} | ||
|
||
|
||
# list_uninstalled_dist: see list_uninstalled() in prepare.sh for details. | ||
list_uninstalled_dist() { | ||
local suffix="$1" pkg | ||
shift | ||
for pkg in "$@"; do | ||
if ! zypper se -i "$pkg" 2>/dev/null | grep -q '^i'; then | ||
echo -n "$pkg$suffix " | ||
fi | ||
done | ||
} | ||
|
||
# enable network ping for all users | ||
chmod u+s /usr/bin/ping | ||
|
||
# add rpmbuild for dummy packages | ||
install rpmbuild |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tumbleweed | ||
leap-42.2 | ||
leap-42.3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and we don't want just a "leap" release that grabs the latest version, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, these are independent releases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how did you decide on these URLs? The sizes are dramatically different (the X11 ones are 800 megs!). There're also distribution/openSUSE-current/appliances/ and distribution/openSUSE-stable/appliances/ directories with similar images.
There are unversioned entries in the leap subdirectory. Are those always updated? Are we going to have to keep updating the tarball in this file if we specify a version?
And what happens on i386/x86_64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JeOS images are minimal images (Just Enough Operating System). For armv7hl no plain JeOS image exists. I'm investigating this. Maybe we can just delete the armv7hl support for Leap42.2 and add it in a later patch.
Leap images don't get updated, they get released and that's it. The unversioned images are links to the versioned ones. I'll update the links, as the version is of no use.
We should try to add a automatic resolution of architecutre + os-version -> download link, but I would prefer to leave this for a latter patch, e.g. when adding Leap-42.3 support. TBH I'm not too confident that this will work out, as the folder structure of the download server might change for newer releases.
i386/x86_64 images don't exists at this point in time, only the installer ISO is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so as we can't support i386 right now, I will delete the architecutre from installer/opensuse/defaults as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, armv7hl JeOS image got created now, I will fix the URL.