You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
828 B
29 lines
828 B
#!/bin/bash
|
|
|
|
# Dumps all the filenames on the container.
|
|
# By default, run this on the root directory of the container.
|
|
# This tool does NOT assume that the root directory is "/"
|
|
# to allow access to sandbox _outside_ the container itself.
|
|
# All external mount points are ignored.
|
|
|
|
_simg_list_all_files () {
|
|
local ROOT_DIR="${1:-.}"
|
|
|
|
find "$ROOT_DIR" -mount \
|
|
| sort \
|
|
| awk -v ROOT="$ROOT_DIR" '
|
|
BEGIN {
|
|
ROOTX = ROOT
|
|
gsub(/\/+$/, "", ROOTX)
|
|
ROOTX = (ROOTX "/")
|
|
len_ROOTX = length(ROOTX)
|
|
}
|
|
$0 == ROOT { next }
|
|
(substr($0, 1, len_ROOTX) == ROOTX) {
|
|
print(substr($0, len_ROOTX))
|
|
next
|
|
}
|
|
'
|
|
}
|
|
|
|
_simg_list_all_files "$@"
|
|
|