From 39648354cf9a951329428ee062c92b63020c1062 Mon Sep 17 00:00:00 2001 From: Matheson Steplock Date: Sun, 3 Apr 2022 21:18:34 +0000 Subject: [PATCH] add check /boot/cmdline.txt --- homeassistant-supervised/DEBIAN/postinst | 26 +++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/homeassistant-supervised/DEBIAN/postinst b/homeassistant-supervised/DEBIAN/postinst index 1eebc0f..a919122 100755 --- a/homeassistant-supervised/DEBIAN/postinst +++ b/homeassistant-supervised/DEBIAN/postinst @@ -138,14 +138,26 @@ info "Installing the 'ha' cli" chmod a+x "${PREFIX}/bin/ha" # Switch to cgroup v1 -if ! grep -q "systemd.unified_cgroup_hierarchy=false" /etc/default/grub; then - info "Switching to cgroup v1" - cp /etc/default/grub /etc/default/grub.bak - sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT="/&systemd.unified_cgroup_hierarchy=false /' /etc/default/grub - update-grub - touch /var/run/reboot-required +if [ -f /etc/default/grub ] +then + if ! grep -q "systemd.unified_cgroup_hierarchy=false" /etc/default/grub; then + info "Switching to cgroup v1" + cp /etc/default/grub /etc/default/grub.bak + sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT="/&systemd.unified_cgroup_hierarchy=false /' /etc/default/grub + update-grub + touch /var/run/reboot-required + fi +elif [ -f /boot/cmdline.txt ] +then + if ! grep -q "systemd.unified_cgroup_hierarchy=false" /boot/cmdline.txt; then + info "Switching to cgroup v1" + cp /boot/cmdline.txt /boot/cmdline.txt.bak + sed -i 's/$/systemd.unified_cgroup_hierarchy=false/' /boot/cmdline.txt + touch /var/run/reboot-required + fi +else + warn "Could not find /etc/default/grub or /boot/cmdline.txt failed to switch to cgroup v1" fi - info "Within a few minutes you will be able to reach Home Assistant at:" info "http://homeassistant.local:8123 or using the IP address of your" info "machine: http://${IP_ADDRESS}:8123"