summaryrefslogtreecommitdiffstats
path: root/utils/nwztools/database/nvp/parse_all_nvp_nodes.sh
blob: 3e67b3d35459e92b7586d31495f33cae4a62ed03 (plain)
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
28
29
30
31
32
#!/bin/bash
# usage: parse_all_nvp_nodes /path/to/directory
#
# the expected structure is:
#   nwz-*/rootfs.tar
#   nwz-*/rootfs.tar
#
if [ "$#" -lt 1 ]; then
    >&2 echo "usage: parse_all_nvp_header.sh /path/to/directory"
    exit 1
fi

# list interesting directories
for dir in `find "$1" -maxdepth 1 -name "nw-*" -or -name "nwz-*"`
do
    # extract codename
    codename=`basename "$dir"`
    # only consider linux based targets
    if [ -e "$dir/not_linux" ]; then
        #echo "$codename: not linux based"
        continue
    fi
    # check if we can find a rootfs
    rootfs_tgz="$dir/rootfs.tgz"
    if [ ! -e "$rootfs_tgz" ]; then
        echo "$codename: no rootfs found"
        continue
    fi
    echo "$codename: found rootfs `basename $rootfs_tgz`"
    ./parse_nvp_nodes.sh "$rootfs_tgz" "nodes-$codename.txt"
done