From 1e7153d9b0746e3969856189987c70b82783a5c7 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 7 Jan 2011 11:16:27 +0100 Subject: [PATCH] Support setting location of ISOs via ISO_LOCATION in /etc/default/grml-rescueboot. --- 42_grml | 13 +++++++++---- debian/postinst | 24 ++++++++++++++++-------- etc/default/grml-rescueboot | 3 +++ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/42_grml b/42_grml index b025969..8c55863 100755 --- a/42_grml +++ b/42_grml @@ -1,4 +1,4 @@ -#! /bin/sh -e +#!/bin/sh # Filename: 42_grml # Purpose: grub-mkconfig helper script for Grml rescue systems # Authors: grml-team (grml.org), (c) Andreas Gredler , Michael Prokop @@ -6,20 +6,25 @@ # License: This file is licensed under the GPL v2+. ################################################################################ +set -e + prefix=/usr exec_prefix=${prefix} bindir=${exec_prefix}/bin libdir=${exec_prefix}/lib . ${libdir}/grub/grub-mkconfig_lib -list=$(for i in /boot/grml/*.iso ; do - if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi - done) +# default unless configured otherwise: +ISO_LOCATION="/boot/grml" if [ -r /etc/default/grml-rescueboot ] ; then . /etc/default/grml-rescueboot fi +list=$(for i in "${ISO_LOCATION}"/*.iso ; do + if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi + done) + for grmliso in $list ; do rel_dirname="$(make_system_path_relative_to_its_root $(dirname $grmliso))" grml="$(basename $grmliso)" diff --git a/debian/postinst b/debian/postinst index eb3a28d..131e59f 100644 --- a/debian/postinst +++ b/debian/postinst @@ -5,16 +5,24 @@ set -e case "$1" in configure) - if ls /boot/grml/*iso >/dev/null 2>&1 ; then - if which update-grub >/dev/null 2>&1; then - echo "ISOs found inside /boot/grml, invoking update-grub:" - update-grub + # default, unless configured otherwise: + ISO_LOCATION=/boot/grml + + if [ -r /etc/default/grml-rescueboot ] ; then + . /etc/default/grml-rescueboot + fi + + if ! ls "${ISO_LOCATION}"/*iso >/dev/null 2>&1 ; then + echo "INFO: No *.iso files found inside ${ISO_LOCATION}." + echo "INFO: Please create ${ISO_LOCATION} and place rescue ISO(s) there." + echo "INFO: Finally invoke update-grub and enjoy your rescue system." + else + if ! which update-grub >/dev/null 2>&1; then + echo "WARN: ISOs found inside ${ISO_LOCATION} but update-grub not present (huh?)" else - echo "WARN: ISOs found inside /boot/grml but update-grub not present (huh?)" + echo "INFO: ISOs found inside ${ISO_LOCATION}, invoking update-grub:" + update-grub fi - else - echo "No *.iso files found inside /boot/grml/. Please create /boot/grml and" - echo "place Grml ISO(s) there. Finally invoke update-grub and enjoy your rescue system." fi ;; diff --git a/etc/default/grml-rescueboot b/etc/default/grml-rescueboot index e623899..d2154de 100644 --- a/etc/default/grml-rescueboot +++ b/etc/default/grml-rescueboot @@ -1,5 +1,8 @@ ## Configuration file for Debian package grml-rescueboot. +# Location of ISOs: +# ISO_LOCATION="/boot/grml/" + # To set any specific bootoptions for rescue images # present in /boot/grml just set and enable the following option: # CUSTOM_BOOTOPTIONS="ssh=password lang=de" -- 2.1.4