diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..849c204 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +fs-base +fs-maipo +fs-ootpa diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..17822b3 --- /dev/null +++ b/Makefile @@ -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: diff --git a/build-base.sh b/build-base.sh new file mode 100755 index 0000000..07cb09c --- /dev/null +++ b/build-base.sh @@ -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 <> 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 diff --git a/build-maipo.sh b/build-maipo.sh new file mode 100755 index 0000000..a7916c7 --- /dev/null +++ b/build-maipo.sh @@ -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,} diff --git a/build-ootpa.sh b/build-ootpa.sh new file mode 100755 index 0000000..c88c42b --- /dev/null +++ b/build-ootpa.sh @@ -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,} diff --git a/redhat-release-coreos-maipo.spec b/redhat-release-coreos-maipo.spec new file mode 100644 index 0000000..413b158 --- /dev/null +++ b/redhat-release-coreos-maipo.spec @@ -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 + +%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 diff --git a/redhat-release-coreos-ootpa.spec b/redhat-release-coreos-ootpa.spec new file mode 100644 index 0000000..b4511db --- /dev/null +++ b/redhat-release-coreos-ootpa.spec @@ -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 diff --git a/redhat-release-coreos.spec b/redhat-release-coreos.spec deleted file mode 100644 index 4c071c6..0000000 --- a/redhat-release-coreos.spec +++ /dev/null @@ -1,168 +0,0 @@ -# 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} -%define product_family Red Hat -%define variant_titlecase CoreOS -%define variant_lowercase coreos -%define release_pkg_version 20180515.0 -%define base_release_version 7 -%define full_release_version 4.0 -%define dist_release_version 7 -# 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 beta %{nil} -%define dist .el%{dist_release_version} - -Name: redhat-release%{?variant_lowercase:-%{variant_lowercase}} -Version: %{full_release_version} -Release: %{release_pkg_version}.atomic%{?dist}.0 -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 -%{product_family}%{?variant_titlecase: %{variant_titlecase}} release files - -%prep -%setup -q -n redhat-release-%{base_release_version} - -%build -echo OK - -%install -rm -rf %{buildroot} - -# create /etc -mkdir -p %{buildroot}/etc -mkdir -p %{buildroot}/usr/lib/ - -mkdir -p %{buildroot}/etc/pki/product - -# create /etc/system-release and /etc/redhat-release -echo "%{product_family}%{?variant_titlecase: %{variant_titlecase}} release %{full_release_version}%{?beta: %{beta}}" > %{buildroot}/usr/lib/redhat-release -ln -s ../usr/lib/redhat-release %{buildroot}/etc/system-release -ln -s ../usr/lib/redhat-release %{buildroot}/etc/redhat-release - -# create /etc/os-release -cat << EOF >>%{buildroot}/usr/lib/os-release -NAME="%{product_family}%{?variant_titlecase: %{variant_titlecase}}" -VERSION="%{full_release_version}" -ID="rhcos" -ID_LIKE="rhel fedora" -VERSION_ID="%{full_release_version}" -PRETTY_NAME="%{product_family}%{?variant_titlecase: %{variant_titlecase}} %{full_release_version}" -ANSI_COLOR="0;31" -HOME_URL="https://www.redhat.com/" -BUG_REPORT_URL="https://bugzilla.redhat.com/" - -REDHAT_BUGZILLA_PRODUCT="%{product_family} %{base_release_version}" -REDHAT_BUGZILLA_PRODUCT_VERSION="%{full_release_version}" -REDHAT_SUPPORT_PRODUCT="%{product_family}" -REDHAT_SUPPORT_PRODUCT_VERSION="%{full_release_version}" -EOF -ln -s ../usr/lib/os-release %{buildroot}/etc/os-release -# write cpe to /etc/system/release-cpe -echo "cpe:/o:redhat:enterprise_linux:%{full_release_version}:%{?beta:beta}%{!?beta:GA}%{?variant_lowercase::%{variant_lowercase}}" | tr [A-Z] [a-z] > %{buildroot}/usr/lib/system-release-cpe -ln -s ../usr/lib/system-release-cpe %{buildroot}/etc/system-release-cpe - -# create /etc/issue and /etc/issue.net -echo '\S' > %{buildroot}/etc/issue -echo 'Kernel \r on an \m' >> %{buildroot}/etc/issue -cp %{buildroot}/etc/issue %{buildroot}/etc/issue.net -echo >> %{buildroot}/etc/issue - -# combine GPG keys -cat RPM-GPG-KEY-redhat-release-2 RPM-GPG-KEY-redhat-auxiliary > RPM-GPG-KEY-redhat-release -rm RPM-GPG-KEY-redhat-release-2 RPM-GPG-KEY-redhat-auxiliary -cat RPM-GPG-KEY-redhat-beta-2 RPM-GPG-KEY-redhat-legacy-beta > RPM-GPG-KEY-redhat-beta -rm RPM-GPG-KEY-redhat-beta-2 RPM-GPG-KEY-redhat-legacy-beta - -# copy GPG keys -mkdir -p -m 755 %{buildroot}/etc/pki/rpm-gpg -mkdir -p -m 755 %{buildroot}/%{_datadir}/ostree/trusted.gpg.d -for file in RPM-GPG-KEY* ; do - install -m 644 $file %{buildroot}/etc/pki/rpm-gpg - gpg --dearmor < $file > %{buildroot}/%{_datadir}/ostree/trusted.gpg.d/$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 %{buildroot}/etc/profile.d -cat > %{buildroot}/etc/profile.d/path.sh <> %{buildroot}/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 %{buildroot}/%{_datadir}/redhat-release -install -m 644 EULA %{buildroot}/%{_datadir}/redhat-release - -# use unbranded docdir -mkdir -p -m 755 %{buildroot}/%{_docdir}/redhat-release -install -m 644 GPL %{buildroot}/%{_docdir}/redhat-release - -# copy systemd presets -mkdir -p %{buildroot}/%{_prefix}/lib/systemd/system-preset/ -for x in *.preset; do install -m 0644 ${x} %{buildroot}/%{_prefix}/lib/systemd/system-preset/; done - -# copy systemd units -mkdir -p %{buildroot}/%{_prefix}/lib/systemd/system/ -for x in *.service; do install -m 0644 ${x} %{buildroot}/%{_prefix}/lib/systemd/system/; done - -# let systemd handle core dumps -# https://bugzilla.redhat.com/show_bug.cgi?id=1191045 -mkdir -p %{buildroot}%{_prefix}/lib/sysctl.d/ -install -m 0644 49-coredump.conf %{buildroot}%{_prefix}/lib/sysctl.d/ - -# https://bugzilla.redhat.com/show_bug.cgi?id=1204194 -mkdir -p %{buildroot}/etc/systemd/system -ln -s /dev/null %{buildroot}/etc/systemd/system/brandbot.path - -%clean -rm -rf %{buildroot} - -%files -%defattr(0644,root,root,0755) -/etc/redhat-release -/etc/system-release -%{_prefix}/lib/os-release -%{_prefix}/lib/redhat-release -%{_prefix}/lib/system-release-cpe -%config /etc/os-release -%config /etc/system-release-cpe -%config(noreplace) /etc/issue -%config(noreplace) /etc/issue.net -%config(noreplace) /etc/systemd/system/brandbot.path -%config(noreplace) /etc/profile.d/path.sh -/etc/pki/rpm-gpg/ -%{_datadir}/ostree/trusted.gpg.d/*.gpg -/etc/rpm/macros.dist -%{_docdir}/redhat-release/* -%{_datadir}/redhat-release/* -%{_prefix}/lib/systemd/system/*.service -%{_prefix}/lib/systemd/system-preset/* -%{_prefix}/lib/sysctl.d/*