306
306
# 2016-05-24 sudodus mkusb version 10.6.5
307
307
# 2016-05-24 sudodus improved logic to invoke gpt_fix
308
308
# 2016-05-24 sudodus mkusb version 10.6.6
309
+ # 2016-07-21 sudodus enabled alternative without usb-pack_efi.tar.gz
310
+ # advantage: free software
311
+ # disadvantage: 32-bit version do not boot in UEFI mode
312
+ # 2016-07-21 sudodus mkusb version 11.0.0
313
+ # 2016-07-26 sudodus function get_usb_pack_efi
314
+ # 2016-07-26 sudodus mkusb version 11.0.1
309
315
310
- version=" mkusb 10.6.6 "
316
+ version=" mkusb 11.0.1 "
311
317
312
318
prgnam=" ${version% * } "
313
319
# echo "$prgnam"
@@ -594,7 +600,7 @@ errout=$(mktemp)
594
600
zerrlog=$( mktemp)
595
601
596
602
(echo " $htmlbody " ) | zenity --text-info --html --filename=/dev/stdin \
597
- --height=$(( $hadd + 120 )) --title " " --timeout 2 2>> " $errout "
603
+ --height=$(( $hadd + 120 )) --title " " --timeout 1 2>> " $errout "
598
604
599
605
exitnr=$?
600
606
grep ' The owner of' " $errout "
@@ -1555,7 +1561,7 @@ sed_mtab
1555
1561
1556
1562
if test -s " $zerrlog "
1557
1563
then
1558
- zenity --question --timeout 3 --text " Check zenity error log?" \
1564
+ zenity --question --timeout 1 --text " Check zenity error log?" \
1559
1565
--ok-label " No" --cancel-label=" Yes" 2>> " $zerrlog "
1560
1566
if [ $? -eq 1 ]
1561
1567
then
@@ -3302,7 +3308,7 @@ function grub_n_iso {
3302
3308
inst=0
3303
3309
bpsiz=128
3304
3310
3305
- select_boot_system
3311
+ # select_boot_system
3306
3312
select_partition_table
3307
3313
echo " selected target partition table: '$part_type '"
3308
3314
get_grub_pc
@@ -3335,10 +3341,10 @@ fi
3335
3341
# check if running an installed system in UEFI mode, and
3336
3342
# in that case 'upefi' (usb-pack_efi.tar.gz) cannot be used
3337
3343
3338
- if ! $biosbl
3344
+ if ! $biosbl || ! test -f " $mkusb_sdir " /usb-pack_efi.tar.gz
3339
3345
then
3340
3346
upefi=false
3341
- mess0=" The boot system must be fetched from the ISO file"
3347
+ mess0=" The boot system for UEFI must be fetched from the ISO file"
3342
3348
echo " $separator "
3343
3349
echo " $mess0 "
3344
3350
echo " $separator "
@@ -3353,7 +3359,9 @@ srclocal="${srcorig##*/}"
3353
3359
3354
3360
mount -o loop " $srclocal " " $looper " 2>&1
3355
3361
3356
- if ! test -f " $looper " /boot/grub/grub.cfg && ! $upefi
3362
+ select_boot_system " $looper "
3363
+
3364
+ if ! test -f " $looper " /boot/grub/grub.cfg && ! $upefi && ! $biosbl
3357
3365
then
3358
3366
ng1=" '.../boot/grub/grub.cfg': file not found"
3359
3367
ng2=" In an installed system in UEFI mode, mkusb needs
@@ -3367,6 +3375,9 @@ Try with an Ubuntu family *amd64* iso file."
3367
3375
rm -r " $looper " " $targ1 " " $tailfile " " $usbdata "
3368
3376
warner " $ng1 " " $ng2 "
3369
3377
exit
3378
+ elif ! test -f " $looper " /boot/grub/grub.cfg
3379
+ then
3380
+ get_usb_pack_efi
3370
3381
fi
3371
3382
3372
3383
# general grub_n_iso progress window
@@ -3428,12 +3439,12 @@ then
3428
3439
exit
3429
3440
fi
3430
3441
3431
- is_file " $mkusb_sdir " /usb-pack_efi.tar.gz
3432
- if [ $? -ne 0 ]
3433
- then
3434
- clear_grn " $pid " " $looper " " $targ1 " " $tailfile " " $usbdata "
3435
- exit
3436
- fi
3442
+ # is_file "$mkusb_sdir"/usb-pack_efi.tar.gz
3443
+ # if [ $? -ne 0 ]
3444
+ # then
3445
+ # clear_grn "$pid" "$looper" "$targ1" "$tailfile" "$usbdata"
3446
+ # exit
3447
+ # fi
3437
3448
3438
3449
source=" $srcorig "
3439
3450
3522
3533
get_percent
3523
3534
3524
3535
echo " $separator "
3525
- echo " Selected percentage of remaining space for persistence = $perc "
3536
+ echo -e " $inversvid Selected percentage of remaining space for persistence = $perc $resetvid "
3526
3537
echo " $separator "
3527
3538
persize=$(( $perc * $freesize / 100 ))
3528
3539
if [ $persize -lt 300 ]
@@ -3797,13 +3808,25 @@ echo "70
3797
3808
3798
3809
if $biosbl
3799
3810
then
3800
- if $upefi
3811
+ if $upefi && test -f " $mkusb_sdir " /usb-pack_efi.tar.gz
3801
3812
then
3802
- /bin/echo -n " UEFI Bootloader: "
3813
+ /bin/echo -ne " $inversvid UEFI Bootloader: $resetvid "
3803
3814
grub-install --force --removable --no-floppy --boot-directory=" $targ1 " /boot \
3804
3815
--efi-directory=" $targ1 " /EFI/BOOT " $2 " 2>&1
3816
+ elif ! test -f " $looper " /boot/grub/grub.cfg
3817
+ then
3818
+ /bin/echo -e " $inversvid No UEFI Bootloader available $resetvid
3819
+ mkusb needs the package 'usb-pack-efi' with the file
3820
+ 'usb-pack_efi.tar.gz' from 'ppa:mkusb/ppa' to make a
3821
+ persistent live system with this iso file boot in UEFI mode.
3822
+ You can use the following command lines in a terminal window.
3823
+
3824
+ sudo add-apt-repository ppa:mkusb/ppa
3825
+ sudo apt-get update
3826
+ sudo apt-get install usb-pack-efi
3827
+ $separator "
3805
3828
fi
3806
- /bin/echo -n " BIOS Bootloader: "
3829
+ /bin/echo -ne " $inversvid BIOS Bootloader: $resetvid "
3807
3830
grub-install --force --removable --no-floppy --boot-directory=" $targ1 " /boot " $2 " 2>&1
3808
3831
fi
3809
3832
@@ -3812,17 +3835,20 @@ echo "80
3812
3835
3813
3836
error=" "
3814
3837
3815
- if ! $upefi # start copy/extract boot files ---------------------------
3838
+ # start copy/extract boot files (not upefi) ----------------------------
3839
+
3840
+ if ! $upefi && test -f " $looper " /boot/grub/grub.cfg
3816
3841
then
3817
3842
3818
3843
# copy the boot files from the iso file
3819
3844
3820
- echo " copy the boot files from the iso file"
3845
+ /bin/ echo -e " $inversvid 64-bit bootloader: copy the boot files from the iso file $resetvid "
3821
3846
echo " looper=$looper "
3822
3847
echo " targ1=$targ1 "
3823
3848
3824
3849
sudo rsync -Ha --exclude=filesystem.squashfs " $looper /" " $targ1 "
3825
- echo " rsync: symlink errors are *expected* because of the target file system"
3850
+ /bin/echo -e " rsync:$inversvid don't worry, $resetvid symlink errors are *expected*
3851
+ because of the target file system."
3826
3852
3827
3853
is_file " $targ1 " /boot/grub/grub.cfg
3828
3854
if [ $? -ne 0 ]
@@ -3849,15 +3875,18 @@ then
3849
3875
fi
3850
3876
rm " $targ1 " /boot/grub/grub.cfg0
3851
3877
3852
- else # ... copy/extract boot files ------- ----------------------------
3878
+ else # ... copy/extract boot files (upefi) ----------------------------
3853
3879
3854
3880
# extract files originally from Andre's zip-file (except grub.cfg grub4dos/ ini/)
3855
3881
3856
- echo " using usb-pack_efi.tar.gz"
3857
- tar -xvzf " $mkusb_sdir " /usb-pack_efi.tar.gz --directory " $targ1 "
3858
- if [ $? -ne 0 ]
3882
+ if test -f " $mkusb_sdir " /usb-pack_efi.tar.gz
3859
3883
then
3860
- error=" - tar: extracting usb-pack_efi"
3884
+ echo " using usb-pack_efi.tar.gz"
3885
+ tar -xvzf " $mkusb_sdir " /usb-pack_efi.tar.gz --directory " $targ1 "
3886
+ if [ $? -ne 0 ]
3887
+ then
3888
+ error=" - tar: extracting usb-pack_efi"
3889
+ fi
3861
3890
fi
3862
3891
3863
3892
# tweak grub.cfg
@@ -3895,7 +3924,7 @@ then
3895
3924
error=" $error - sed: appending grub.cfg"
3896
3925
fi
3897
3926
3898
- fi # end copy/extract boot files -------------------------------------
3927
+ fi # end copy/extract boot files --------------------------------------
3899
3928
3900
3929
# copy the script files 'backup' and 'restore'
3901
3930
@@ -4128,8 +4157,8 @@ then
4128
4157
echo " $separator "
4129
4158
mess1=" \Z4$0 \Zn\n
4130
4159
\n
4131
- might not make all systems bootable in UEFI mode using 'usb-pack_efi'
4132
- from this version. You should \Z4work in version $minrel or newer\Zn of
4160
+ might not make all systems bootable in UEFI mode from this version.
4161
+ You should \Z4work in version $minrel or newer\Zn of
4133
4162
Ubuntu or an Ubuntu flavour (Kubuntu, Lubuntu, ... Xubuntu.)"
4134
4163
echo " $mess1 " | sed -e ' s/\\Z.//g' -e ' s/\\n//g'
4135
4164
message=" $mess1 \n
@@ -4704,6 +4733,39 @@ fi
4704
4733
# #######################################################################
4705
4734
# #######################################################################
4706
4735
4736
+ function get_usb_pack_efi {
4737
+
4738
+ if ! test -f /usr/share/mkusb/usb-pack_efi.tar.gz && test -f /usr/bin/apt-get
4739
+ then
4740
+ upinst=$( apt-cache policy usb-pack-efi| grep -m1 Installed)
4741
+ if [ " ${upinst/ (none)} " != " $upinst " ]
4742
+ then
4743
+ menu_package_installer wants usb-pack-efi " useful in order to install 'persistent live'."
4744
+ elif [ " ${upinst/ Installed} " != " $upinst " ]
4745
+ then
4746
+ echo " usb-pack-efi: $upinst "
4747
+ echo " trying to reinstall usb-pack-efi ..."
4748
+ sudo apt-get install --reinstall usb-pack-efi
4749
+ echo " $separator "
4750
+ else
4751
+ echo " $separator "
4752
+ message=" mkusb will be able to create persistent live drives that work in UEFI mode
4753
+ also from 32-bit iso files, if you add ppa:mkusb/ppa and install usb-pack-efi.
4754
+ You can copy and paste the following three command lines to a terminal window.
4755
+
4756
+ sudo add-apt-repository ppa:mkusb/ppa
4757
+ sudo apt-get update
4758
+ sudo apt-get install usb-pack-efi"
4759
+ echo " $message "
4760
+ echo " $separator "
4761
+ warner " Install 'usb-pack-efi' manually" " $message "
4762
+ fi
4763
+ fi
4764
+ }
4765
+
4766
+ # #######################################################################
4767
+ # #######################################################################
4768
+
4707
4769
function menu_entry_1 {
4708
4770
4709
4771
# Usage: menu_entry_1 <input file> <output file>
@@ -4753,42 +4815,65 @@ IFS=$old_IFS # restore default field separator
4753
4815
4754
4816
function select_boot_system {
4755
4817
4756
- while [ " $ans " != " u" ] && [ " $ans " != " i" ] && [ " $ans " != " q" ]
4757
- do
4818
+ # parameter looper
4758
4819
4759
- ans=$( zenity --list --width=$(( $wadd + 540 )) --height=$(( $hadd + 240 )) \
4820
+ ans=
4821
+ # find "$looper" -name "*amd64*" | grep -a grub
4822
+ find " $looper " -name " *amd64*" | grep -a grub > /dev/null 2> /dev/null
4823
+ # ans=$?
4824
+ # echo "find "$looper" -name *amd64* | grep -a grub 2>&1 /dev/null"
4825
+ # echo "select_boot_system: ans=dollarfråga=$ans"
4826
+ # if [ $ans -eq 0 ] && test -f "$mkusb_sdir"/usb-pack_efi.tar.gz
4827
+ if [ $? -eq 0 ] && test -f " $mkusb_sdir " /usb-pack_efi.tar.gz
4828
+ then
4829
+ while [ " $ans " != " u" ] && [ " $ans " != " i" ] && [ " $ans " != " q" ]
4830
+ do
4831
+
4832
+ ans=$( zenity --list --width=$(( $wadd + 540 )) --height=$(( $hadd + 240 )) \
4760
4833
--title=" $version - select boot system" --cancel-label=" Quit" \
4761
4834
--window-icon=" /usr/share/icons/hicolor/48x48/apps/mkusb.png" \
4762
4835
--text=" Select preferred boot system from 'usb-pack_efi' or from 'ISO file'
4763
4836
'usb-pack_efi': does not work with secure boot
4764
4837
'ISO file': does not work with i386 iso files (32-bit systems)" \
4765
4838
--column=" Hotkey" --column=" Selection" \
4766
- u " usb-pack_efi" \
4767
4839
i " ISO file" \
4768
- q " Quit from this menu (default 'usb-pack_efi' if possible)" \
4840
+ u " usb-pack_efi" \
4841
+ q " Quit from this menu (default 'ISO file' if possible)" \
4769
4842
2>> " $zerrlog " )
4770
4843
4771
- retval=$?
4772
- if [ $retval -eq 1 ]
4773
- then
4774
- ans=$retval
4775
- fi
4776
- ans=${ans: 0: 1} # fix for buggy(?) zenity --list in trusty
4844
+ retval=$?
4845
+ if [ $retval -eq 1 ]
4846
+ then
4847
+ ans=$retval
4848
+ fi
4849
+ ans=${ans: 0: 1} # fix for buggy(?) zenity --list in trusty
4777
4850
4778
4851
# echo "ans=xxx${ans}xxx"
4779
4852
4780
- if [ " $ans " == " 1" ]
4781
- then
4782
- ans=" q"
4783
- elif [ " $ans " == " u" ]
4784
- then
4785
- upefi=true
4786
- elif [ " $ans " == " i" ]
4853
+ upefi=false
4854
+ if [ " $ans " == " 1" ]
4855
+ then
4856
+ ans=" q"
4857
+ elif [ " $ans " == " u" ]
4858
+ then
4859
+ upefi=true
4860
+ elif [ " $ans " == " i" ]
4861
+ then
4862
+ upefi=false
4863
+ fi
4864
+ done
4865
+ ans=0
4866
+
4867
+ else
4868
+ find " $looper " -name " *amd64*" | grep grub > /dev/null 2> /dev/null
4869
+ if [ $? -eq 0 ]
4787
4870
then
4788
4871
upefi=false
4872
+ else
4873
+ upefi=true
4789
4874
fi
4790
- done
4791
- ans=0
4875
+ fi
4876
+ echo " select_boot_system: [if installed, use] usb-pack_efi= $upefi "
4792
4877
}
4793
4878
4794
4879
# #######################################################################
0 commit comments