From 5388c0f9258e6a1421ca30681a2ae4447f941279 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 6 May 2018 00:21:09 +0200 Subject: [PATCH] Cleanup file override behaviour Look for board specific product files in product/$product/$board/ Signed-off-by: David Oberhollenzer --- pkg/init/build | 3 ++ .../{dnsmasq.conf.alix => alix/dnsmasq.conf} | 0 .../interfaces}/port0 | 0 .../interfaces}/port1 | 0 .../interfaces}/port2 | 0 .../{dnsmasq.conf.rpi3 => rpi3/dnsmasq.conf} | 0 util/misc.sh | 36 +++++++++---------- 7 files changed, 19 insertions(+), 20 deletions(-) rename product/router/{dnsmasq.conf.alix => alix/dnsmasq.conf} (100%) rename product/router/{interfaces.alix => alix/interfaces}/port0 (100%) rename product/router/{interfaces.alix => alix/interfaces}/port1 (100%) rename product/router/{interfaces.alix => alix/interfaces}/port2 (100%) rename product/router/{dnsmasq.conf.rpi3 => rpi3/dnsmasq.conf} (100%) diff --git a/pkg/init/build b/pkg/init/build index fcd87fc..bec0b8a 100755 --- a/pkg/init/build +++ b/pkg/init/build @@ -34,6 +34,9 @@ deploy() { if [ -e "$SCRIPTDIR/product/$PRODUCT/INIT" ]; then source "$SCRIPTDIR/product/$PRODUCT/INIT" fi + if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/INIT" ]; then + source "$SCRIPTDIR/product/$PRODUCT/$BOARD/INIT" + fi if [ "x$HWCLOCK" == "xyes" ]; then ln -s "/share/init/hwclock" "$DEPLOY/etc/init.d/hwclock" diff --git a/product/router/dnsmasq.conf.alix b/product/router/alix/dnsmasq.conf similarity index 100% rename from product/router/dnsmasq.conf.alix rename to product/router/alix/dnsmasq.conf diff --git a/product/router/interfaces.alix/port0 b/product/router/alix/interfaces/port0 similarity index 100% rename from product/router/interfaces.alix/port0 rename to product/router/alix/interfaces/port0 diff --git a/product/router/interfaces.alix/port1 b/product/router/alix/interfaces/port1 similarity index 100% rename from product/router/interfaces.alix/port1 rename to product/router/alix/interfaces/port1 diff --git a/product/router/interfaces.alix/port2 b/product/router/alix/interfaces/port2 similarity index 100% rename from product/router/interfaces.alix/port2 rename to product/router/alix/interfaces/port2 diff --git a/product/router/dnsmasq.conf.rpi3 b/product/router/rpi3/dnsmasq.conf similarity index 100% rename from product/router/dnsmasq.conf.rpi3 rename to product/router/rpi3/dnsmasq.conf diff --git a/util/misc.sh b/util/misc.sh index 7967061..64ec99b 100644 --- a/util/misc.sh +++ b/util/misc.sh @@ -1,20 +1,18 @@ file_path_override() { - local fname="$1" - - if [ -e "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}" ]; then - echo "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}" + if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then + echo "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" return fi - if [ -e "$SCRIPTDIR/product/$PRODUCT/$fname" ]; then - echo "$SCRIPTDIR/product/$PRODUCT/$fname" + if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then + echo "$SCRIPTDIR/product/$PRODUCT/$1" return fi - if [ -e "$SCRIPTDIR/board/$BOARD/$fname" ]; then - echo "$SCRIPTDIR/board/$BOARD/$fname" + if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then + echo "$SCRIPTDIR/board/$BOARD/$1" return fi - if [ -e "$SCRIPTDIR/product/common/$fname" ]; then - echo "$SCRIPTDIR/product/common/$fname" + if [ -e "$SCRIPTDIR/product/common/$1" ]; then + echo "$SCRIPTDIR/product/common/$1" return fi } @@ -28,19 +26,17 @@ cat_file_override() { } cat_file_merge() { - local fname="$1" - - if [ -e "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}" ]; then - cat "$SCRIPTDIR/product/$PRODUCT/${fname}.${BOARD}" + if [ -e "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" ]; then + cat "$SCRIPTDIR/product/$PRODUCT/$BOARD/$1" fi - if [ -e "$SCRIPTDIR/product/$PRODUCT/$fname" ]; then - cat "$SCRIPTDIR/product/$PRODUCT/$fname" + if [ -e "$SCRIPTDIR/product/$PRODUCT/$1" ]; then + cat "$SCRIPTDIR/product/$PRODUCT/$1" fi - if [ -e "$SCRIPTDIR/board/$BOARD/$fname" ]; then - cat "$SCRIPTDIR/board/$BOARD/$fname" + if [ -e "$SCRIPTDIR/board/$BOARD/$1" ]; then + cat "$SCRIPTDIR/board/$BOARD/$1" fi - if [ -e "$SCRIPTDIR/product/common/$fname" ]; then - cat "$SCRIPTDIR/product/common/$fname" + if [ -e "$SCRIPTDIR/product/common/$1" ]; then + cat "$SCRIPTDIR/product/common/$1" fi }