diff --git a/Makefile b/Makefile index ac805e9..ab68262 100644 --- a/Makefile +++ b/Makefile @@ -297,7 +297,8 @@ install: $(installdisk) $(MBRDIR)/grub.cfg $(BINDIR)/kaleid @echo ${CL2}[$@] ${CL}Success.${CL3} $(installdisk): $(BUILDDIR)/create_disk.sh - @echo ${CL2}[$@]${NC} Constructing disk image...${CL3} + @echo ${CL2}[$@]${NC} Constructing disk image $@...${CL3} + @mkdir -p $(shell dirname $@) @$(BUILDDIR)/create_disk.sh $(installdisk) @echo ${CL2}[$@]${NC} Constructing disk image...${CL3} diff --git a/build/create_disk.sh b/build/create_disk.sh index 4da1a43..3b555e5 100755 --- a/build/create_disk.sh +++ b/build/create_disk.sh @@ -45,11 +45,18 @@ echo ${CL2}[create_disk.sh]${NC} Formatting image... \(mkdosfs\)${CL3} echo ${CL2}[create_disk.sh]${NC} Mount image... \(udisksctl\)${CL3} udisksctl loop-setup --no-user-interaction --file $1 lpblock=$(/sbin/losetup -j $1 | cut -d ':' -f 1) -mountpoint=$(udisksctl info -b $lpblock | grep MountPoint | cut -d ':' -f 2 | sed 's/ //g') echo ${CL2}[create_disk.sh]${NC} Sync image... \(sync\)${CL3} sync +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}[create_disk.sh]${NC} Install grub into $lpblock as $mountpoint... \(grub-install\)${CL3} sudo grub-install --force --target=i386-pc --root-directory=$mountpoint --boot-directory=$mountpoint/boot --no-floppy --modules="part_msdos biosdisk fat multiboot configfile" $lpblock @@ -60,4 +67,4 @@ sync echo ${CL2}[create_disk.sh]${NC} Unmount image... \(udisksctl\)${CL3} udisksctl unmount --no-user-interaction -b $lpblock -echo ${CL2}[create_disk.sh]${CL} Terminated without error.${CL3} +echo ${CL2}[create_disk.sh]${CL} Terminated without error.${CL3} \ No newline at end of file diff --git a/build/install-os-k.sh b/build/install-os-k.sh index 5b283a2..952668f 100755 --- a/build/install-os-k.sh +++ b/build/install-os-k.sh @@ -33,8 +33,10 @@ set -e #exit if error echo ${CL2}[create_disk.sh]${NC} Mount image... \(udisksctl\)${CL3} udisksctl loop-setup --no-user-interaction --file $1 lpblock=$(/sbin/losetup -j $1 | cut -d ':' -f 1) -echo Block is $lpblock -#udisksctl mount --no-user-interaction -b $lpblock + +echo ${CL2}[create_disk.sh]${NC} Sync image... \(sync\)${CL3} +sync + mountpoint=$(udisksctl info -b $lpblock | grep MountPoint | cut -d ':' -f 2 | sed 's/ //g') echo ${CL2}[grub-install.sh]${NC} Copying grub.cfg