Bash: How to extract an executable from within?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I noticed that some (older?) shell-scripts have
self-extracting executables built in and extracting
was done done by using a tail +N $0 where N is the
line number where the executable line is located to
the end of the file. Unfortunately, Fedora's tail program
does not support the +N option.

I am looking for an alternative.

I tried to wrap the executable with a function such as:

outname=selfextractExe.$$

function unWrapExe() {
cat <<'EOF'
<executable>
EOF
}

# Do pre-shell stuff

unWrapExe > $outname
./outname

# Do post-shell stuff

The problem as I see it, is somehow cat blows
up when certain characters appear in the input
stream and the output executable file becomes
corrupted cannot be executed.  I have tried
echo and I cannot think of another program to
try.

So, how does one go about fixing these sort of
problems nowadays?

Thanks!
Dan

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux