diff --git a/build.sh b/build.sh index 40cd8ef..7dda7a7 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,14 @@ default_modules="add-all-device-to-lan add-feed-key add-feed ib argon base opkg-mirror prefer-ipv6-settings statistics system tools" +LOG() { + # echo when $LOG_ENABLE is not set or set to 1 + if [ -z "$LOG_ENABLE" ] || [ "$LOG_ENABLE" == "1" ]; then + echo -e "\033[32m$1\033[0m" + fi + +} + echo "Default modules: $default_modules" final_modules=$default_modules @@ -30,12 +38,16 @@ cp -r user_modules_in_container user_modules all_packages= # system env by calling env -system_env=$(env) +system_env="" +if [ $USE_SYTEM_ENV ]; then + system_env="$(env)" +fi deal() { modules_dir=$1 for module in $final_modules; do + LOG "Processing $module in $modules_dir" if [ -f "$modules_dir/$module/packages" ]; then all_packages="$all_packages $(cat $modules_dir/$module/packages)" @@ -55,8 +67,12 @@ deal() { for file in $(find "$modules_dir/$module/files/etc/uci-defaults" -type f); do echo "$all_env" | while IFS= read -r env; do env_name="$(echo "$env" | cut -d '=' -f 1)" - env_value="${!env_name}" - sed -e "s|\$$env_name|$env_value|g" -i $file + echo "env_name: $env_name" + if [ ! -z "$env_name" ]; then + env_value="${!env_name}" + LOG "Replacing $env_name with $env_value in $file" + sed -e "s|\$$env_name|$env_value|g" -i $file + fi done done fi diff --git a/modules/add-feed-base/base.sh b/modules/add-feed-base/base.sh index 3d42509..d50c681 100755 --- a/modules/add-feed-base/base.sh +++ b/modules/add-feed-base/base.sh @@ -6,64 +6,13 @@ else fi PACKAGES_ARCH=$(cat .config | grep CONFIG_TARGET_ARCH_PACKAGES | awk -F '=' '{print $2}' | sed 's/"//g') -OPENWRT_VERSION=$(cat ./include/version.mk | grep 'VERSION_NUMBER:=$(if' | awk -F ',' '{print $3}' | awk -F ')' '{print $1}') -BIG_VERSION=$(echo $OPENWRT_VERSION | awk -F '.' '{print $1"."$2}') -echo "PACKAGES_ARCH: $PACKAGES_ARCH OPENWRT_VERSION: $OPENWRT_VERSION BIG_VERSION: $BIG_VERSION" -DISTRIB_ARCH=$PACKAGES_ARCH -DISTRIB_RELEASE=$OPENWRT_VERSION add_packages() { - echo "try add $1" - - all_supported=$(curl https://sourceforge.net/projects/ekko-openwrt-dist/files/$1/ | grep -e "