Bug with makefile that can erase host MBR
This commit is contained in:
parent
0af726ba09
commit
04fbcf9a02
2
Makefile
2
Makefile
|
@ -328,7 +328,7 @@ dddnokvm: all installonimage
|
||||||
## HD IMAGE RELATED ---------------------------------------------------------- #
|
## HD IMAGE RELATED ---------------------------------------------------------- #
|
||||||
|
|
||||||
installonimage: $(installdisk) $(MBRDIR)/grub.cfg
|
installonimage: $(installdisk) $(MBRDIR)/grub.cfg
|
||||||
@echo ${CL2}[$@] ${NC}Installing MBR on image...${CL3}
|
@echo ${CL2}[$@] ${NC}Installing boot configuration on image...${CL3}
|
||||||
@$(BUILDDIR)/install-os-k.sh $(installdisk) $(MBRDIR)/grub.cfg $(BINDIR)/kaleid
|
@$(BUILDDIR)/install-os-k.sh $(installdisk) $(MBRDIR)/grub.cfg $(BINDIR)/kaleid
|
||||||
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
@echo ${CL2}[$@] ${CL}Success.${CL3}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ fi
|
||||||
|
|
||||||
if [ -z $lpblock ];
|
if [ -z $lpblock ];
|
||||||
then
|
then
|
||||||
echo No loop device partition to target. Fatal error !
|
Impossible to find an available loop device. Fatal error !
|
||||||
return 13
|
return 13
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -30,33 +30,27 @@ NC='\033[1;37m'
|
||||||
|
|
||||||
set -e #exit if error
|
set -e #exit if error
|
||||||
|
|
||||||
## Mount
|
echo ${CL2}[install-os-k.sh]${NC} Mount image... \(udisksctl\)${CL3}
|
||||||
echo ${CL2}[install-os-k.sh]${NC} Mount image... \(losetup\)${CL3}
|
udisksctl loop-setup --offset 1048576 --no-user-interaction --file $1
|
||||||
lpblock=$(sudo losetup -f)
|
lpblock=$(/sbin/losetup -j $1 | cut -d ':' -f 1)
|
||||||
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}
|
echo ${CL2}[install-os-k.sh]${NC} Sync image... \(sync\)${CL3}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
# Get the mountpoint
|
if [ -z $lpblock ];
|
||||||
|
then
|
||||||
|
echo Impossible to find an available loop device. Fatal error !
|
||||||
|
return 13
|
||||||
|
fi
|
||||||
|
|
||||||
mountpoint=$(udisksctl info -b $lpblock | grep MountPoint | cut -d ':' -f 2 | sed 's/ //g')
|
mountpoint=$(udisksctl info -b $lpblock | grep MountPoint | cut -d ':' -f 2 | sed 's/ //g')
|
||||||
|
|
||||||
if [ -z $mountpoint ];
|
if [ -z $mountpoint ];
|
||||||
then
|
then
|
||||||
echo Impossible to mount the image $mountpoint. Fatal error !
|
echo Impossible to mount the image at $lpblock. Fatal error !
|
||||||
return 13
|
return 13
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo ${CL2}[install-os-k.sh]${NC} Copying grub.cfg
|
echo ${CL2}[install-os-k.sh]${NC} Copying grub.cfg
|
||||||
cp $2 $mountpoint/boot/grub/grub.cfg
|
cp $2 $mountpoint/boot/grub/grub.cfg
|
||||||
echo ${CL2}[install-os-k.sh]${NC} Copying kernel
|
echo ${CL2}[install-os-k.sh]${NC} Copying kernel
|
||||||
|
|
Loading…
Reference in New Issue