The synology ipkg installer bootstraps with a file, with name ending .xsh
. How can I see what is inside such file?

- 27,993

- 137
1 Answers
These are "self-extracting" archives; the first one I found has this code at the top:
#!/bin/sh
echo "Optware Bootstrap for syno-i686."
echo "Extracting archive... please wait"
dd if=$0 bs=205 skip=1 | tar xzv
cd bootstrap && sh bootstrap.sh && cd .. && rm -r bootstrap
exec /bin/sh --login
... which indicates that it's basically a (large) shell script, where the interesting part is the dd ... | tar xzv
line; the other lines are specific to that particular package.
The dd
command reads from $0
-- the current file -- skipping past the correct number of bytes; that output is then sent to tar
who's expecting a compressed archive. A compressed tar file has been inserted exactly at that position in the xsh file.
To view/extract it yourself, just follow the same instructions -- which will vary per xsh file! -- namely:
$ dd if=syno-i686-bootstrap_1.2-7_i686.xsh bs=205 skip=1 > bootstrap.tgz
$ gunzip bootstrap.tgz ## for example
$ tar tf bootstrap.tar ## for example
bootstrap/
bootstrap/bootstrap.sh
bootstrap/ipkg-opt.ipk
bootstrap/ipkg.sh
...
As a slightly more general rule for extracting the archives, you could look for that dd
signature, telling grep
that it's OK to output the match in this "binary" file:
$ grep -a '^dd if=$0' syno-i686-bootstrap_1.2-7_i686.xsh
dd if=$0 bs=205 skip=1 | tar xzv
... which you can then copy/paste to view or extract the contents as you like. You may also be interested in the other commands being executed; view those similarly, with -- again, specific to this example:
$ dd if=syno-i686-bootstrap_1.2-7_i686.xsh bs=205 count=1
#!/bin/sh
echo "Optware Bootstrap for syno-i686."
echo "Extracting archive... please wait"
dd if=$0 bs=205 skip=1 | tar xzv
cd bootstrap && sh bootstrap.sh && cd .. && rm -r bootstrap
exec /bin/sh --login
1+0 records in
1+0 records out
205 bytes (205 B) copied, 4.7985e-05 s, 4.3 MB/s

- 67,283
- 35
- 116
- 255