* Imported tools to dump information about files in a container.
The "dump-info" tool works only for Debian-based distro for now.
This commit is contained in:
29
containers/simg-list-all-files.sh
Executable file
29
containers/simg-list-all-files.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/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 "$@"
|
||||
Reference in New Issue
Block a user