Skip to content

Commit

Permalink
Support set mirror domain
Browse files Browse the repository at this point in the history
  • Loading branch information
EkkoG committed Mar 27, 2024
1 parent d703d7b commit facfb3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/ib/post-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ for config in $(printenv | grep '^CONFIG_'); do
done

if [ $USE_MIRROR = '1' ]; then
sed -i 's/https:\/\/downloads.'"$PROJECT_NAME"'.org/https:\/\/mirrors.pku.edu.cn\/'"$PROJECT_NAME"'/g' ./repositories.conf
sed -i 's/https:\/\/downloads.'"$PROJECT_NAME"'.org/https:\/\/'"$MIRROR"'\/'"$PROJECT_NAME"'/g' ./repositories.conf
fi
9 changes: 9 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function usage()
echo "--with-pull: pull image before build"
echo "--rm-first: remove container before build"
echo "--use-mirror: use mirror"
echo "--mirror: specify mirror url, like mirrors.jlu.edu.cn, do not add http:// or https://"
echo "-h|--help: print this help"
exit 1
}
Expand All @@ -33,6 +34,9 @@ while [ "$1" != "" ]; do
--use-mirror)
USE_MIRROR=$VALUE
;;
--mirror)
MIRROR=$VALUE
;;
--profile)
PROFILE=$VALUE
;;
Expand Down Expand Up @@ -61,6 +65,10 @@ if [ -z "$USE_MIRROR" ]; then
USE_MIRROR=1
fi

if [ -z "$MIRROR" ]; then
MIRROR="mirrors.pku.edu.cn"
fi

echo "IMAGEBUILDER_IMAGE: $IMAGEBUILDER_IMAGE PROFILE: $PROFILE"

if [[ $IMAGEBUILDER_IMAGE =~ "immortalwrt" ]]; then
Expand All @@ -77,6 +85,7 @@ services:
environment:
- PROFILE=$PROFILE
- USE_MIRROR=$USE_MIRROR
- MIRROR=$MIRROR
env_file:
- ./.env
volumes:
Expand Down

0 comments on commit facfb3f

Please sign in to comment.