Skip to content

Commit

Permalink
Refine module mount and key add
Browse files Browse the repository at this point in the history
  • Loading branch information
EkkoG committed Oct 22, 2023
1 parent d776ee7 commit 4118edd
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 35 deletions.
24 changes: 12 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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)"
Expand All @@ -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

Expand Down
2 changes: 2 additions & 0 deletions modules/add-feed-base/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
2 changes: 0 additions & 2 deletions modules/add-feed/files/etc/opkg/keys/cd5844109a8e9dda

This file was deleted.

8 changes: 2 additions & 6 deletions modules/add-feed/post-files.sh
Original file line number Diff line number Diff line change
@@ -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
add_packages "packages"
2 changes: 0 additions & 2 deletions modules/daed/files/etc/opkg/keys/cd5844109a8e9dda

This file was deleted.

7 changes: 2 additions & 5 deletions modules/daed/post-files.sh
Original file line number Diff line number Diff line change
@@ -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
add_geodata "geodata/Loyalsoldier"
2 changes: 0 additions & 2 deletions modules/openclash/files/etc/opkg/keys/cd5844109a8e9dda

This file was deleted.

7 changes: 2 additions & 5 deletions modules/openclash/post-files.sh
Original file line number Diff line number Diff line change
@@ -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
add_packages "clash"
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4118edd

Please sign in to comment.