diff options
author | Daniel Baumann <daniel@debian.org> | 2007-09-23 10:04:40 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2007-09-23 10:04:40 +0200 |
commit | 6f5e2da03e5fd1af2200d2f55ca84647bc8d3626 (patch) | |
tree | e2a861c1995eea707b2ac1c72930351191714493 /helpers/lh_buildbinary | |
parent | 9a9491318d4a0469e4c97b28879ab34391c39095 (diff) | |
download | vyos-live-build-6f5e2da03e5fd1af2200d2f55ca84647bc8d3626.tar.gz vyos-live-build-6f5e2da03e5fd1af2200d2f55ca84647bc8d3626.zip |
Adding live-package 0.99.22-1.
Diffstat (limited to 'helpers/lh_buildbinary')
-rwxr-xr-x | helpers/lh_buildbinary | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/helpers/lh_buildbinary b/helpers/lh_buildbinary new file mode 100755 index 000000000..48216e1e0 --- /dev/null +++ b/helpers/lh_buildbinary @@ -0,0 +1,200 @@ +#!/bin/sh + +# lh_buildbinary + +if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ] +then + # Configure chroot + lh_patchchroot apply + lh_patchrunlevel apply + + # Configure network + lh_patchnetwork apply + + mkdir -p "${LIVE_ROOT}"/binary/casper + for MANIFEST in "${LIVE_ROOT}"/filesystem.manifest* + do + if [ -e "${MANIFEST}" ]; then + mv "${MANIFEST}" "${LIVE_ROOT}"/binary/casper/ + fi + done + + if [ "${LIVE_TYPE}" = "Net" ] + then + # Mount proc + mount proc-live -t proc "${LIVE_CHROOT}"/proc + + # Installing smbfs + lh_chroot "aptitude install --assume-yes smbfs" + + # Unmount proc + umount "${LIVE_CHROOT}"/proc + + if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] + then + if [ ! -d "${LIVE_CHROOT}"/etc/initramfs-tools ] + then + mkdir "${LIVE_CHROOT}"/etc/initramfs-tools + fi + + # Configuring initramfs for NFS +cat >> "${LIVE_CHROOT}"/etc/initramfs-tools/initramfs.conf << EOF +MODULES=netboot +BOOT=nfs +NFSROOT=auto +EOF + lh_chroot "update-initramfs -tu" + fi + fi + + lh_cleanapt + + # Switching package indices to default + if [ "${LIVE_GENERIC_INDICES}" = "yes" ] + then + lh_setupapt default + lh_configapt deapply-proxy + lh_configapt deapply-recommends + fi + + # Deconfigure network + lh_patchnetwork deapply + + # Deconfigure chroot + lh_patchrunlevel deapply + lh_patchchroot deapply + + # Generating rootfs image + lh_genrootfs + + # Configure chroot + lh_patchchroot apply + lh_patchrunlevel apply + + # Configure network + lh_patchnetwork apply + + lh_cleanapt + + # Switching package indices to custom + lh_setupapt custom + lh_configapt apply-proxy + lh_configapt apply-recommends + + case "${LIVE_TYPE}" in + Iso) + TYPE=iso + ;; + Usb) + TYPE=usb + ;; + Net) + TYPE=net + ;; + esac + + # Mount proc + mount proc-live -t proc "${LIVE_CHROOT}"/proc + + # Install depends + lh_depends install $TYPE + + # Installing syslinux + lh_installsyslinux $TYPE + + # Installing linux-image + lh_installlinux $TYPE + + # Installing memtest + lh_installmemtest86+ $TYPE + + # Deconfigure network + lh_patchnetwork deapply + + # Deconfigure chroot + lh_patchrunlevel deapply + lh_patchchroot deapply + + # Installing templates + if [ "${LIVE_FLAVOUR}" != "minimal" ] || [ "${LIVE_FLAVOUR}" != "mini" ] + then + if [ "${TYPE}" != "usb" ] + then + cp -r "${LIVE_TEMPLATES}"/common/* "${LIVE_ROOT}"/binary + fi + + if [ "${TYPE}" = "iso" ] || [ "${TYPE}" = "usb" ] + then + cp -r "${LIVE_TEMPLATES}"/iso/* "${LIVE_ROOT}"/binary + fi + fi + + # Calculating md5sums + lh_md5sums + + case "${TYPE}" in + iso) + if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] + then + # Create image + ${GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_DISK_VOLUME}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE} + else + echo "W: Bootloader on your architecture not yet supported (Continuing in 5 seconds)." + sleep 5 + # Create image + ${GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_DISK_VOLUME}" "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE} + fi + ;; + + net) + cd "${LIVE_ROOT}" && \ + mv binary "`basename ${LIVE_SERVER_PATH}`" && \ + cd .. && \ + tar cfz binary.tar.gz "`basename ${LIVE_ROOT}`/`basename ${LIVE_SERVER_PATH}`" "`basename ${LIVE_ROOT}`/tftpboot" && \ + mv binary.tar.gz "${LIVE_ROOT}" && \ + cd "${OLDPWD}" && \ + mv "`basename ${LIVE_SERVER_PATH}`" binary + ;; + + usb) + # Everything which comes here needs to be cleaned up, + DU_DIM="`du -ms ${LIVE_ROOT}/binary | cut -f1`" + REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here... + dd if=/dev/zero of="${LIVE_ROOT}"/binary.img bs=1024k count=${REAL_DIM} + + FREELO="`losetup -f`" + + echo "!!! The following error/warning messages can be ignored !!!" + lh_losetup $FREELO "${LIVE_ROOT}"/binary.img 0 + set +e + lh_chroot "parted -s ${FREELO} mklabel msdos" + lh_chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" + lh_chroot "parted -s ${FREELO} set 1 boot on" + lh_chroot "parted -s ${FREELO} set 1 lba off" + set -e + cat "${LIVE_CHROOT}"/usr/lib/syslinux/mbr.bin > ${FREELO} + losetup -d ${FREELO} + + lh_losetup $FREELO "${LIVE_ROOT}"/binary.img 1 + lh_chroot "mkfs.msdos -n DEBIAN_LIVE ${FREELO}" + mkdir "${LIVE_ROOT}"/binary.tmp + mount ${FREELO} "${LIVE_ROOT}"/binary.tmp + cp -r "${LIVE_ROOT}"/binary/* "${LIVE_ROOT}"/binary.tmp + umount "${LIVE_ROOT}"/binary.tmp + rmdir "${LIVE_ROOT}"/binary.tmp + lh_chroot "syslinux ${FREELO}" + losetup -d ${FREELO} + + echo "!!! The above error/warning messages can be ignored !!!" + ;; + esac + + # Remove depends + lh_depends remove $TYPE + + # Unmount proc + umount "${LIVE_CHROOT}"/proc + + # Touching stage file + touch "${LIVE_ROOT}"/.stage/image_binary +fi |