Quantcast
Channel: Active questions tagged clonezilla - Super User
Viewing all articles
Browse latest Browse all 61

How to get Variable from bash script to ocs_prerun Clonezilla options?

$
0
0

I don't see much in the way of Clonezilla questions, and have spent hours googling - nothing seems to answer my question - several SourceForge articles come close, but then the "answer" is found and the OP trails off and nothing's posted revealing the magic secret.

Plainly stated - I'm trying to get a bash script ran in Clonezilla to populate the next ocs_prerun option listed.

Consider the following bash script:

#!/bin/bashdriveLet=cdriveNum=3echo drive Number is $driveNumecho drive Letter is $driveLetexport driveNumexport driveLet

I get the output of

drive Number is 3drive Letter is c

But then in my ocs_prerun2 parameter, the values aren't posted when it runs, and it tries to simply mount /dev/sd into the images folder. If I manually supply 'c' and '3' appropriately, it works fine. The bash script I'm actually using is determining which disks and drives are currently installed to the PC, including the Clonezilla Drive, and mapping the appropriate repository since this can change depending on my use case. I've tried directly casting the variables as shown in my example and cannot get anything to stick. What am I missing?

I've also tried placing the entire mount portion inside the bash script as well and it still fails to find the image appropriately.

Clonezilla Live version 2.4.7-8

  menuentry "Image Menu Title Here"{  search --set -f /live/vmlinuz  linux /live/vmlinuz boot=live  ocs_prerun="sudo mkdir /images" ocs_prerun1="bash /lib/live/mount/medium/live/conf_driveNum.sh" ocs_prerun2="sudo mount /dev/sd${driveLet}${driveNum} /images" ocs_prerun3="sudo mount --bind /images /home/partimag/" ocs_prerun4="echo ImageNameHere >>/home/partimag/ImageUsage.txt" union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid noeject locales=en_US.UTF-8 keyboard-layouts=none ocs_live_run="ocs-live-restore" ocs_live_extra_param="--batch -g auto -e1 auto -e2 -r -j2 -p poweroff restoredisk ImageNameHere sda sdb" ocs_live_batch=yes vga=788 ip= net.ifnames=0  nosplash   initrd /live/initrd.img}

Viewing all articles
Browse latest Browse all 61

Trending Articles