added stuff in customise
This commit is contained in:
parent
510875218b
commit
ad29e93415
|
|
@ -30,6 +30,7 @@ install_default_kernel(){
|
||||||
reqck || return 1
|
reqck || return 1
|
||||||
|
|
||||||
local kernel_base=linux-image
|
local kernel_base=linux-image
|
||||||
|
local kernel=""
|
||||||
|
|
||||||
case $arch in
|
case $arch in
|
||||||
amd64)
|
amd64)
|
||||||
|
|
@ -39,35 +40,81 @@ install_default_kernel(){
|
||||||
kernel=${kernel_base}-586
|
kernel=${kernel_base}-586
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error "Architecture ::1 is not supported!!!" ${arch}
|
error "Architecture ::1 arch:: is not supported!!!" ${arch}
|
||||||
|
zerr; zshexit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
notice "Installing stock kernel for ::1 arch:: (::2 kernel::)" $arch $kernel
|
||||||
|
|
||||||
|
|
||||||
mountdevprocsys ${root}
|
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}
|
umountdevprocsys ${root}
|
||||||
notice "default kernel installed"
|
notice "default kernel installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
make_qemu_img(){
|
make_qemu_img(){
|
||||||
|
|
||||||
fn make_qemu_img $@
|
fn make_qemu_img $@
|
||||||
local imgfile=$1
|
local imgfile=$1
|
||||||
local imgsize=${2:-4G}
|
local imgsize=${2:-4G}
|
||||||
local imgformat=${3:-qcow2}
|
local imgformat=${3:-raw}
|
||||||
req=(strapdir os release version arch imgfile imgsize)
|
req=(strapdir os release version arch imgfile imgsize)
|
||||||
root=$strapdir
|
root=$strapdir
|
||||||
reqck || return 1
|
reqck || return 1
|
||||||
|
|
||||||
|
local blockskip=2050
|
||||||
|
|
||||||
check_executable qemu-img || error "Could not find qemu-img!!!" && return 1
|
## create the qemu image
|
||||||
|
act "creating qemu image"
|
||||||
|
|
||||||
qemu-img create -f ${imgformat} ${imgfile} ${imgsize}
|
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
|
if [[ ! -z ${imgfile} ]]; then
|
||||||
notice "QEMU image created in ::1" ${imgfile}
|
notice "QEMU image created in ::1 imgfile::" ${imgfile}
|
||||||
else
|
else
|
||||||
warning "Unable to create QEMU image file in ::1" ${imgfile}
|
warning "Unable to create QEMU image file in ::1 imgfile::" ${imgfile}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -179,7 +179,7 @@ check_executable() {
|
||||||
fn check_executable $@
|
fn check_executable $@
|
||||||
progname=$1
|
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;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,11 @@ vars+=(imgname imgpath)
|
||||||
|
|
||||||
img_mkimage() {
|
img_mkimage() {
|
||||||
fn img_mkimage $@
|
fn img_mkimage $@
|
||||||
imgpath=${strapdir}.img
|
imgpath=${1:-${strapdir}.img}
|
||||||
local mbrtype="$1"
|
local mbrtype="$2"
|
||||||
local bootfstype="$2"
|
local bootfstype="$3"
|
||||||
local rootfstype="$3"
|
local rootfstype="$4"
|
||||||
|
local imgsize=${5:-$imgsize}
|
||||||
req=(imgpath imgsize mbrtype bootfstype rootfstype)
|
req=(imgpath imgsize mbrtype bootfstype rootfstype)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,24 @@ conf_install_kernel() {
|
||||||
req=(arch chrootpath)
|
req=(arch chrootpath)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
notice "Installing stock kernel (linux-image-$arch)"
|
local kernel_base=linux-image
|
||||||
sudo chroot ${chrootpath} apt-get --yes --force-yes install linux-image-$arch
|
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() {
|
conf_print_debconf() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue