tadded stuff in customise - libdevuansdk - common library for devuan's simple distro kits HTML git clone https://git.parazyd.org/libdevuansdk DIR Log DIR Files DIR Refs DIR Submodules DIR README DIR LICENSE --- DIR commit ad29e93415d6796ea1b0fd07f68827b8fe5fc68a DIR parent 510875218b04e350b12efb5daab37a33d305e629 HTML Author: KatolaZ <katolaz@yahoo.it> Date: Sun, 12 Jun 2016 23:05:25 +0100 added stuff in customise Diffstat: M zlibs/customise | 61 +++++++++++++++++++++++++++---- M zlibs/helpers | 2 +- M zlibs/imaging | 9 +++++---- M zlibs/sysconf | 22 +++++++++++++++++++--- 4 files changed, 79 insertions(+), 15 deletions(-) --- DIR diff --git a/zlibs/customise b/zlibs/customise t@@ -30,6 +30,7 @@ install_default_kernel(){ reqck || return 1 local kernel_base=linux-image + local kernel="" case $arch in amd64) t@@ -39,35 +40,81 @@ install_default_kernel(){ kernel=${kernel_base}-586 ;; *) - error "Architecture ::1 is not supported!!!" ${arch} + error "Architecture ::1 arch:: is not supported!!!" ${arch} + zerr; zshexit ;; esac + notice "Installing stock kernel for ::1 arch:: (::2 kernel::)" $arch $kernel + + mountdevprocsys ${root} - sudo chroot ${root} apt-get install --no-install-recommends ${kernel} + + sudo chroot ${root} apt-get --yes --force-yes --no-install-recommends install $kernel + umountdevprocsys ${root} notice "default kernel installed" } + make_qemu_img(){ fn make_qemu_img $@ local imgfile=$1 local imgsize=${2:-4G} - local imgformat=${3:-qcow2} + local imgformat=${3:-raw} req=(strapdir os release version arch imgfile imgsize) root=$strapdir reqck || return 1 - - check_executable qemu-img || error "Could not find qemu-img!!!" && return 1 + local blockskip=2050 + + ## create the qemu image + act "creating qemu image" qemu-img create -f ${imgformat} ${imgfile} ${imgsize} + + sudo parted ${imgfile} --script -- mklabel msdos + sudo parted ${imgfile} --script -- mkpart primary ${blockskip}s -1s + sudo parted ${imgfile} --script -- set 1 boot on + + ## setup the loop device + loop1=`sudo losetup -f` + sudo losetup ${loop1} ${imgfile} + loop2=`sudo losetup -f` + sudo losetup -o $((${blockskip} * 512)) ${loop2} ${loop1} + + + ## now we create the fs + act "creating filesystem" + sudo mkfs.ext4 ${loop2} + + ## and we loop-mount it + + ztmpd + mntdir=$ztmpdir + sudo mount -o loop ${loop2} ${mntdir} + + echo "mntdir: $mntdir strapdir: $strapdir" + + + # now we rsync everything + sudo rsync -av ${strapdir}/ $mntdir + + # we now install the grub bootloader + #_install_bootloader $mntdir + + sync + sudo umount ${mntdir} + + sudo losetup -d ${loop2} + sudo losetup -d ${loop1} + if [[ ! -z ${imgfile} ]]; then - notice "QEMU image created in ::1" ${imgfile} + notice "QEMU image created in ::1 imgfile::" ${imgfile} else - warning "Unable to create QEMU image file in ::1" ${imgfile} + warning "Unable to create QEMU image file in ::1 imgfile::" ${imgfile} fi } \ No newline at end of file DIR diff --git a/zlibs/helpers b/zlibs/helpers t@@ -179,7 +179,7 @@ check_executable() { fn check_executable $@ progname=$1 - if [[ `which $progname | grep "not found" | wc -l` -ge 1 ]]; then + if [[ `which ${progname} | grep "not found" | wc -l` -ge 1 ]]; then return 0; else return 1; DIR diff --git a/zlibs/imaging b/zlibs/imaging t@@ -27,10 +27,11 @@ vars+=(imgname imgpath) img_mkimage() { fn img_mkimage $@ - imgpath=${strapdir}.img - local mbrtype="$1" - local bootfstype="$2" - local rootfstype="$3" + imgpath=${1:-${strapdir}.img} + local mbrtype="$2" + local bootfstype="$3" + local rootfstype="$4" + local imgsize=${5:-$imgsize} req=(imgpath imgsize mbrtype bootfstype rootfstype) ckreq || return 1 DIR diff --git a/zlibs/sysconf b/zlibs/sysconf t@@ -38,9 +38,25 @@ conf_install_kernel() { chrootpath="$1" req=(arch chrootpath) ckreq || return 1 - - notice "Installing stock kernel (linux-image-$arch)" - sudo chroot ${chrootpath} apt-get --yes --force-yes install linux-image-$arch + + local kernel_base=linux-image + local kernel="" + + case $arch in + amd64) + kernel=${kernel_base}-amd64 + ;; + i386) + kernel=${kernel_base}-586 + ;; + *) + error "Architecture ::1 arch:: is not supported!!!" ${arch} + zerr; zshexit + ;; + esac + + notice "Installing stock kernel for ::1 arch:: (::2 kernel::)" $arch $kernel + sudo chroot ${chrootpath} apt-get --yes --force-yes install $kernel } conf_print_debconf() {