diff --git a/entry.sh b/entry.sh index 05f90c4..f855dac 100755 --- a/entry.sh +++ b/entry.sh @@ -6,32 +6,15 @@ function first_stage(){ apt install debootstrap - if [[ ! -e /root/disk.img ]]; then + lsblk -fTpo NAME,FSTYPE,LABEL,UUID,FSAVAIL,MOUNTPOINT + select DEVICE in $(lsblk -frpno NAME); do + echo using $DEVICE + done - echo creating image file - dd if=/dev/zero of=/root/disk.img bs=1M count=512 - LODEV=$(losetup --show -f /root/disk.img) - ( - echo o # Create a new empty DOS partition table - echo n # Add a new partition - echo p # Primary partition - echo 1 # Partition number - echo # First sector (Accept default: 1) - echo # Last sector (Accept default: varies) - echo w # Write changes - ) | fdisk ${LODEV} - losetup -d ${LODEV} - - fi - - LODEV=$(losetup --show -fP /root/disk.img) - - echo using device $LODEV - echo mount divice to $TARGET - echo mkfs.ext4 ${LODEV}p1 - mkfs.ext4 ${LODEV}p1 - mount ${LODEV}p1 $TARGET - echo mount ${LODEV}p1 $TARGET + echo mkfs.ext4 ${DEVICE}p1 + mkfs.ext4 ${DEVICE}p1 + mount ${DEVICE}p1 $TARGET + echo mount ${DEVICE}p1 $TARGET echo debootstrap sid $TARGET debootstrap sid $TARGET @@ -40,20 +23,6 @@ function first_stage(){ function second_stage(){ echo bar second_stage + passwd + echo -n > /etc/motd } - -function test_fun(){ - #choose_one test1 | prefix_time - #sleep 1 - #block_devices | choose_one - - #echo "> "$test - choose_dialog - #sleep 1 - #choose_one | prefix_time -} - -if [ $# -eq 1 ]; then - if [ $1 = "test" ]; then - test_fun - fi -fi