added stuff in customise
This commit is contained in:
parent
510875218b
commit
ad29e93415
|
|
@ -30,6 +30,7 @@ install_default_kernel(){
|
|||
reqck || return 1
|
||||
|
||||
local kernel_base=linux-image
|
||||
local kernel=""
|
||||
|
||||
case $arch in
|
||||
amd64)
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue