File: exercise

package info (click to toggle)
squashfuse 0.5.2-0.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 644 kB
  • sloc: ansic: 5,018; sh: 335; makefile: 130
file content (27 lines) | stat: -rwxr-xr-x 539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
set -eu

# Setup the environment
TEMP=$(mktemp -d)
mkdir "${TEMP}/orig" "${TEMP}/mnt"

cleanup() {
    set +e
    fusermount3 -u "${TEMP}/mnt"
    rm -Rf "${TEMP}"
}

trap cleanup EXIT HUP INT TERM

# Create a minimal test tree
mkdir "${TEMP}/orig/dir"
echo blah > "${TEMP}/orig/dir/file"

# Create a squashfs
mksquashfs "${TEMP}/orig/" "${TEMP}/out.squashfs" -no-progress >/dev/null

# Mount the squashfs
mount -t fuse.squashfuse "${TEMP}/out.squashfs" "${TEMP}/mnt/"

# Diff the trees
diff -Nrup "${TEMP}/orig/" "${TEMP}/mnt/"