diff --git a/Makefile b/Makefile index 8baec3f..ddeef94 100644 --- a/Makefile +++ b/Makefile @@ -5,18 +5,12 @@ all: ./scripts/stage1.sh $(CURDIR)/bin/recovery.img install: - install -D scripts/bootcount_reset \ - $(DESTDIR)$(prefix)/bin/bootcount_reset install -D scripts/recovery_sync \ $(DESTDIR)$(prefix)/bin/recovery_sync install -D bin/recovery.img \ $(DESTDIR)/$(prefix)/share/recovery_environment/recovery.img - install -D scripts/42_bootcount \ - $(DESTDIR)/etc/grub.d/42_bootcount install -D scripts/42_recovery \ $(DESTDIR)/etc/grub.d/42_recovery - install -m 0644 -D scripts/delphix-bootcount.service \ - $(DESTDIR)/lib/systemd/system/delphix-bootcount.service clean: rm -rf bin/recovery.img @@ -25,11 +19,8 @@ clean: distclean: clean uninstall: - -rm -f $(DESTDIR)/$(prefix)/bin/bootcount_reset -rm -f $(DESTDIR)/$(prefix)/bin/recovery_sync -rm -f $(DESTDIR)/$(prefix)/share/recovery_environment/recovery.img - -rm -f $(DESTDIR)/etc/grub.d/42_bootcount -rm -f $(DESTDIR)/etc/grub.d/42_recovery - -rm -f $(DESTDIR)/lib/systemd/system/delphix-bootcount.service .PHONY: all install clean distclean uninstall diff --git a/debian/postinst b/debian/postinst index f0f297f..1dccf22 100755 --- a/debian/postinst +++ b/debian/postinst @@ -67,12 +67,6 @@ find . -print0 | cpio --null --create --format=newc | gzip -7 >"$target" 2>/dev/ # when doing an upgrade inside a container. As a result, we do not run # mkconfig in this script, and rely on the end-of-upgrade scripts to do it. # -# Similary, the environment block in the bootloader is set by the bootcount -# service after first boot, and the recovery environment will be synced when a -# configuration change is made. -# - -systemctl enable delphix-bootcount.service cd / || die "failed to cd /" rm -rf "$workdir" diff --git a/scripts/42_bootcount b/scripts/42_bootcount deleted file mode 100755 index d871b0b..0000000 --- a/scripts/42_bootcount +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# shellcheck disable=SC2121 -# shellcheck disable=SC2154 -# shellcheck disable=SC2093 - -exec tail -n +3 "$0" - -if [ x"${bootcount}" = x0 ]; then - set bootcount=1 -elif [ x"${bootcount}" = x1 ]; then - set bootcount=2 -elif [ x"${bootcount}" = x2 ]; then - set bootcount=3 -elif [ x"${bootcount}" = x3 ]; then - set default=2 - set bootcount=0 -fi -save_env bootcount diff --git a/scripts/bootcount_reset b/scripts/bootcount_reset deleted file mode 100644 index ef7766d..0000000 --- a/scripts/bootcount_reset +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -function die() { - echo "$1" >&2 - exit 1 -} - -/usr/bin/grub-editenv /boot/grub/grubenv set bootcount=0 2>/dev/null && exit 0 - -# Perform firstboot/corruption case logic -/usr/bin/grub-editenv /boot/grub/grubenv create || die "Could not create grubenv" -/usr/bin/grub-editenv /boot/grub/grubenv set bootcount=0 || die "Could not set boot count to zero" -/usr/bin/recovery_sync /boot/recovery.img || die "could not sync recovery environment" diff --git a/scripts/delphix-bootcount.service b/scripts/delphix-bootcount.service deleted file mode 100644 index 48e0098..0000000 --- a/scripts/delphix-bootcount.service +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2020 by Delphix. All rights reserved. -# - -[Unit] -Description=Delphix bootcount reset service -Requires=ssh.service -After=ssh.service -ConditionVirtualization=!container - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStartPre=/bin/sleep 300 -ExecStart=/usr/bin/bootcount_reset - -[Install] -WantedBy=delphix.target