mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
tools: Add mkimage-squashfs
This utility image takes a tarball as input and places the contents into a read-only, compressed squashfs filesystem which is produced on stdout. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
11db895b65
commit
c0377bf343
12
tools/mkimage-squashfs/Dockerfile
Normal file
12
tools/mkimage-squashfs/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
FROM linuxkit/alpine:f3cd219615428b2bd943411723eb28875275fae7
|
||||
|
||||
RUN \
|
||||
apk update && apk upgrade && \
|
||||
apk add --no-cache \
|
||||
libarchive-tools \
|
||||
squashfs-tools \
|
||||
&& true
|
||||
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT [ "/make-squashfs" ]
|
1
tools/mkimage-squashfs/build.yml
Normal file
1
tools/mkimage-squashfs/build.yml
Normal file
@ -0,0 +1 @@
|
||||
image: mkimage-squashfs
|
22
tools/mkimage-squashfs/make-squashfs
Executable file
22
tools/mkimage-squashfs/make-squashfs
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p /tmp/rootfs
|
||||
cd /tmp/rootfs
|
||||
|
||||
# input is a tarball of filesystem on stdin with the root filesytem
|
||||
# output is a squashfs image on stdout
|
||||
|
||||
# extract. BSD tar auto recognises compression, unlike GNU tar
|
||||
# only if stdin is a tty, if so need files volume mounted...
|
||||
[ -t 0 ] || bsdtar xzf -
|
||||
cd /tmp
|
||||
|
||||
# we want everything except the final result to stderr
|
||||
(
|
||||
exec 1>&2;
|
||||
|
||||
mksquashfs rootfs ./rootfs.img
|
||||
)
|
||||
cat rootfs.img
|
Loading…
Reference in New Issue
Block a user