#!/usr/bin/env zsh # # Copyright (c) 2016 Dyne.org Foundation # libdevuansdk is written and maintained by # Jaromil # KatolaZ # parazyd # # This file is part of libdevuansdk # # This source code is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this source code. If not, see . vars+=(iso isodir) iso_prepare() { fn iso_prepare $@ req=(strapdir os release version arch) root=$strapdir freq=($strapdir/.done) # freq=($R/chroot/$chroot_arch/$iso/initrd.gz) reqck || return 1 iso=${os}_${release}_${version}_${arch}.iso isodir=$workdir/iso_${os}_${release}_${version}_${arch} notice "Preparing ISO in $isodir" mkdir -p $isodir [[ -r /usr/lib/ISOLINUX/isolinux.bin ]] || { error "Isolinux binary not found" zerr; zshexit } [[ -r /usr/lib/ISOLINUX/isohdpfx.bin ]] || { error "Isolinux binary not found" zerr; zshexit } mkdir -p $isodir/isolinux cp /usr/lib/ISOLINUX/isolinux.bin $isodir/isolinux cp /usr/lib/syslinux/modules/bios/*.c32 $isodir/isolinux cat < $isodir/isolinux/isolinux.cfg path include menu.cfg default vesamenu.c32 prompt 0 timeout 0 label Shell com32 rosh.c32 EOF cat < $isodir/isolinux/menu.cfg menu hshift 7 menu width 61 menu title Devuan GNU+Linux include stdmenu.cfg include txt.cfg EOF cat < $isodir/isolinux/stdmenu.cfg menu color title * #FFFFFFFF * menu color border * #00000000 #00000000 none menu color sel * #ffffffff #76a1d0ff * menu color hotsel 1;7;37;40 #ffffffff #76a1d0ff * menu color tabmsg * #ffffffff #00000000 * menu color help 37;40 #ffdddd00 #00000000 none # XXX When adjusting vshift, take care that rows is set to a small # enough value so any possible menu will fit on the screen, # rather than falling off the bottom. menu vshift 12 menu rows 10 menu helpmsgrow 15 # The command line must be at least one line from the bottom. menu cmdlinerow 16 menu timeoutrow 16 menu tabmsgrow 18 menu tabmsg Press ENTER to boot or TAB to edit a menu entry EOF cat < $isodir/isolinux/txt.cfg label default menu label ^Boot Devuan $release $version $arch kernel linux append vga=788 initrd=initrd.img boot=live EOF # # append vga=788 initrd=initrd.img boot=live toram=filesystem.squashfs } iso_mkinitrd() { fn iso_mkinitrd $@ req=(iso isodir arch) freq=($isodir/isolinux/isolinux.bin) ckreq || return 1 sudo chroot $strapdir apt-get install -y live-boot live-boot-initramfs-tools extlinux # sudo chroot $strapdir update-initramfs -u # sudo chroot $strapdir update-initramfs -c -k all sudo chroot $strapdir live-update-initramfs -u # latest kernel local kernel="" for i in ${(f)"$(ls -t $strapdir/boot)"}; do [[ "$i" =~ "vmlinuz" ]] || continue kernel=$strapdir/boot/$i done # latest ramdisk local initrd="" for i in ${(f)"$(ls -t $strapdir/boot)"}; do [[ "$i" =~ "initrd" ]] || continue initrd=$strapdir/boot/$i done cp -v $kernel $isodir/isolinux/linux cp -v $initrd $isodir/isolinux/initrd.img } iso_mkusr() { fn iso_mkusr $@ req=(iso isodir) ckreq || return 1 ztmp conf_print_usrexcludes > $ztmpfile usrdir=$workdir/usr_${os}_${release}_${version}_${arch} mkdir -p $usrdir rsync -av $strapdir/ $usrdir --exclude-from=$ztmpfile mkdir -p $isodir/live mksquashfs $usrdir/ $isodir/live/filesystem.squashfs } iso_make() { fn iso_make $@ req=(iso isodir outdir) freq=($isodir/isolinux/isolinux.bin) ckreq || return 1 mkdir -p $outdir sudo xorriso \ -as mkisofs -r -J -joliet-long -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \ -partition_offset 16 -V DEVUAN \ -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ -boot-info-table -o $outdir/$iso $isodir notice "$iso ready" ls -lh $outdir/$iso }