Package: grml-rescueboot
Version: 0.4.5
Severity: wishlist
Tags: patch
Hi,
This package is very useful. However, upon install one has to go
download a grml iso image, and then keep updating it periodically.
I have done a small script that queries the grml site for release
images, and downloads the latest. It is possible to specify the
architecture (32/64/96 with autodetection) and the version (small/full).
I am not sure this script ready for direct usage, especially as it lacks
any kind of documentation. But it could be useful shipped as an example
script.
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages grml-rescueboot depends on:
ii grub-pc 2.02~beta2-10
grml-rescueboot recommends no packages.
grml-rescueboot suggests no packages.
-- Configuration Files:
/etc/default/grml-rescueboot changed [not included]
-- no debconf information
#!/bin/bash
# Simple script to download a grml iso image to use with grml-rescueboot
# Needs the debian keyring, gpg, wget and sha1sum
# Licensed under GPL v2+
usage() {
echo "Usage: $0 [-f] [-a <32|64|96>] [-t <small|full>]" >&2
}
set -e
isotype=full
bitwidth=auto
force=0
while getopts ":a::t::f" opt ; do
case $opt in
a)
if [ $OPTARG = 32 -o $OPTARG = 64 -o $OPTARG = 96 ] ; then
bitwidth=$OPTARG
else
echo "Invalid value '$OPTARG'" >&2
fail=1
fi
;;
t)
if [ $OPTARG = full -o $OPTARG = small ] ; then
isotype=$OPTARG
else
echo "Invalid value '$OPTARG'" >&2
fail=1
fi
;;
f)
force=1
;;
\?)
echo "Invalid Option: -$OPTARG" >&2
fail=1
;;
:)
echo "Option -$OPTARG requires an argument" >&2
fail=1
;;
esac
done
if [ -n "$fail" ] ; then
usage
exit 1
fi
if [ "$bitwidth" = auto ] ; then
arch=$(uname -m)
case $arch in
i?86)
bitwidth=32
;;
x86_64)
bitwidth=64
;;
*)
echo "unknown architecture '$arch', please specify -a flag"
usage
exit 1
;;
esac
fi
echo "Finding out latest iso image..."
date=$(wget --quiet -O- http://deb.grml.org/dists/ | sed --regex -n 's/.*grml-([0-9]{4}\.[0-9]{2})\/.*/\1/p' | sort | tail -1)
if [ -z "$date" ] ; then
echo "Could not find out latest iso" >&2
fi
isoname=grml${bitwidth}-${isotype}_${date}.iso
if [ -f $isoname ] ; then
echo "Found local $isoname, skipping download (use -f to force download)"
else
echo "Downloading $isoname ..."
wget -O $isoname http://download.grml.org/$isoname
fi
sig=`mktemp`
echo "Verifying iso..."
wget --quiet -O $sig http://download.grml.org/${isoname}.sha1.asc
if ! gpg --keyring /usr/share/keyrings/debian-keyring.gpg --verify $sig ; then
echo "Iso file will be left in ${isoname}.untrusted"
mv $isoname ${isoname}.untrusted
rm $sig
exit 1
fi
sed -i -n -e '/\.iso$/p' $sig
if ! sha1sum -c $sig ; then
echo "Iso file will be left in ${isoname}.untrusted"
mv $isoname ${isoname}.untrusted
rm $sig
exit 1
fi
rm $sig
echo "File is OK, move ./$isoname to /boot/grml and run update-grub"