From 202a4152903dc99ebfe0ea740a4cdcb2818f9bb3 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 10 Sep 2021 11:08:22 +0200 Subject: [PATCH] mxlilo: Import into repository LILO is no longer used and the tools are obsolete. Import mxlilo into repository to keep a record before removing it. Import /usr/bin/mxlilo and /etc/lilo.conf with censored boot password. --- mxlilo/lilo.conf | 63 ++++++++++++++++++ mxlilo/mxlilo | 163 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 mxlilo/lilo.conf create mode 100755 mxlilo/mxlilo diff --git a/mxlilo/lilo.conf b/mxlilo/lilo.conf new file mode 100644 index 0000000..e1ff06c --- /dev/null +++ b/mxlilo/lilo.conf @@ -0,0 +1,63 @@ + + +# this config is created by mxlilo +# +# mxlilo detected the following runtime setting when last called: +# +# boot_image(lastboot) = mariux64 +# boot_root(lastboot) = 801 aka /dev/sda1 +# boot_init(lastboot) = /bin/systemd +# boot_rwmode(lastboot) = read-write +# + +boot=/dev/sda +install=/boot/boot.b +map=/boot/map + +prompt +timeout=300 + +#vga=extended +#bitmap=/boot/chicken.bmp +default=mariux64 + +password=CENSORED +restricted + +lba32 + +read-write + +root=/dev/sda1 + +append="init=/bin/systemd" + +image=/boot/bzImage.x86_64 + label=mariux64 + +image=/boot/bzImage.x86_64 + label=donotuse + append="init=/bin/bash" + mandatory + +image=/boot/bzImage-2.6.35.11.mx64.12 + label=2.6.35.11-12 + +image=/boot/bzImage-2.6.39.mx64.14 + label=2.6.39-14 + +image=/boot/bzImage-2.6.39.mx64.18 + label=2.6.39-18 + +image=/boot/bzImage-3.1.9.mx64.28 + label=3.1.9-28 + +image=/boot/bzImage-3.2.2.mx64.32 + label=3.2.2-32 + +image=/boot/bzImage-3.2.2.mx64.34 + label=3.2.2-34 + +image=/boot/bzImage-3.3.1.mx64.37 + label=3.3.1-37 + diff --git a/mxlilo/mxlilo b/mxlilo/mxlilo new file mode 100755 index 0000000..9e31abb --- /dev/null +++ b/mxlilo/mxlilo @@ -0,0 +1,163 @@ +#!/bin/bash + +set -e + +liloconf=/etc/lilo.conf +mxliloconf=${liloconf}.mxlilo + + +options=$(beegetopt --name mxlilo \ + --option noexec/no-exec/n \ + -- "$@") + +if [ $? -ne 0 ] ; then + echo >&2"mxlilo [-n] [image]" + exit 1 +fi + +eval set -- "${options}" + +OPT_NOEXEC=0 + +while true ; do + case "$1" in + --noexec) + shift + OPT_NOEXEC=1 + ;; + --) + shift + break + ;; + esac +done + +defaultimage=$1 + +: ${defaultimage:=mariux64} + + +cmdline=( $(cat /proc/cmdline) ) + +boot_root="" +boot_image="mariux64" +boot_init="/bin/systemd" +boot_rwmode="read-write" +boot_ignored="" + +for arg in "${cmdline[@]}" ; do + case "${arg}" in + BOOT_IMAGE=*) + boot_image=${arg##*BOOT_IMAGE=} + ;; + root=*) + boot_root=${arg##*root=} + ;; + init=*) + boot_init=${arg#*init=} + ;; + rw) + boot_rwmode="read-write" + ;; + auto) + boot_ignored="$boot_ignored ${arg}" + ;; + *) + echo >&2 "WARNING: unknown cmdline argument: ${arg}" + ;; + esac +done + +if [ "${boot_root}" != "" ] ; then + dev_major=${boot_root:0:${#boot_root}-2} + dev_minor=${boot_root: -2} + dev_minor=${dev_minor##*0} + + # only search partitions /sys/block/*/*/dev + dev_blockfile=$(egrep -l "^${dev_major}:${dev_minor}$" /sys/block/*/*/dev) + dev_blockname=${dev_blockfile%%/dev} + dev_blockname=${dev_blockname##/sys/block/} + + boot_rootblockdevice=${dev_blockname##*/} + boot_bootblockdevice=${dev_blockname%%/*} +fi + + +conf_boot=$(grep boot= ${liloconf}) +conf_root=$(grep root= ${liloconf}) + +conf_bootblockdevice=${conf_boot##*boot=/dev/} +conf_rootblockdevice=${conf_root##*root=/dev/} + +if [ "${conf_bootblockdevice}" != "${boot_bootblockdevice}" ] ; then + echo >&2 "WARNING: configured boot device (${conf_bootblockdevice}) != booted root device (${boot_bootblockdevice})" + echo >&2 "WARNING: reusing configured boot device (boot=/dev/${conf_bootblockdevice})" +fi + +bootblockdevice=${conf_bootblockdevice} + +if [ "${conf_rootblockdevice}" != "${boot_rootblockdevice}" ] ; then + echo >&2 "WARNING: configured root device (${conf_rootblockdevice}) != booted root device (${boot_rootblockdevice})" + echo >&2 "WARNING: using booted root device (root=/dev/${conf_rootblockdevice})" +fi + +rootblockdevice=${boot_rootblockdevice} + +echo >${mxliloconf} +chmod 600 ${mxliloconf} + +cat >>${mxliloconf} <>${mxliloconf} + +if [ "${OPT_NOEXEC}" = "0" ] ; then + exec lilo -C ${mxliloconf} +fi