From 0a0080f991d45d4e11cfc1394974652041b13442 Mon Sep 17 00:00:00 2001 From: BigfootACA Date: Tue, 13 Jul 2021 15:43:18 +0800 Subject: [PATCH] add extract.sh Signed-off-by: BigfootACA --- .gitignore | 3 ++- extract.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 extract.sh diff --git a/.gitignore b/.gitignore index aa1dbb2..4facb32 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ ################################################################################ /.vs -/components/QC8994 \ No newline at end of file +/components/QC8994 +/output diff --git a/extract.sh b/extract.sh new file mode 100755 index 0000000..39f1e72 --- /dev/null +++ b/extract.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +if [ -z "${1}" ] +then + echo "no codename specified" >&2 + echo "Usage: ${0} " >&2 + exit 1 +fi +cd "$(dirname "$0")" +CONFIGS=definitions +DEF=sdm845-generic +CONFIG="${CONFIGS}/${1}.txt" +if ! [ -f "${CONFIG}" ] +then + echo "warning: your model has no definition file, use default" >&2 + CONFIG="${CONFIGS}/${DEF}.txt" + if ! [ -f "${CONFIG}" ] + then + echo "default definition file not found" + exit 1 + fi +fi +rm -rf ./output +while read -r line +do + file="${line//$'\r'/}" + file="${file//\\/\/}" + cp -vr ."${file}" output/ +done<"${CONFIG}" +find output -type f -name '*.inf_'|while read -r line +do mv -v "${line}" "${line//.inf_/.inf}" +done