This commit is contained in:
j3d1 2020-01-29 13:37:36 +01:00
parent cc3834f211
commit e95c2f2a69

View file

@ -4,24 +4,33 @@ source $(dirname $0)/utils.sh
function first_stage(){ function first_stage(){
echo foo first_stage echo foo first_stage
echo creating image file
dd if=/dev/zero of=/root/disk.img bs=1M count=512 if [[ ! -e /root/disk.img ]]; then
LODEV=$(losetup --show -f /root/disk.img)
( echo creating image file
echo o # Create a new empty DOS partition table dd if=/dev/zero of=/root/disk.img bs=1M count=512
echo n # Add a new partition LODEV=$(losetup --show -f /root/disk.img)
echo p # Primary partition (
echo 1 # Partition number echo o # Create a new empty DOS partition table
echo # First sector (Accept default: 1) echo n # Add a new partition
echo # Last sector (Accept default: varies) echo p # Primary partition
echo w # Write changes echo 1 # Partition number
) | fdisk ${LODEV} echo # First sector (Accept default: 1)
losetup -d ${LODEV} echo # Last sector (Accept default: varies)
echo w # Write changes
) | fdisk ${LODEV}
losetup -d ${LODEV}
fi
LODEV=$(losetup --show -fP /root/disk.img) LODEV=$(losetup --show -fP /root/disk.img)
echo using device $LODEV echo using device $LODEV
echo mount divice to $TARGET echo mount divice to $TARGET
mount $LODEVp1 $TARGET echo mkfs.ext4 ${LODEV}p1
mkfs.ext4 ${LODEV}p1
mount ${LODEV}p1 $TARGET
echo mount ${LODEV}p1 $TARGET
echo debootstrap sid $TARGET echo debootstrap sid $TARGET
} }