24 |
} |
} |
25 |
|
|
26 |
function getScript(){ |
function getScript(){ |
27 |
|
if [ -n "$auto" ];then return;fi |
28 |
echo 'Insert script to be executed' |
echo 'Insert script to be executed' |
29 |
echo -n '> ' |
echo -n '> ' |
30 |
read exScript |
read exScript |
152 |
} |
} |
153 |
|
|
154 |
function errorISO(){ |
function errorISO(){ |
155 |
echo " Error creating the new ISO file: /root/tmp/output.iso" |
echo " Error creating new ISO file: /root/tmp/output.iso" |
156 |
rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null |
rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null |
157 |
cleanUp |
cleanUp |
158 |
exit 1 |
exit 1 |
211 |
|
|
212 |
Usage: $(basename $0) [options] |
Usage: $(basename $0) [options] |
213 |
Available options are: |
Available options are: |
214 |
|
a run in auto mode (no confirmation, assume yes to |
215 |
|
all questions asked, no ISO burning to disk) |
216 |
s show profiles and let user select profile to use |
s show profiles and let user select profile to use |
217 |
p [number] use profile number |
p [number] use profile number |
218 |
f copy files only. Don't create ISO file and don't |
f copy files only. Don't create ISO file and don't |
323 |
profilesError=0 |
profilesError=0 |
324 |
|
|
325 |
|
|
326 |
while getopts ":sp:bfihvn:x:" Option |
while getopts ":asp:bfihvn:x:" Option |
327 |
do |
do |
328 |
case $Option in |
case $Option in |
329 |
|
a) |
330 |
|
auto=yes |
331 |
|
;; |
332 |
s) |
s) |
333 |
readConfig |
readConfig |
334 |
sourceProfiles |
sourceProfiles |
359 |
if [ $profilesExist -eq 1 ];then |
if [ $profilesExist -eq 1 ];then |
360 |
if $(isnumber "$OPTARG");then |
if $(isnumber "$OPTARG");then |
361 |
applyProfile $OPTARG |
applyProfile $OPTARG |
362 |
|
usingProfile=yes |
363 |
else |
else |
364 |
echo " Error in parameter: -p $OPTARG" |
echo " Error in parameter: -p $OPTARG" |
365 |
exit 1 |
exit 1 |
409 |
shift $(($OPTIND - 1)) |
shift $(($OPTIND - 1)) |
410 |
|
|
411 |
test "$(whoami)" = "root" || noRoot |
test "$(whoami)" = "root" || noRoot |
412 |
|
|
413 |
|
# chack auto mode |
414 |
|
if [ -n "$auto" ];then |
415 |
|
if [ -z "$usingProfile" ];then |
416 |
|
echo ' Error: Parameter -a used without -p' |
417 |
|
exit 1 |
418 |
|
fi |
419 |
|
fi |
420 |
|
|
421 |
# Check input parameters |
# Check input parameters |
422 |
checkInParms=0 |
checkInParms=0 |
423 |
checkInParms=$(( onlyBurnISO + onlyCreateISO + onlyCopyFiles + noFileCopy )) |
checkInParms=$(( onlyBurnISO + onlyCreateISO + onlyCopyFiles + noFileCopy )) |
451 |
# |
# |
452 |
# Is this correct? (y/[n]): " |
# Is this correct? (y/[n]): " |
453 |
|
|
454 |
|
if [ -n "$auto" ]; then |
455 |
|
ans=y |
456 |
|
else |
457 |
echo -n "Current settings: |
echo -n "Current settings: |
458 |
System Rescue CD: $sysCD |
System Rescue CD: $sysCD |
459 |
Clonezilla Live CD: $cloneCD |
Clonezilla Live CD: $cloneCD |
462 |
|
|
463 |
Is this correct? (y/[n]): " |
Is this correct? (y/[n]): " |
464 |
|
|
465 |
read ans |
read ans |
466 |
|
fi |
467 |
if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then |
if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then |
468 |
sysCD='' |
sysCD='' |
469 |
cloneCD='' |
cloneCD='' |
475 |
test -z "$preparerID" && getPreparer |
test -z "$preparerID" && getPreparer |
476 |
test -z "$publisher" && getPublisher |
test -z "$publisher" && getPublisher |
477 |
test -z "$volLabel" && getvolLabel |
test -z "$volLabel" && getvolLabel |
478 |
clear |
|
479 |
|
if [ -n "$auto" ]; then |
480 |
|
ans=y |
481 |
|
else |
482 |
|
clear |
483 |
echo -n "Current CD info: |
echo -n "Current CD info: |
484 |
Preparer: $preparerID |
Preparer: $preparerID |
485 |
Publisher: $publisher |
Publisher: $publisher |
486 |
Volume label: $volLabel |
Volume label: $volLabel |
487 |
|
|
488 |
Is this correct? (y/[n]): " |
Is this correct? (y/[n]): " |
489 |
read ans |
read ans |
490 |
|
fi |
491 |
if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then |
if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then |
492 |
preparerID='' |
preparerID='' |
493 |
publisher='' |
publisher='' |
634 |
cleanUp |
cleanUp |
635 |
exit 1 |
exit 1 |
636 |
} |
} |
|
fi |
|
637 |
echo 'done' |
echo 'done' |
638 |
|
fi |
639 |
# echo |
# echo |
640 |
# echo |
# echo |
641 |
# echo |
# echo |
661 |
cleanUp |
cleanUp |
662 |
fi |
fi |
663 |
echo |
echo |
664 |
echo -n "Ready to create the new ISO file. |
if [ -z "$auto" ]; then |
665 |
|
echo -n "Ready to create new ISO file. |
666 |
|
|
667 |
************************************************************************ |
************************************************************************ |
668 |
Ready to master your CD. If you want to alter any files contained |
Ready to master your CD. If you want to alter any files contained |
674 |
|
|
675 |
Press ENTER to continue... " |
Press ENTER to continue... " |
676 |
read |
read |
677 |
|
else |
678 |
|
echo "Creating new ISO file." |
679 |
|
fi |
680 |
find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';' |
find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';' |
681 |
# mkisofs -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -iso-level 3 -joliet-long -input-charset utf-8 -output-charset utf-8 -V "$volLabel" -publisher "$publisher" -p "$preparerID" /root/tmp/clonezilla-sysresccd || errorISO |
# mkisofs -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -iso-level 3 -joliet-long -input-charset utf-8 -output-charset utf-8 -V "$volLabel" -publisher "$publisher" -p "$preparerID" /root/tmp/clonezilla-sysresccd || errorISO |
682 |
mkisofs -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "$volLabel" -publisher "$publisher" -p "$preparerID" /root/tmp/clonezilla-sysresccd || errorISO |
mkisofs -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "$volLabel" -publisher "$publisher" -p "$preparerID" /root/tmp/clonezilla-sysresccd || errorISO |
691 |
echo 'done' |
echo 'done' |
692 |
fi |
fi |
693 |
|
|
694 |
|
if [ -z "$auto" ];then |
695 |
echo ' |
echo ' |
696 |
|
|
697 |
' |
' |
698 |
|
fi |
699 |
else |
else |
700 |
while [ ! -r "$outFile" ];do |
while [ ! -r "$outFile" ];do |
701 |
echo 'Insert "clonezilla-resccd" ISO file name' |
echo 'Insert "clonezilla-resccd" ISO file name' |
710 |
while [ 1 ];do |
while [ 1 ];do |
711 |
if [ "$ans" = "" ];then ans=y;fi |
if [ "$ans" = "" ];then ans=y;fi |
712 |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi |
713 |
echo -n "Do you want to burn this ISO file? ([y]/n): " |
if [ -n "$auto" ]; then |
714 |
read ans |
ans=n |
715 |
|
else |
716 |
|
echo -n "Do you want to burn this ISO file? ([y]/n): " |
717 |
|
read ans |
718 |
|
fi |
719 |
done |
done |
720 |
burnISO=0 |
burnISO=0 |
721 |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |