From 2f0e026cd1183fe0eed730068ea59b5ac75905b6 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Thu, 3 Jan 2019 02:00:59 +0100 Subject: [PATCH] Add config bootloaders --- config/bash/editor | 1 + config/boot/menu | 12 ++++++++++++ config/boot/refind/menu | 22 ++++++++++++++++++++++ config/boot/syslinux/menu | 20 ++++++++++++++++++++ config/boot/systemd/menu | 21 +++++++++++++++++++++ lib | 3 +++ 6 files changed, 79 insertions(+) create mode 100644 config/boot/refind/menu create mode 100644 config/boot/syslinux/menu create mode 100644 config/boot/systemd/menu diff --git a/config/bash/editor b/config/bash/editor index 07f7f2f..12f9ad6 100644 --- a/config/bash/editor +++ b/config/bash/editor @@ -28,6 +28,7 @@ if [ "$editor" = "unset" ]; then else echo "export EDITOR=$editor" > /etc/profile.d/editor.sh chmod 755 /etc/profile.d/editor.sh + export EDITOR=$editor fi exit 0 diff --git a/config/boot/menu b/config/boot/menu index c38708d..724f7c6 100644 --- a/config/boot/menu +++ b/config/boot/menu @@ -6,6 +6,15 @@ options+=("initcpio" "") if [ -f /boot/grub/grub.cfg ]; then options+=("grub" "") fi +if [ -f /boot/loader/loader.conf ]; then + options+=("systemd-boot" "") +fi +if [ -f /boot/refind_linux.conf ]; then + options+=("refind" "") +fi +if [ -f /boot/syslinux/syslinux.cfg ]; then + options+=("syslinux" "") +fi defaultitem="" sel=$(whiptail --backtitle "$apptitle" --title "Boot Configuration :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \ @@ -19,6 +28,9 @@ sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0 case $sel in 'initcpio') menu config/boot/initcpio/menu;; 'grub') menu config/boot/grub/menu;; + 'systemd-boot') menu config/boot/systemd/menu;; + 'refind') menu config/boot/refind/menu;; + 'syslinux') menu config/boot/syslinux/menu;; esac exit 0 diff --git a/config/boot/refind/menu b/config/boot/refind/menu new file mode 100644 index 0000000..6844d9d --- /dev/null +++ b/config/boot/refind/menu @@ -0,0 +1,22 @@ +#!/bin/bash +. ./lib + +options=() +options+=("config" "/boot/refind_linux.conf") +options+=("global config" "/boot/refind_linux.conf") + +defaultitem="" +sel=$(whiptail --backtitle "$apptitle" --title "rEFInd Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) +if [ ! "$?" = "0" ]; then + exit 1 +fi +sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0 + +case $sel in + 'config') editfile /boot/refind_linux.conf;; + 'global config') editfile /boot/EFI/refind/refind.conf;; +esac + +exit 0 diff --git a/config/boot/syslinux/menu b/config/boot/syslinux/menu new file mode 100644 index 0000000..cb94728 --- /dev/null +++ b/config/boot/syslinux/menu @@ -0,0 +1,20 @@ +#!/bin/bash +. ./lib + +options=() +options+=("config" "/boot/syslinux/syslinux.cfg") + +defaultitem="" +sel=$(whiptail --backtitle "$apptitle" --title "Syslinux Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) +if [ ! "$?" = "0" ]; then + exit 1 +fi +sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0 + +case $sel in + 'config') editfile /boot/syslinux/syslinux.cfg;; +esac + +exit 0 diff --git a/config/boot/systemd/menu b/config/boot/systemd/menu new file mode 100644 index 0000000..9ea2415 --- /dev/null +++ b/config/boot/systemd/menu @@ -0,0 +1,21 @@ +#!/bin/bash +. ./lib + +options=() +options+=("config" "/boot/loader/loader.conf") +#/boot/loader/entries/* + +defaultitem="" +sel=$(whiptail --backtitle "$apptitle" --title "Systemd Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) +if [ ! "$?" = "0" ]; then + exit 1 +fi +sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0 + +case $sel in + 'config') editfile /boot/loader/loader.conf;; +esac + +exit 0 diff --git a/lib b/lib index 248f0b7..6296221 100644 --- a/lib +++ b/lib @@ -180,6 +180,9 @@ editfile(){ if [ "$editor" == "" ]; then editor="nano" fi + if [ ! -f "/usr/bin/$editor" ]; then + editor="nano" + fi echo "$editor $1" $editor "$1" }