2018-02-28 20:02:36 +01:00
|
|
|
#
|
|
|
|
# spec file for package read-only-root-fs
|
|
|
|
#
|
2024-02-28 16:15:47 +01:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2018-02-28 20:02:36 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2019-08-28 16:02:07 +02:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2018-02-28 20:02:36 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
Name: read-only-root-fs
|
2024-02-28 16:16:04 +01:00
|
|
|
Version: 1.0+git20240228.d85232a
|
2018-02-28 20:02:36 +01:00
|
|
|
Release: 0
|
|
|
|
Summary: Files and Scripts for a RO root fileystem
|
|
|
|
License: GPL-2.0-or-later
|
|
|
|
Group: System/Fhs
|
2019-11-18 19:57:12 +01:00
|
|
|
URL: https://github.com/openSUSE/read-only-root-fs
|
2018-02-28 20:02:36 +01:00
|
|
|
Source: read-only-root-fs-%{version}.tar.xz
|
|
|
|
Source1: README.packaging.txt
|
2018-04-16 12:52:54 +02:00
|
|
|
BuildRequires: dracut
|
2019-08-28 16:02:07 +02:00
|
|
|
BuildRequires: update-bootloader-rpm-macros
|
2018-04-16 12:52:54 +02:00
|
|
|
Requires: dracut
|
2020-07-26 16:16:46 +02:00
|
|
|
Requires(post): /usr/bin/mkdir /usr/bin/cat /usr/bin/sed
|
2019-02-13 09:57:35 +01:00
|
|
|
Requires(post): gawk
|
2019-08-28 16:02:07 +02:00
|
|
|
Requires(post): snapper
|
2019-02-13 09:57:35 +01:00
|
|
|
# Required if system with new /etc/fstab entries is supposed to be updated
|
2019-08-28 16:02:07 +02:00
|
|
|
Conflicts: transactional-update < 2.15
|
2018-02-28 20:02:36 +01:00
|
|
|
BuildArch: noarch
|
2019-08-28 16:02:07 +02:00
|
|
|
%{update_bootloader_requires}
|
2018-02-28 20:02:36 +01:00
|
|
|
|
|
|
|
%description
|
|
|
|
Files, scripts and directories to run the system with a
|
|
|
|
read-only root filesystem with %{_sysconfdir} writeable via overlayfs.
|
|
|
|
|
2018-03-28 10:28:41 +02:00
|
|
|
This package should never be installed in an already running
|
|
|
|
system! It should only be selected by a system role for a
|
|
|
|
read-only root filesystem with transactional updates.
|
2019-02-13 09:57:35 +01:00
|
|
|
The package will create / modify entries for mounting /etc and /var.
|
|
|
|
Those entries are used by dracut to mount the overlay file systems
|
|
|
|
during the early boot phase.
|
2018-03-28 10:28:41 +02:00
|
|
|
|
2018-04-16 12:52:54 +02:00
|
|
|
%package volatile
|
|
|
|
Summary: Dracut Module to mount a tmpfs overlay on a RO root
|
|
|
|
Group: System/Fhs
|
|
|
|
Requires: dracut
|
|
|
|
|
|
|
|
%description volatile
|
|
|
|
A dracut module which mounts an overlayfs each on /etc and /var, with the upper
|
|
|
|
layer in a tmpfs mount. This is the minimal setup to get a booting system, to
|
|
|
|
have a writable /root or /home, additional fstab entries can be added.
|
2018-03-28 10:28:41 +02:00
|
|
|
|
2018-02-28 20:02:36 +01:00
|
|
|
%prep
|
|
|
|
%setup -q
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
|
|
|
%install
|
2019-08-28 16:02:07 +02:00
|
|
|
cp -a etc usr %{buildroot}
|
2019-02-13 09:57:35 +01:00
|
|
|
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/work-etc
|
2018-02-28 20:02:36 +01:00
|
|
|
|
|
|
|
%post
|
2019-02-13 09:57:35 +01:00
|
|
|
if [ "$1" = 1 ] ; then
|
|
|
|
%{_sbindir}/setup-fstab-for-overlayfs
|
|
|
|
mkdir -p %{_localstatedir}/lib/overlay/1/etc
|
2018-02-28 20:02:36 +01:00
|
|
|
fi
|
2019-08-28 16:02:07 +02:00
|
|
|
if [ ! -e /boot/writable -a "`findmnt -n -o FSTYPE -l /`" = "btrfs" ]; then
|
|
|
|
%{_sbindir}/mksubvolume /boot/writable
|
|
|
|
fi
|
|
|
|
%{?update_bootloader_refresh_post}
|
2018-02-28 20:02:36 +01:00
|
|
|
|
2018-03-28 10:28:41 +02:00
|
|
|
%posttrans
|
2019-11-18 19:57:12 +01:00
|
|
|
if [ -f %{_sysconfdir}/zypp/zypp.conf ]; then
|
|
|
|
sed -i 's/^multiversion =.*/multiversion =/g' %{_sysconfdir}/zypp/zypp.conf
|
2018-04-16 12:52:54 +02:00
|
|
|
fi
|
2020-09-05 23:58:01 +02:00
|
|
|
# btrfsmaintainence uses as default "/", but that is read-only.
|
|
|
|
# Change that to /.snapshots/
|
|
|
|
for var in BTRFS_BALANCE_MOUNTPOINTS BTRFS_SCRUB_MOUNTPOINTS BTRFS_TRIM_MOUNTPOINTS; do
|
|
|
|
grep -q "${var}=\"/\"" /etc/sysconfig/btrfsmaintenance && sed -i "s|${var}=.*|${var}=\"/.snapshots\"|g" /etc/sysconfig/btrfsmaintenance
|
|
|
|
done
|
2019-08-28 16:02:07 +02:00
|
|
|
%{?update_bootloader_posttrans}
|
2018-04-16 12:52:54 +02:00
|
|
|
exit 0
|
2018-03-28 10:28:41 +02:00
|
|
|
|
2018-02-28 20:02:36 +01:00
|
|
|
%files
|
|
|
|
%license COPYING
|
2019-02-13 09:57:35 +01:00
|
|
|
%{_sbindir}/setup-fstab-for-overlayfs
|
2018-02-28 20:02:36 +01:00
|
|
|
%{_localstatedir}/lib/overlay
|
2019-02-13 09:57:35 +01:00
|
|
|
%{_prefix}/lib/dracut/dracut.conf.d/10-read-only-root-fs.conf
|
2018-03-28 10:28:41 +02:00
|
|
|
%{_prefix}/lib/systemd/system-preset/*
|
2019-11-18 19:57:12 +01:00
|
|
|
%dir %{_prefix}/lib/systemd/system/systemd-udevd.service.d
|
|
|
|
%{_prefix}/lib/systemd/system/systemd-udevd.service.d/etcmount.conf
|
2019-12-07 15:12:57 +01:00
|
|
|
%dir %{_prefix}/lib/systemd/system/systemd-journal-flush.service.d
|
|
|
|
%{_prefix}/lib/systemd/system/systemd-journal-flush.service.d/afterlocalfs.conf
|
2022-08-04 13:22:55 +02:00
|
|
|
%dir %{_prefix}/lib/systemd/system/systemd-remount-fs.service.d
|
2022-08-05 14:51:23 +02:00
|
|
|
%{_prefix}/lib/systemd/system/systemd-remount-fs.service.d/writableagain.conf
|
2019-08-28 16:02:07 +02:00
|
|
|
%dir %{_sysconfdir}/grub.d
|
|
|
|
%config(noreplace) %{_sysconfdir}/grub.d/01_suse_ro_root
|
2018-02-28 20:02:36 +01:00
|
|
|
|
2018-04-16 12:52:54 +02:00
|
|
|
%files volatile
|
|
|
|
%license COPYING
|
|
|
|
%{_prefix}/lib/dracut/modules.d/99volatile-overlay/
|
|
|
|
|
2018-02-28 20:02:36 +01:00
|
|
|
%changelog
|