diff --git a/build/install-os-k.sh b/build/install-os-k.sh index 3522eac..3c08f2a 100755 --- a/build/install-os-k.sh +++ b/build/install-os-k.sh @@ -30,15 +30,33 @@ NC='\033[1;37m' set -e #exit if error -echo ${CL2}[install-os-k.sh]${NC} Mount image... \(udisksctl\)${CL3} -udisksctl loop-setup --offset 1048576 --no-user-interaction --file $1 -lpblock=$(/sbin/losetup -j $1 | cut -d ':' -f 1) +## Mount +echo ${CL2}[install-os-k.sh]${NC} Mount image... \(losetup\)${CL3} +lpblock=$(sudo losetup -f) +sudo losetup $lpblock $1 -o 1048576 +if [ -z $lpblock ]; +then + echo No loop device partition to target. Fatal error ! + return 13 +fi + +sudo udisksctl mount -b $lpblock --no-user-interaction + +## Sync echo ${CL2}[install-os-k.sh]${NC} Sync image... \(sync\)${CL3} sync +# Get the mountpoint mountpoint=$(udisksctl info -b $lpblock | grep MountPoint | cut -d ':' -f 2 | sed 's/ //g') +if [ -z $mountpoint ]; +then + echo Impossible to mount the image $mountpoint. Fatal error ! + return 13 +fi + + echo ${CL2}[install-os-k.sh]${NC} Copying grub.cfg cp $2 $mountpoint/boot/grub/grub.cfg echo ${CL2}[install-os-k.sh]${NC} Copying kernel