rockbox/utils/nwztools/database/nvp/parse_all_nvp_headers.sh
Amaury Pouly 063ff294a2 nwztools: add DMP-Z1 to the database
This is one of those fancy gold-plated devices. Of course it breaks my scripts
that were nicely expecting every device to start with NW.

Change-Id: I161320f620f65f4f92c2650d192b26a9831eeb9d
2019-04-22 23:45:33 +02:00

49 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# usage: parse_all_nvp_headers /path/to/directory
#
# the expected structure is:
# nwz-*/<kernel>
# nw-*/<kernel/
# where <kernel> must be of the form
# linux-kernel-*.tgz
#
function usage
{
>&2 echo "usage: parse_all_nvp_header.sh [--new-only] /path/to/directory"
exit 1
}
if [ "$#" -lt 1 ]; then
usage
fi
new_only="no"
if [ "$1" = "--new-only" ]; then
shift
new_only="yes"
fi
# list interesting directories
for dir in `find "$1" -maxdepth 1 -name "nw-*" -or -name "nwz-*" -or -name "dmp-*"`
do
# extract codename
codename=`basename "$dir"`
# only consider linux based targets
if [ -e "$dir/not_linux" ]; then
#echo "$codename: not linux based"
continue
fi
# skip if not new
if [ $new_only = "yes" ] && [ -e $codename.txt ]; then
echo "Skip $codename: already exists"
continue
fi
# check if we can find a kernel
kernel_tgz=`find "$dir" -maxdepth 1 -name "linux-kernel-*.tgz"`
if [ "$kernel_tgz" == "" ]; then
echo "$codename: no kernel found"
continue
fi
echo "$codename: found kernel `basename $kernel_tgz`"
./parse_nvp_header.sh "$kernel_tgz" > "$codename.txt"
done