source: live-build/trunk/fuentes/share/hooks/100-build-wubildr.binary @ 900

Last change on this file since 900 was 900, checked in by kbut, 4 years ago

add original source

File size: 1.3 KB
1#! /bin/sh
3set -e
5# Build the wubildr bootloader for Wubi.
7cd ..
8CHROOT="$(mktemp -d)"
9# grub-mkimage needs to be able to find the source file of the loopback image
10# in the location that losetup knows it is; however, in a chroot this file wont
11# be present, so we need to make it so by the magic of bind mounts:
12mkdir -p "ubuntu/disks"
13# FIXME: swap these next two lines around when the buildds can handle ext4:
14# mv "binary/boot/filesystem.ext4" "ubuntu/disks/root.disk"
15mv "binary/boot/filesystem.ext3" "ubuntu/disks/root.disk"
16mount -o loop "ubuntu/disks/root.disk" "$CHROOT"
17# Save the directory structure mkdir created, so that it can be removed later.
18REMOVE="$(mkdir -pv "$CHROOT$PWD" | head -n1 | sed "s,.*\`\(.*\)',\1,")"
19mount -o bind "$PWD" "$CHROOT$PWD"
20chroot "$CHROOT" mount -t proc proc /proc
21# Expected to already exist.
22touch wubildr
23# grub-install cries unless you point it at something.
24chroot "$CHROOT" grub-install /dev/null
25umount "$CHROOT/proc"
26umount "$CHROOT$PWD"
27rm -rf "$REMOVE"
28# /host is normally created by partman-auto-loop.
29mkdir "$CHROOT/host"
30umount "$CHROOT"
31mv wubildr binary/boot
32# Link output files somewhere BuildLiveCD will be able to find them.
34mv ubuntu/disks/root.disk binary/boot/root.disk
35rmdir -p ubuntu/disks
36tar cf - -C binary/boot root.disk wubildr | xz -9 > "$PREFIX.tar.xz"
Note: See TracBrowser for help on using the repository browser.