[elbe-devel] [PATCH v2 1/4] grubinstaller: remove support for version 1.99
Torben Hohn
torben.hohn at linutronix.de
Fri Aug 23 13:44:10 CEST 2019
On Fri, Aug 23, 2019 at 11:03:29AM +0200, bage at linutronix.de wrote:
> From: Bastian Germann <bage at linutronix.de>
>
> Wheezy is not supported anymore, so remove its version's grub installer.
>
> Signed-off-by: Bastian Germann <bage at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/commands/hdimg.py | 4 +-
> elbepack/elbeproject.py | 6 +--
> elbepack/hdimg.py | 88 +-------------------------------------
> 3 files changed, 4 insertions(+), 94 deletions(-)
>
> diff --git a/elbepack/commands/hdimg.py b/elbepack/commands/hdimg.py
> index 85111b5c..20553822 100644
> --- a/elbepack/commands/hdimg.py
> +++ b/elbepack/commands/hdimg.py
> @@ -37,7 +37,7 @@ def run_command(argv):
> type="int",
> dest="grub_version",
> default=202,
> - help="use specific grub version (possible values are 0, 199 and 202)")
> + help="use specific grub version (possible values are 0 and 202)")
>
> (opt, args) = oparser.parse_args(argv)
>
> @@ -59,7 +59,7 @@ def run_command(argv):
> if opt.skip_grub:
> opt.grub_version = 0
>
> - if opt.grub_version not in [0, 199, 202]:
> + if opt.grub_version not in [0, 202]:
> print("invalid grub version")
> oparser.print_help()
> sys.exit(20)
> diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
> index 0c7b6913..df8a7981 100644
> --- a/elbepack/elbeproject.py
> +++ b/elbepack/elbeproject.py
> @@ -613,7 +613,6 @@ class ElbeProject (object):
> os.remove(os.path.join(self.builddir, "licence.xml"))
>
> # Use some handwaving to determine grub version
> - # jessie and wheezy grubs are 2.0 but differ in behaviour
> #
> # We might also want support for legacy grub
> if (self.get_rpcaptcache().is_installed('grub-pc') and
> @@ -621,10 +620,7 @@ class ElbeProject (object):
> grub_version = 202
> grub_fw_type = "hybrid"
> elif self.get_rpcaptcache().is_installed('grub-pc'):
> - if self.codename == "wheezy":
> - grub_version = 199
> - else:
> - grub_version = 202
> + grub_version = 202
> grub_fw_type = "bios"
> elif self.get_rpcaptcache().is_installed('grub-efi-amd64'):
> grub_version = 202
> diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
> index e6dc2a65..98ae5f2b 100644
> --- a/elbepack/hdimg.py
> +++ b/elbepack/hdimg.py
> @@ -268,90 +268,6 @@ class grubinstaller202(grubinstaller_base):
> self.outf.do("losetup -d /dev/poop0", allow_fail=True)
>
>
> -class grubinstaller199(grubinstaller_base):
> -
> - def install(self, target):
> - if not self.root:
> - return
> -
> - imagemnt = os.path.join(target, "imagemnt")
> - try:
> - self.outf.do('cp -a /dev/loop0 /dev/poop0')
> - self.outf.do('cp -a /dev/loop1 /dev/poop1')
> - self.outf.do('cp -a /dev/loop2 /dev/poop2')
> -
> - self.outf.do('losetup /dev/poop0 "%s"' % self.root.filename)
> - self.root.losetup(self.outf, "poop1")
> - self.outf.do('mount /dev/poop1 %s' % imagemnt)
> -
> - if self.boot:
> - self.boot.losetup(self.outf, "poop2")
> - self.outf.do('mount /dev/poop2 %s' %
> - (os.path.join(imagemnt, "boot")))
> -
> - devmap = open(os.path.join(imagemnt, "boot/grub/device.map"), "w")
> - devmap.write("(hd0) /dev/poop0\n")
> - devmap.write("(hd0,%s) /dev/poop1\n" % self.root.number)
> - if self.boot:
> - devmap.write("(hd0,%s) /dev/poop2\n" % self.boot.number)
> -
> - devmap.close()
> -
> - self.outf.do(
> - "mount --bind /dev %s" %
> - os.path.join(
> - imagemnt,
> - "dev"))
> - self.outf.do(
> - "mount --bind /proc %s" %
> - os.path.join(
> - imagemnt,
> - "proc"))
> - self.outf.do(
> - "mount --bind /sys %s" %
> - os.path.join(
> - imagemnt,
> - "sys"))
> -
> - self.outf.do("chroot %s update-initramfs -u -k all" % imagemnt)
> - self.outf.do("chroot %s update-grub2" % imagemnt)
> -
> - self.outf.do(
> - "chroot %s grub-install --no-floppy /dev/loop0" %
> - imagemnt)
> -
> - finally:
> - os.unlink(os.path.join(imagemnt, "boot/grub/device.map"))
> -
> - self.outf.do(
> - "umount -l %s" %
> - os.path.join(
> - imagemnt,
> - "dev"),
> - allow_fail=True)
> - self.outf.do(
> - "umount -l %s" %
> - os.path.join(
> - imagemnt,
> - "proc"),
> - allow_fail=True)
> - self.outf.do(
> - "umount -l %s" %
> - os.path.join(
> - imagemnt,
> - "sys"),
> - allow_fail=True)
> -
> - self.outf.do("losetup -d /dev/poop0", allow_fail=True)
> -
> - if self.boot:
> - self.outf.do('umount /dev/poop2', allow_fail=True)
> - self.outf.do('losetup -d /dev/poop2', allow_fail=True)
> -
> - self.outf.do('umount /dev/poop1', allow_fail=True)
> - self.outf.do('losetup -d /dev/poop1', allow_fail=True)
> -
> -
> class simple_fstype(object):
> def __init__(self, typ):
> self.type = typ
> @@ -487,9 +403,7 @@ def do_image_hd(outf, hd, fslabel, target, grub_version, grub_fw_type=None):
> else:
> disk = parted.freshDisk(imag, "msdos")
>
> - if grub_version == 199:
> - grub = grubinstaller199(outf)
> - elif grub_version == 202 and grub_fw_type == "efi":
> + if grub_version == 202 and grub_fw_type == "efi":
> grub = grubinstaller202(outf, "efi")
> elif grub_version == 202 and grub_fw_type == "hybrid":
> grub = grubinstaller202(outf, "hybrid")
> --
> 2.20.1
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
More information about the elbe-devel
mailing list