Skip to content

Commit

Permalink
Merge pull request #17 from LorbusChris/dev
Browse files Browse the repository at this point in the history
v0.4
  • Loading branch information
LorbusChris authored Aug 6, 2018
2 parents 1050636 + b1e72c7 commit f202c46
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ set -euo pipefail
if grub2-editenv list | grep -q "^boot_counter=-1$"; then
rpm-ostree rollback
fi
grub2-editenv - set boot_success=1
4 changes: 4 additions & 0 deletions etc/greenboot/green.d/02_grub2_boot_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail

grub2-editenv - set boot_success=1
File renamed without changes.
File renamed without changes.
70 changes: 40 additions & 30 deletions greenboot.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%global build_timestamp %(date +"%Y%m%d%H%M%%S")

Name: greenboot
Version: 0.3
Version: 0.4
Release: 1%{?dist}
Summary: Generic Health Check Framework for systemd
License: LGPLv2+
Expand All @@ -20,23 +20,35 @@ Requires: systemd
%{summary}.

%package motd
Summary: MotD updater for greenboot
Summary: Message of the Day updater for greenboot
Requires: greenboot
Requires: pam >= 1.3.1

%description motd
Message of the Day updater for greenboot
%{summary}.

%package ostree-grub2
Summary: greenboot scripts for OSTree-based systems using the Grub2 bootloader
Requires: greenboot
Requires: greenboot-grub2
Requires: greenboot-reboot

%package ostree
Summary: OSTree specific scripts for greenboot
%description ostree-grub2
%{summary}.

%description ostree
OSTree specific scripts for greenboot
%package grub2
Summary: Grub2 specific scripts for greenboot
Requires: greenboot

%description grub2
%{summary}.

%package reboot
Summary: Reboot on red status for greenboot
Requires: greenboot

%description reboot
Reboot on red status for greenboot
%{summary}.

