From 4118edd60d75ce068985dae932129d2a30ab347e Mon Sep 17 00:00:00 2001 From: EkkoG Date: Sun, 22 Oct 2023 08:31:44 +0800 Subject: [PATCH] Refine module mount and key add --- build.sh | 24 +++++++++---------- modules/add-feed-base/base.sh | 2 ++ .../files/etc/opkg/keys/cd5844109a8e9dda | 2 -- modules/add-feed/post-files.sh | 8 ++----- .../daed/files/etc/opkg/keys/cd5844109a8e9dda | 2 -- modules/daed/post-files.sh | 7 ++---- .../files/etc/opkg/keys/cd5844109a8e9dda | 2 -- modules/openclash/post-files.sh | 7 ++---- run.sh | 2 +- 9 files changed, 21 insertions(+), 35 deletions(-) delete mode 100644 modules/add-feed/files/etc/opkg/keys/cd5844109a8e9dda delete mode 100644 modules/daed/files/etc/opkg/keys/cd5844109a8e9dda delete mode 100644 modules/openclash/files/etc/opkg/keys/cd5844109a8e9dda diff --git a/build.sh b/build.sh index 6fbcd18..2c3d730 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -default_modules="add-feed ib argon base network opkg-mirror prefer-ipv6-settings statistics system tools" +default_modules="add-feed-key add-feed ib argon base network opkg-mirror prefer-ipv6-settings statistics system tools" echo "Default modules: $default_modules" @@ -23,18 +23,18 @@ for module in $MODULES; do done final_modules="$(echo "$final_modules" | tr '\n' ' ')" echo "Final modules: $final_modules" -cp -r modules work_modules +cp -r custom_modules modules for module in $final_modules; do - if [ -f "work_modules/$module/packages" ]; then - all_packages="$all_packages $(cat work_modules/$module/packages)" + if [ -f "modules/$module/packages" ]; then + all_packages="$all_packages $(cat modules/$module/packages)" fi - if [ -f "work_modules/$module/.env" ]; then - . work_modules/$module/.env - for file in $(find "work_modules/$module/files/etc/uci-defaults" -type f); do - all_env="$(cat work_modules/$module/.env)" + if [ -f "modules/$module/.env" ]; then + . modules/$module/.env + for file in $(find "modules/$module/files/etc/uci-defaults" -type f); do + all_env="$(cat modules/$module/.env)" for env in $all_env; do env_name="$(echo "$env" | cut -d '=' -f 1)" env_value="$(echo "$env" | cut -d '=' -f 2)" @@ -43,14 +43,14 @@ for module in $final_modules; do done fi - if [ -d "work_modules/$module/files" ]; then + if [ -d "modules/$module/files" ]; then mkdir -p files - cp -r work_modules/$module/files/** files/ + cp -r modules/$module/files/** files/ fi - if [ -f "work_modules/$module/post-files.sh" ]; then + if [ -f "modules/$module/post-files.sh" ]; then echo "Running post-files.sh for $module" - . work_modules/$module/post-files.sh + . modules/$module/post-files.sh fi done diff --git a/modules/add-feed-base/base.sh b/modules/add-feed-base/base.sh index 9eccd47..3d42509 100755 --- a/modules/add-feed-base/base.sh +++ b/modules/add-feed-base/base.sh @@ -64,6 +64,7 @@ add_packages() { fi echo "Feed version: $feed_version" EKKOG_FEED="src/gz ekkog_$1 https://ghproxy.imciel.com/https://downloads.sourceforge.net/project/ekko-openwrt-dist/$1/$feed_version" + mkdir -p files/etc/opkg/ echo "$EKKOG_FEED" >> files/etc/opkg/customfeeds.conf # 添加软件源到第一行 echo "$EKKOG_FEED" | cat - ./repositories.conf > temp && mv temp ./repositories.conf @@ -72,5 +73,6 @@ add_packages() { add_geodata() { FEED_URL="src/gz ekkog_geodata https://ghproxy.imciel.com/https://downloads.sourceforge.net/project/ekko-openwrt-dist/$1" echo "$FEED_URL" | cat - ./repositories.conf > temp && mv temp ./repositories.conf + mkdir -p files/etc/opkg/ echo "$FEED_URL" >> files/etc/opkg/customfeeds.conf } diff --git a/modules/add-feed/files/etc/opkg/keys/cd5844109a8e9dda b/modules/add-feed/files/etc/opkg/keys/cd5844109a8e9dda deleted file mode 100644 index 856d368..0000000 --- a/modules/add-feed/files/etc/opkg/keys/cd5844109a8e9dda +++ /dev/null @@ -1,2 +0,0 @@ -untrusted comment: ekkog openwrt dist sign -RWTNWEQQmo6d2m4v8HCtbcfJkfiX91+OmTVEHPu7c+oVX56FPGay5Kt+ diff --git a/modules/add-feed/post-files.sh b/modules/add-feed/post-files.sh index c1ea341..ef9901b 100755 --- a/modules/add-feed/post-files.sh +++ b/modules/add-feed/post-files.sh @@ -1,8 +1,4 @@ -. ./work_modules/add-feed-base/base.sh - -mkdir -p files/etc/opkg/ +. ./modules/add-feed-base/base.sh add_packages "luci" -add_packages "packages" - -cp files/etc/opkg/keys/* keys \ No newline at end of file +add_packages "packages" \ No newline at end of file diff --git a/modules/daed/files/etc/opkg/keys/cd5844109a8e9dda b/modules/daed/files/etc/opkg/keys/cd5844109a8e9dda deleted file mode 100644 index 856d368..0000000 --- a/modules/daed/files/etc/opkg/keys/cd5844109a8e9dda +++ /dev/null @@ -1,2 +0,0 @@ -untrusted comment: ekkog openwrt dist sign -RWTNWEQQmo6d2m4v8HCtbcfJkfiX91+OmTVEHPu7c+oVX56FPGay5Kt+ diff --git a/modules/daed/post-files.sh b/modules/daed/post-files.sh index 9772d07..f756185 100755 --- a/modules/daed/post-files.sh +++ b/modules/daed/post-files.sh @@ -1,7 +1,4 @@ -. ./work_modules/add-feed-base/base.sh +. ./modules/add-feed-base/base.sh -mkdir -p files/etc/opkg/ add_packages "dae" -add_geodata "geodata/Loyalsoldier" - -cp files/etc/opkg/keys/* keys \ No newline at end of file +add_geodata "geodata/Loyalsoldier" \ No newline at end of file diff --git a/modules/openclash/files/etc/opkg/keys/cd5844109a8e9dda b/modules/openclash/files/etc/opkg/keys/cd5844109a8e9dda deleted file mode 100644 index 856d368..0000000 --- a/modules/openclash/files/etc/opkg/keys/cd5844109a8e9dda +++ /dev/null @@ -1,2 +0,0 @@ -untrusted comment: ekkog openwrt dist sign -RWTNWEQQmo6d2m4v8HCtbcfJkfiX91+OmTVEHPu7c+oVX56FPGay5Kt+ diff --git a/modules/openclash/post-files.sh b/modules/openclash/post-files.sh index f032f53..fd5fbc9 100755 --- a/modules/openclash/post-files.sh +++ b/modules/openclash/post-files.sh @@ -1,9 +1,6 @@ mkdir -p files/etc/openclash/config wget --user-agent='clash' $CLASH_CONFIG_URL -O files/etc/openclash/config/config.yaml -. ./work_modules/add-feed-base/base.sh +. ./modules/add-feed-base/base.sh -mkdir -p files/etc/opkg/ -add_packages "clash" - -cp files/etc/opkg/keys/* keys \ No newline at end of file +add_packages "clash" \ No newline at end of file diff --git a/run.sh b/run.sh index c6f16ec..3fc89d2 100755 --- a/run.sh +++ b/run.sh @@ -82,7 +82,7 @@ services: volumes: - ./bin:$BUILD_DIR/bin - ./build.sh:$BUILD_DIR/build.sh - - ./modules:$BUILD_DIR/modules + - ./modules:$BUILD_DIR/custom_modules - ./.env:$BUILD_DIR/.env command: "./build.sh" END