From a4ab75172c504152c71c94cd794c285b5e73ac89 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 3 May 2021 01:53:09 +0200 Subject: [PATCH] contrib: debian: use SUPPORTED_INITS instead of custom entry Signed-off-by: Joachim Wiberg --- contrib/debian/Makefile.am | 2 +- contrib/debian/grub.d/40_custom | 14 -------------- contrib/debian/grub.d/Makefile.am | 3 --- contrib/debian/install.sh | 18 ++++++++++++------ 4 files changed, 13 insertions(+), 24 deletions(-) delete mode 100755 contrib/debian/grub.d/40_custom delete mode 100644 contrib/debian/grub.d/Makefile.am diff --git a/contrib/debian/Makefile.am b/contrib/debian/Makefile.am index be2f8933..156d91a8 100644 --- a/contrib/debian/Makefile.am +++ b/contrib/debian/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = finit.d grub.d +SUBDIRS = finit.d docsdir := @docdir@/contrib/debian docs_DATA = README.md finit.conf os-release build.sh install.sh EXTRA_DIST = $(docs_DATA) diff --git a/contrib/debian/grub.d/40_custom b/contrib/debian/grub.d/40_custom deleted file mode 100755 index 12be75e5..00000000 --- a/contrib/debian/grub.d/40_custom +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -exec tail -n +3 $0 -# This file provides an easy way to add custom menu entries. Simply type the -# menu entries you want to add after this comment. Be careful not to change -# the 'exec tail' line above. - -menuentry '$MENU with Finit' --class $TYPE --class gnu-linux --class gnu --class os --user { - insmod gzio - insmod part_msdos - insmod ext2 - search --no-floppy --fs-uuid --set=root $BOOT - linux /vmlinuz root=UUID=$ROOT ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=/sbin/finit - initrd /initrd.img -} diff --git a/contrib/debian/grub.d/Makefile.am b/contrib/debian/grub.d/Makefile.am deleted file mode 100644 index c3629195..00000000 --- a/contrib/debian/grub.d/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -docsdir := @docdir@/contrib/debian/grub.d -docs_DATA = 40_custom -EXTRA_DIST = $(docs_DATA) diff --git a/contrib/debian/install.sh b/contrib/debian/install.sh index 4a67b773..f8d3e2a0 100755 --- a/contrib/debian/install.sh +++ b/contrib/debian/install.sh @@ -38,12 +38,18 @@ if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then cp -va finit.d /etc/ echo "*** Setting up a GRUB boot entry ..." - MENU=`grep gnu-linux /boot/grub/grub.cfg |head -1 |sed "s/menuentry '\([^']*\).*/\1/"` - TYPE=`grep gnu-linux /boot/grub/grub.cfg |head -1 |sed "s/.*' --class \([a-z]*\).*/\1/"` - BOOT=`grep set=root /boot/grub/grub.cfg |head -1 |sed 's/.* \([a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*\).*/\1/'` - ROOT=`grep root=UUID /boot/grub/grub.cfg |head -1 |sed 's/.*UUID=\([a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*\).*/\1/'` - cat grub.d/40_custom | sed "s,\$BOOT,$BOOT,;s,\$ROOT,$ROOT,;s,\$TYPE,$TYPE,;s,\$MENU,$MENU," >/etc/grub.d/40_custom - update-grub + fn=/etc/grub.d/10_linux + if [ -e $fn ]; then + if `grep SUPPORTED_INITS $fn |head -1 |grep -q finit`; then + echo "Already installed, done." + else + echo "Adding Finit to list of SUPPORTED_INITS ..." + sed -i 's/SUPPORTED_INITS="[^"]*/& finit:\/sbin\/finit/' $fn + update-grub + fi + else + echo "Cannot find $fn, you'll have to set up your bootloader on your own." + fi echo echo "*** Done"