@@ -654,6 +654,18 @@ TMPDIR=/root/kexec setsid --wait ${maybeSudo} /root/kexec/kexec/run --kexec-extr
654
654
local localUploadCommand=()
655
655
local remoteUploadCommand=()
656
656
657
+ # gnu tar cannot automatically detect the compression when decompressing via stdin
658
+ tarDecomp=" "
659
+ if [[ ${kexecUrl} =~ \. tar\. gz$ ]]; then
660
+ tarDecomp=" --gzip"
661
+ elif [[ ${kexecUrl} =~ \. tar\. xz$ ]]; then
662
+ tarDecomp=" --xz"
663
+ elif [[ ${kexecUrl} =~ \. tar\. zstd$ ]]; then
664
+ tarDecomp=" --zstd"
665
+ elif [[ ${kexecUrl} =~ \. tar$ ]]; then
666
+ tarDecomp=" "
667
+ fi
668
+
657
669
if [[ -f $kexecUrl ]]; then
658
670
localUploadCommand=(cat " $kexecUrl " )
659
671
elif [[ $hasWget == " y" ]]; then
@@ -669,14 +681,14 @@ TMPDIR=/root/kexec setsid --wait ${maybeSudo} /root/kexec/kexec/run --kexec-extr
669
681
local remoteCommands
670
682
if [[ ${# localUploadCommand[@]} -eq 0 ]]; then
671
683
# Use remote command for download and execution
672
- tarCommand=" $( printf ' %q ' " ${remoteUploadCommand[@]} " ) | ${maybeSudo} tar -C /root/kexec -xvzf- "
684
+ tarCommand=" $( printf ' %q ' " ${remoteUploadCommand[@]} " ) | ${maybeSudo} tar -C /root/kexec -xv ${tarDecomp} "
673
685
674
686
remoteCommands=${remoteCommandTemplate// ' %TAR_COMMAND%' / $tarCommand }
675
687
676
688
runSsh sh -c " $( printf ' %q' " $remoteCommands " ) "
677
689
else
678
690
# Use local command with pipe to remote
679
- tarCommand=" ${maybeSudo} tar -C /root/kexec -xvzf- "
691
+ tarCommand=" ${maybeSudo} tar -C /root/kexec -xv ${tarDecomp} "
680
692
remoteCommands=${remoteCommandTemplate// ' %TAR_COMMAND%' / $tarCommand }
681
693
682
694
" ${localUploadCommand[@]} " | runSsh sh -c " $( printf ' %q' " $remoteCommands " ) "
0 commit comments