luci-app-docker:add compatibility for GPT partitions (#1777)

This commit is contained in:
Eason 2019-10-18 16:22:59 +08:00 committed by coolsnowwolf
parent 5b23cabd51
commit a249c45ff1

View File

@ -1,9 +1,26 @@
#!/bin/sh
dtype=`fdisk -l | grep 'Disklabel type' | awk '{print $3}'`
partid="0"
if [ "$dtype" = "gpt" ]
then
partid=`echo "n
echo "n
p
3
w
" | fdisk /dev/sda && mkfs.ext4 /dev/sda3
" | fdisk /dev/sda | grep 'Created a new partition' | awk '{print $5}'`
elif [ "$dtype" = "dos" ]
then
partid=`echo "n
p
w
" | fdisk /dev/sda | grep 'Created a new partition' | awk '{print $5}'`
fi
echo "y" | mkfs.ext4 /dev/sda$partid