%prep
%setup -n %{github_project}-%{version}
Expand All @@ -49,23 +61,19 @@ install -Dpm 0644 usr/lib/systemd/system/greenboot.target %{buildroot}%{_unitdir
install -Dpm 0644 usr/lib/systemd/system/greenboot-healthcheck.service %{buildroot}%{_unitdir}/greenboot-healthcheck.service
install -Dpm 0644 usr/lib/systemd/system/greenboot.service %{buildroot}%{_unitdir}/greenboot.service
install -Dpm 0644 usr/lib/systemd/system/redboot.service %{buildroot}%{_unitdir}/redboot.service
mkdir -p %{buildroot}/run/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/motd.d
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/check/required.d
install -Dpm 0755 etc/greenboot/check/required.d/00_required_scripts_start.sh %{buildroot}%{_sysconfdir}/%{name}/check/required.d/00_required_scripts_start.sh
mkdir %{buildroot}%{_sysconfdir}/%{name}/check/wanted.d
install -Dpm 0755 etc/greenboot/check/wanted.d/00_wanted_scripts_start.sh %{buildroot}%{_sysconfdir}/%{name}/check/wanted.d/00_wanted_scripts_start.sh
mkdir %{buildroot}%{_sysconfdir}/%{name}/green.d
install -Dpm 0755 etc/greenboot/green.d/00_grub_fallback.sh %{buildroot}%{_sysconfdir}/%{name}/green.d/00_grub_fallback.sh
install -Dpm 0755 etc/greenboot/green.d/00_greenboot_notification.sh %{buildroot}%{_sysconfdir}/%{name}/green.d/00_greenboot_notification.sh
install -Dpm 0755 etc/greenboot/green.d/01_greenboot_motd.sh %{buildroot}%{_sysconfdir}/%{name}/green.d/01_greenboot_motd.sh
mkdir %{buildroot}%{_sysconfdir}/%{name}/red.d
install -Dpm 0755 etc/greenboot/red.d/00_redboot_notification.sh %{buildroot}%{_sysconfdir}/%{name}/red.d/00_redboot_notification.sh
install -Dpm 0755 etc/greenboot/red.d/01_redboot_motd.sh %{buildroot}%{_sysconfdir}/%{name}/red.d/01_redboot_motd.sh
install -Dpm 0755 etc/greenboot/red.d/99_reboot.sh %{buildroot}%{_sysconfdir}/%{name}/red.d/99_reboot.sh
install -Dpm 0644 etc/greenboot/motd/greenboot.motd %{buildroot}%{_sysconfdir}/%{name}/motd/greenboot.motd
install -Dpm 0644 etc/greenboot/motd/redboot.motd %{buildroot}%{_sysconfdir}/%{name}/motd/redboot.motd
mkdir -p %{buildroot}/run/greenboot
mkdir -p %{buildroot}%{_sysconfdir}/motd.d
ln -snf /run/greenboot/motd %{buildroot}%{_sysconfdir}/motd.d/greenboot
mkdir %{buildroot}%{_sysconfdir}/%{name}/motd
install -Dpm 0755 etc/greenboot/check/required.d/* %{buildroot}%{_sysconfdir}/%{name}/check/required.d
install -Dpm 0755 etc/greenboot/check/wanted.d/* %{buildroot}%{_sysconfdir}/%{name}/check/wanted.d
install -Dpm 0755 etc/greenboot/green.d/* %{buildroot}%{_sysconfdir}/%{name}/green.d
install -Dpm 0755 etc/greenboot/red.d/* %{buildroot}%{_sysconfdir}/%{name}/red.d
install -Dpm 0644 etc/greenboot/motd/* %{buildroot}%{_sysconfdir}/%{name}/motd
ln -snf /run/greenboot/motd %{buildroot}%{_sysconfdir}/motd.d/%{name}

%post
%systemd_post greenboot.target
Expand Down Expand Up @@ -107,15 +115,17 @@ ln -snf /run/greenboot/motd %{buildroot}%{_sysconfdir}/motd.d/greenboot
%{_sysconfdir}/%{name}/red.d/00_redboot_notification.sh

%files motd
%{_sysconfdir}/%{name}/motd/greenboot.motd
%{_sysconfdir}/%{name}/motd/redboot.motd
%{_sysconfdir}/%{name}/green.d/01_greenboot_motd.sh
%{_sysconfdir}/%{name}/red.d/01_redboot_motd.sh
%dir /run/greenboot
%config %{_sysconfdir}/motd.d/greenboot

%files ostree
%{_sysconfdir}/%{name}/green.d/00_grub_fallback.sh
%dir /run/%{name}
%config %{_sysconfdir}/motd.d/%{name}
%{_sysconfdir}/%{name}/motd/
%{_sysconfdir}/%{name}/green.d/50_greenboot_motd.sh
%{_sysconfdir}/%{name}/red.d/50_redboot_motd.sh

%files ostree-grub2
%{_sysconfdir}/%{name}/green.d/01_ostree_grub2_fallback.sh

%files grub2
%{_sysconfdir}/%{name}/green.d/02_grub2_boot_success.sh

%files reboot
%{_sysconfdir}/%{name}/red.d/99_reboot.sh
Expand Down
2 changes: 1 addition & 1 deletion tests/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Vagrant.configure("2") do |config|

config.vm.provision "shell", inline: <<-SHELL
curl https://copr.fedorainfracloud.org/coprs/lorbus/greenboot/repo/fedora-28/lorbus-greenboot-fedora-28.repo --output /etc/yum.repos.d/_copr_lorbus-greenboot.repo
rpm-ostree install greenboot greenboot-motd
rpm-ostree install greenboot greenboot-motd greenboot-ostree-grub2
rpm-ostree ex livefs
# Uncomment the following line to test red boot status behaviour
# mv /home/vagrant/sync/10_failing_check.sh /etc/greenboot/check/required.d/10_failing_check.sh
Expand Down
2 changes: 1 addition & 1 deletion tests/run_ostree_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -euo pipefail

rpm-ostree upgrade
grub2-editenv - set boot_success=0
grub2-editenv - set boot_counter=2
grub2-editenv - set boot_counter=3
reboot

0 comments on commit f202c46

Please sign in to comment.