4
4
usage () {
5
5
echo " Usage: $0 [-l] [-f <ftl_branch>] [-c <core_branch>] [-w <web_branch>] [-t <tag>] [use_cache]"
6
6
echo " Options:"
7
- echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)"
8
- echo " -c, --corebranch <branch> Specify Core branch"
9
- echo " -w, --webbranch <branch> Specify Web branch"
10
- echo " -p, --paddbranch <branch> Specify PADD branch"
11
- echo " -t, --tag <tag> Specify Docker image tag (default: pihole:local)"
12
- echo " -l, --local Use locally built FTL binary (requires src/pihole-FTL file)"
13
- echo " use_cache Enable caching (by default --no-cache is used)"
7
+ echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)"
8
+ echo " -c, --corebranch <branch> Specify Core branch"
9
+ echo " -w, --webbranch <branch> Specify Web branch"
10
+ echo " -p, --paddbranch <branch> Specify PADD branch"
11
+ echo " -t, --tag <tag> Specify Docker image tag (default: pihole:local)"
12
+ echo " -l, --local Use locally built FTL binary (requires src/pihole-FTL file)"
13
+ echo " use_cache Enable caching (by default --no-cache is used)"
14
14
echo " "
15
15
echo " If no options are specified, the following command will be executed:"
16
16
echo " docker buildx build src/. --tag pihole:local --load --no-cache"
@@ -21,6 +21,9 @@ usage() {
21
21
TAG=" pihole:local"
22
22
DOCKER_BUILD_CMD=" docker buildx build src/. --tag ${TAG} --load --no-cache"
23
23
FTL_FLAG=false
24
+ CORE_FORK=" pi-hole"
25
+ WEB_FORK=" pi-hole"
26
+ PADD_FORK=" pi-hole"
24
27
25
28
# Check if buildx is installed
26
29
docker buildx version > /dev/null 2>&1
34
37
check_branch_exists () {
35
38
local repo=$1
36
39
local branch=$2
40
+ local fork=$3
37
41
local url
38
42
39
43
if [ " $repo " == " ftl" ]; then
40
44
# Special case for FTL - we check for the binary instead of just the branch - in case it is not yet built.
41
45
url=" https://ftl.pi-hole.net/${branch} /pihole-FTL-amd64"
42
46
else
43
- url=" https://github.com/pi-hole /${repo} /blob/${branch} /README.md"
47
+ url=" https://github.com/${fork} /${repo} /blob/${branch} /README.md"
44
48
fi
45
49
46
50
local http_code
@@ -83,14 +87,14 @@ while [[ $# -gt 0 ]]; do
83
87
;;
84
88
-c | --corebranch)
85
89
CORE_BRANCH=" $2 "
86
- check_branch_exists " pi-hole" " $CORE_BRANCH "
90
+ check_branch_exists " pi-hole" " $CORE_BRANCH " " $CORE_FORK "
87
91
DOCKER_BUILD_CMD+=" --build-arg CORE_BRANCH=$CORE_BRANCH "
88
92
shift
89
93
shift
90
- ;;
94
+ ;;
91
95
-w | --webbranch)
92
96
WEB_BRANCH=" $2 "
93
- check_branch_exists " web" " $WEB_BRANCH "
97
+ check_branch_exists " web" " $WEB_BRANCH " " $WEB_FORK "
94
98
DOCKER_BUILD_CMD+=" --build-arg WEB_BRANCH=$WEB_BRANCH "
95
99
shift
96
100
shift
@@ -102,6 +106,24 @@ while [[ $# -gt 0 ]]; do
102
106
shift
103
107
shift
104
108
;;
109
+ -cf | --corefork)
110
+ CORE_FORK=" $2 "
111
+ DOCKER_BUILD_CMD+=" --build-arg CORE_FORK=$CORE_FORK "
112
+ shift
113
+ shift
114
+ ;;
115
+ -wf | --webfork)
116
+ WEB_FORK=" $2 "
117
+ DOCKER_BUILD_CMD+=" --build-arg WEB_FORK=$WEB_FORK "
118
+ shift
119
+ shift
120
+ ;;
121
+ -pf | --paddfork)
122
+ PADD_FORK=" $2 "
123
+ DOCKER_BUILD_CMD+=" --build-arg PADD_FORK=$PADD_FORK "
124
+ shift
125
+ shift
126
+ ;;
105
127
-t | --tag)
106
128
CUSTOM_TAG=" $2 "
107
129
DOCKER_BUILD_CMD=${DOCKER_BUILD_CMD/ $TAG / $CUSTOM_TAG }
0 commit comments