0

I am trying to create a custom clonezilla installer, as a tool to refresh our standard machines from memory stick.

I can customise the start menu fine from syslinux/syslinux.cfg just fine, but I want the large memory stick to also contain the image to be restored. The image is in /lib/live/mount/medium/myImage and can be seen from the command line, but the installer seems to want to find it on /home/partimag

Is there a way to modify the ocs-live-run="ocs-sr ... " etc to point to the local path instead of having to mount /home/partimag ?

Thanks in advance - I am pulling my hair out.

script as per Michael below:

# mount the image where Clonezilla wants to find it
echo Mounting /lib/live/mount/medium/image on to /home/partimag/
mount --bind /lib/live/mount/medium/image /home/partimag/
RET=$?
if [ ${RET} -ne 0 ]
then
        echo "FAILURE: Mount failed! Image missing?"
        exit 2
fi

# now actually do the restore.
# -p true - exit with success
# -g auto - grub install in the right place
# -e* <whatever> - geometry
# -r – resize when restore done
# -j2 – clone hidden data
# -c – wait for confirm
# -p true – just exit
# -src – skip image check on restore
echo Now doing restore (disk)
ocs-sr -g auto -e1 auto -e2 -r -j2 -c -p true -scr restoredisk gen4image sda

#ocs-sr -g auto -e2 -c -r -j2 -k true restoreparts aks_user sda1

RET=$?
echo Returned $RET
if [ ${RET} -ne 0 ]
then
        echo "FAILURE: Imaging failed! Bad image? Bad drive?"
        exit 1
fi
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
David Shields
  • 181
  • 2
  • 12
  • the only other advice I can give is to run the clonezilla restore manually (in beginner mode), and grab the command line that clonezilla stores for you just to be sure you don't have a wrong parameter. – Michael Kohne Dec 10 '18 at 16:32
  • Yeah, the problem there is that I cannot see how to run it manually while also seeing the bound mount on to /home/partimag. I suppose I could fudge it and the go to command prompt to adjust. – David Shields Dec 11 '18 at 07:56

1 Answers1

2

The way I do it for custom loaders is to setup ocs_live_run="/lib/live/mount/medium/MyScript.sh" in the syslinux/syslinux.cfg

Drop MyScript.sh onto the root of the flash drive.

Drop your image into a directory named Image on the root of the flash drive.

Your script should bind mount the image directory, and then run clonezilla (snippet from one of my auto-load scripts):

# mount the image where Clonezilla wants to find it
mount --bind /lib/live/mount/medium/Image /home/partimag/
RET=$?
if [ ${RET} -ne 0 ]
then
        echo "FAILURE: Mount failed! Image missing?"
        exit 2
fi

# now actually do the restore.
# -p true - exit with success
# -g auto - grub install in the right place
# -e* <whatever> - geometry
# -r – resize when restore done
# -j2 – clone hidden data
# -c – wait for confirm
# -p true – just exit
# -src – skip image check on restore
ocs-sr -g auto -e1 auto -e2 -r -j2 -c -p true -scr restoredisk L06_05-A.14.14-img sda
RET=$?
if [ ${RET} -ne 0 ]
then
        echo "FAILURE: Imaging failed! Bad image? Bad drive?"
        exit 1
fi
Michael Kohne
  • 2,284
  • 1
  • 16
  • 29
  • from command line mount --bind above works. Scripts added to my questions above taken from yours - all looks ok to me but saying there's a problem with the last fi - personally I cant see whats wrong, but it wouldn't install the disk image. – David Shields Dec 10 '18 at 16:22
  • Ok Michael, it's all pretty much working now. The only issue remaining is how to change some of the messaging while it is in progress: I would like to change "The jobs in /etc/ocs/ocs-live.d/ are finished" to "Please wait until reboot and don't press anything"! Any idea where such messages are kept? Or shall I unsquash the filesystem and find the script ? – David Shields Dec 11 '18 at 10:32
  • @DavidShields - That I don't know. I never changed any of the messages, I just added a 'success' message at the end of the script. Anyone using it knows to wait for the success. – Michael Kohne Dec 11 '18 at 12:39
  • Need to unsquash the filesystem on stick, and change usr/sbin/ocs-live-run-menu, then resquash and put on stick. Not too hard. – David Shields Dec 12 '18 at 10:48