Tip: upload base64-encoded binary files in guestfish

In guestfish ≥ 1.3.5 you can now upload arbitrary binary files from the command line, by using base64-encoding. That is to say, you can upload them using a heredoc and without needing to use a local temporary file as you had to before:

><fs> base64-in -<<EOF /binfile
f0VMRgEBAQAAAAAAAAAAAAIAAwABAAAAgIIECDQAAAAcBwAAAAAAADQAIAAHACgAGgAZAAYAAAA0
AAAANIAECDSABAjgAAAA4AAAAAUAAAAEAAAAAwAAABQBAAAUgQQIFIEECBMAAAATAAAABAAAAAEA
AAABAAAAAAAAAACABAgAgAQIRAQAAEQEAAAFAAAAABAAAAEAAABEBAAARJQECESUBAj4AAAAAAEA
[.....]
AAAAPAUAABQBAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAFAGAADLAAAAAAAAAAAA
AAABAAAAAAAAAA==
EOF
><fs> file /binfile
ELF 32-bit LSB executable, Intel 80386, version
1 (SYSV), dynamically linked (uses shared libs),
for GNU/Linux 2.6.9, stripped

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s