Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

WIP: Split into subpackages #12

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fs-base
fs-maipo
fs-ootpa
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
all: fs-maipo fs-ootpa

fs-base:
./build-base.sh

fs-maipo: fs-base
./build-maipo.sh

fs-ootpa: fs-base
./build-ootpa.sh

clean:
rm fs-{base,maipo,ootpa} -rf

install:
84 changes: 84 additions & 0 deletions build-base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/bash
set -xeuo pipefail
srcdir=$(cd $(dirname $0) && pwd)
rm fs-base fs-base.tmp -rf
mkdir -p fs-base.tmp
cd fs-base.tmp

base_release_version=7

mkdir -m 0755 -p usr/lib
# create os-release
cat << EOF >> usr/lib/os-release
ID="rhcos"
ID_LIKE="rhel fedora"
ANSI_COLOR="0;31"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
EOF
mkdir -m 0755 -p etc
ln -s ../usr/lib/os-release etc/os-release

# create /etc/issue and /etc/issue.net
cat > usr/lib/issue <<'EOF'
\S \S{VERSION_ID}
EOF
ln -sr usr/lib/issue etc/issue
ln -sr usr/lib/issue etc/issue.net

# combine GPG keys
mkdir -p -m 755 etc/pki/rpm-gpg
cat ${srcdir}/RPM-GPG-KEY-redhat-release-2 ${srcdir}/RPM-GPG-KEY-redhat-auxiliary > etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
cat ${srcdir}/RPM-GPG-KEY-redhat-beta-2 ${srcdir}/RPM-GPG-KEY-redhat-legacy-beta > etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta

# copy GPG keys into the libostree keyring
mkdir -p -m 755 usr/share/ostree/trusted.gpg.d
for file in etc/pki/rpm-gpg/RPM-GPG-KEY* ; do
gpg --dearmor < $file > usr/share/ostree/trusted.gpg.d/$(basename ${file}).gpg
done

# setup default PATH; pathmunge() will add the supplied value to the PATH
# if it does not already exist
# https://github.com/openshift/os/issues/191
mkdir -p -m 755 etc/profile.d
cat > etc/profile.d/path.sh <<EOF
pathmunge /bin
pathmunge /sbin
pathmunge /usr/bin
pathmunge /usr/sbin
pathmunge /usr/local/bin
pathmunge /usr/local/sbin
EOF

# set up the dist tag macros
install -d -m 755 etc/rpm
cat >> etc/rpm/macros.dist << EOF
# dist macros.

%%rhel ${base_release_version}
%%dist %dist
%%el${base_release_version} 1
EOF

# use unbranded datadir
mkdir -p -m 755 usr/share/redhat-release
install -m 644 ${srcdir}/EULA usr/share/redhat-release

# use unbranded docdir
mkdir -p -m 755 usr/share/doc/redhat-release
install -m 644 ${srcdir}/GPL usr/share/doc/redhat-release

# copy systemd presets
mkdir -p usr/lib/systemd/system-preset/
for x in ${srcdir}/*.preset; do install -m 0644 ${x} usr/lib/systemd/system-preset/; done

# copy systemd units
mkdir -p usr/lib/systemd/system/
for x in ${srcdir}/*.service; do install -m 0644 ${x} usr/lib/systemd/system/; done

# https://bugzilla.redhat.com/show_bug.cgi?id=1204194
mkdir -p etc/systemd/system
ln -s /dev/null etc/systemd/system/brandbot.path

cd ..
mv fs-base.tmp fs-base
20 changes: 20 additions & 0 deletions build-maipo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/bash
set -xeuo pipefail
srcdir=$(cd $(dirname $0) && pwd)
rm fs-maipo{,.tmp} -rf
cp -a --reflink=auto fs-base fs-maipo.tmp
cd fs-maipo.tmp

# create os-release
cat << EOF >> usr/lib/os-release
NAME="Red Hat CoreOS (Maipo)"
VERSION_ID="47"
EOF

# let systemd handle core dumps on maipo
# https://bugzilla.redhat.com/show_bug.cgi?id=1191045
mkdir -p usr/lib/sysctl.d/
install -m 0644 ${srcdir}/49-coredump.conf usr/lib/sysctl.d/

cd ..
mv fs-maipo{.tmp,}
15 changes: 15 additions & 0 deletions build-ootpa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/bash
set -xeuo pipefail
srcdir=$(cd $(dirname $0) && pwd)
rm fs-ootpa{,.tmp} -rf
cp -a --reflink=auto fs-base fs-ootpa.tmp
cd fs-ootpa.tmp

# create os-release
cat << EOF >> usr/lib/os-release
NAME="Red Hat CoreOS (Ootpa)"
VERSION_ID="48"
EOF

cd ..
mv fs-ootpa{.tmp,}
39 changes: 39 additions & 0 deletions redhat-release-coreos-maipo.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This package was forked from fedora-release into redhat-release-server into
# redhat-release-atomic-host, then into redhat-release-coreos.
# Be sure to look at changes upstream!

%define debug_package %{nil}
# Fake this out; we need at least 7, since e.g. systemd has a dependency
# on system-release > 7.2, etc.
%define os_version 7.99
%define dist .el%{version}

Name: redhat-release-coreos-maipo
Version: 47
Release: 0%{?dist}
Summary: %{product_family}%{?variant_titlecase: %{variant_titlecase}} release file
Group: System Environment/Base
License: GPLv2
Provides: redhat-release = %{os_version}-%{release}
Provides: system-release = %{os_version}-%{release}
# We need to use Server, since there's no RPM content set for anything else
Provides: system-release(releasever) = %{base_release_version}Server
# This doesn't exist today, I committed the data to git
Source0: redhat-release-%{variant_lowercase}-%{base_release_version}-4.tar.gz

%description
%{summary}

%prep
%setup -q -n redhat-release-%{base_release_version}

%build
make fs-maipo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heck, we could collapse this into a single spec and just use the %rhel macro from our buildroot, right?


%install
rm -rf %{buildroot}
cp -a --reflink=auto fs-maipo %{buildroot}

(cd %{buildroot} && find . -maxdepth 1 -type d | sed -e 's,^.,/,') > files.list

%files -f files.list
38 changes: 38 additions & 0 deletions redhat-release-coreos-ootpa.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This package was forked from fedora-release into redhat-release-server into
# redhat-release-atomic-host, then into redhat-release-coreos.
# Be sure to look at changes upstream!

%define debug_package %{nil}
# Fake this out; we also use 8 here, matching the maipo's use of 7.
%define os_version 8.99
%define dist .el%{version}

Name: redhat-release-coreos-ootpa
Version: 48
Release: 0%{?dist}
Summary: %{product_family}%{?variant_titlecase: %{variant_titlecase}} release file
Group: System Environment/Base
License: GPLv2
Provides: redhat-release = %{os_version}-%{release}
Provides: system-release = %{os_version}-%{release}
# We need to use Server, since there's no RPM content set for anything else
Provides: system-release(releasever) = %{base_release_version}Server
# This doesn't exist today, I committed the data to git
Source0: redhat-release-%{variant_lowercase}-%{base_release_version}-4.tar.gz

%description
%{summary}

%prep
%setup -q -n redhat-release-%{base_release_version}

%build
make fs-ootpa

%install
rm -rf %{buildroot}
cp -a --reflink=auto fs-ootpa %{buildroot}

(cd %{buildroot} && find . -maxdepth 1 -type d | sed -e 's,^.,/,') > files.list

%files -f files.list
168 changes: 0 additions & 168 deletions redhat-release-coreos.spec

This file was deleted.