fix script

This commit is contained in:
oiseauroch 2022-11-29 15:00:52 +01:00
parent 279b0a6e4b
commit e9dff464cd

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [ "$VIRTUALISATION" = "true" ] if [ "$VIRTUALISATION" = "true" ]
then then
final_path=__FINALPATH__ datadir=__DATADIR__
format=$1 format=$1
i=0 i=0
while $(fdisk -l /dev/nbd$i 1&>2 /dev/null) while $(fdisk -l /dev/nbd$i 1&>2 /dev/null)
@ -10,10 +10,11 @@ then
done done
echo $i echo $i
modprobe nbd max_part=$(( i + 1 )) modprobe nbd max_part=$(( i + 1 ))
qemu-nbd --connect /dev/nbd$i $final_path/garage_data.qcow2 qemu-nbd --connect /dev/nbd$i $datadir/garage_data.qcow2
if [[ "$format" = "true" ]] if [[ "$format" = "true" ]]
then then
mkfs.ext4 /dev/nbd$i > /dev/null mkfs.ext4 /dev/nbd$i > /dev/null
fi fi
mkdir -p $datadir/data
mount /dev/nbd$i $datadir/data/ mount /dev/nbd$i $datadir/data/
fi fi