1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
ZyXEL_VMG8623-T50B/vmg8623_t50b_default_release/scripts_qca/genBrcmProfile.sh

39 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: genBrcmProfile.sh <input file> <output file> [sdk version]"
echo -e "\tinput file is OpenWRT configuration file in TOPDIR"
echo -e "\toutput file is Broadcom's Profile"
echo -e "\tsdk version is optional parameter, it should be '414L03' or '412L08' or others"
exit -1
fi
if [ ! -e $1 ]; then
echo "File '$1' not found!"
exit -2
fi
if [ -n "$3" ]; then
BRCM_VER=$3
else
BRCM_VER=
fi
echo -e "#\n# Automatically generated by make menuconfig + genBrcmProfile.sh : don't edit\n#\n" > $2
# 1. using 'grep' to filter the BRCM configurations which prefix is "CONFIG_BRCMSDK_"
# 2. using 'sed' to remove prefix 'CONFIG_BRCMSDK_
cat $1 | grep "CONFIG_BRCMSDK${BRCM_VER}_" | sed "s/^\# CONFIG_BRCMSDK${BRCM_VER}_/# /" | sed "s/^CONFIG_BRCMSDK${BRCM_VER}_//" >> $2
# To collect options which need to remove quotes
OPT_RM_QUOTES=`cat $1 | grep "CONFIG_BRCM${BRCM_VER}_RM_QUOTES_" | sed "s/^CONFIG_BRCM${BRCM_VER}_RM_QUOTES_//" | sed "s/=y//"`
# remove quotes
for i in $OPT_RM_QUOTES; do
#echo "search '$i'"; sed -n "/\b$i\b/p" $2
old=`sed -n "/\b$i\b/p" $2`
new=`echo $old | sed "s/\"//g"`
#echo "old=$old";echo "new=$new";echo
sed -i "s/$old/$new/g" $2
done