@@ -671,6 +671,18 @@ TMPDIR=/root/kexec setsid --wait ${maybeSudo} /root/kexec/kexec/run --kexec-extr
671
671
local localUploadCommand=()
672
672
local remoteUploadCommand=()
673
673
674
+ # gnu tar cannot automatically detect the compression when decompressing via stdin
675
+ tarDecomp=" "
676
+ if [[ ${kexecUrl} =~ \. tar\. gz$ ]]; then
677
+ tarDecomp=" --gzip"
678
+ elif [[ ${kexecUrl} =~ \. tar\. xz$ ]]; then
679
+ tarDecomp=" --xz"
680
+ elif [[ ${kexecUrl} =~ \. tar\. zstd$ ]]; then
681
+ tarDecomp=" --zstd"
682
+ elif [[ ${kexecUrl} =~ \. tar$ ]]; then
683
+ tarDecomp=" "
684
+ fi
685
+
674
686
if [[ -f $kexecUrl ]]; then
675
687
localUploadCommand=(cat " $kexecUrl " )
676
688
elif [[ $hasWget == " y" ]]; then
@@ -686,14 +698,14 @@ TMPDIR=/root/kexec setsid --wait ${maybeSudo} /root/kexec/kexec/run --kexec-extr
686
698
local remoteCommands
687
699
if [[ ${# localUploadCommand[@]} -eq 0 ]]; then
688
700
# Use remote command for download and execution
689
- tarCommand=" $( printf ' %q ' " ${remoteUploadCommand[@]} " ) | ${maybeSudo} tar -C /root/kexec -xvzf- "
701
+ tarCommand=" $( printf ' %q ' " ${remoteUploadCommand[@]} " ) | ${maybeSudo} tar -C /root/kexec -xv ${tarDecomp} "
690
702
691
703
remoteCommands=${remoteCommandTemplate// ' %TAR_COMMAND%' / $tarCommand }
692
704
693
705
runSsh sh -c " $( printf ' %q' " $remoteCommands " ) "
694
706
else
695
707
# Use local command with pipe to remote
696
- tarCommand=" ${maybeSudo} tar -C /root/kexec -xvzf- "
708
+ tarCommand=" ${maybeSudo} tar -C /root/kexec -xv ${tarDecomp} "
697
709
remoteCommands=${remoteCommandTemplate// ' %TAR_COMMAND%' / $tarCommand }
698
710
699
711
" ${localUploadCommand[@]} " | runSsh sh -c " $( printf ' %q' " $remoteCommands " ) "
0 commit comments