@@ -74,40 +74,42 @@ function command_exists() {
74
74
75
75
# function copies the template yml file to the local service folder and appends to the docker-compose.yml file
76
76
function yml_builder() {
77
+
77
78
service=" services/$1 /service.yml"
78
79
79
80
[ -d ./services/ ] || mkdir ./services/
80
81
81
- if [ -d ./services/$1 ]; then
82
- # directory already exists prompt user to overwrite
83
- sevice_overwrite=$( whiptail --radiolist --title " Overwrite Option" --notags \
84
- " $1 service directory has been detected, use [SPACEBAR] to select you overwrite option" 20 78 12 \
85
- " none" " Do not overwrite" " ON" \
86
- " env" " Preserve Environment and Config files" " OFF" \
87
- " full" " Pull full service from template" " OFF" \
88
- 3>&1 1>&2 2>&3 )
89
-
90
- case $sevice_overwrite in
82
+ if [ -d ./services/$1 ]; then
83
+ # directory already exists prompt user to overwrite
84
+ sevice_overwrite=$( whiptail --radiolist --title " Overwrite Option" --notags \
85
+ " $1 service directory has been detected, use [SPACEBAR] to select you overwrite option" 20 78 12 \
86
+ " none" " Do not overwrite" " ON" \
87
+ " env" " Preserve Environment and Config files" " OFF" \
88
+ " full" " Pull full service from template" " OFF" \
89
+ 3>&1 1>&2 2>&3 )
90
+
91
+ case $sevice_overwrite in
92
+
93
+ " full" )
94
+ echo " ...pulled full $1 from template"
95
+ rsync -a -q .templates/$1 / services/$1 / --exclude ' build.sh'
96
+ ;;
97
+ " env" )
98
+ echo " ...pulled $1 excluding env file"
99
+ rsync -a -q .templates/$1 / services/$1 / --exclude ' build.sh' --exclude ' $1.env' --exclude ' *.conf'
100
+ ;;
101
+ " none" )
102
+ echo " ...$1 service not overwritten"
103
+ ;;
104
+
105
+ esac
91
106
92
- " full" )
107
+ else
108
+ mkdir ./services/$1
93
109
echo " ...pulled full $1 from template"
94
110
rsync -a -q .templates/$1 / services/$1 / --exclude ' build.sh'
95
- ;;
96
- " env" )
97
- echo " ...pulled $1 excluding env file"
98
- rsync -a -q .templates/$1 / services/$1 / --exclude ' build.sh' --exclude ' $1.env' --exclude ' *.conf'
99
- ;;
100
- " none" )
101
- echo " ...$1 service not overwritten"
102
- ;;
103
-
104
- esac
111
+ fi
105
112
106
- else
107
- mkdir ./services/$1
108
- echo " ...pulled full $1 from template"
109
- rsync -a -q .templates/$1 / services/$1 / --exclude ' build.sh'
110
- fi
111
113
112
114
# if an env file exists check for timezone
113
115
[ -f " ./services/$1 /$1 .env" ] && timezones ./services/$1 /$1 .env
@@ -245,9 +247,21 @@ case $mainmenu_selection in
245
247
echo " $container " >> ./services/selection.txt
246
248
done
247
249
250
+ # add custom containers
251
+ if [ -f ./services/custom.txt ]; then
252
+ if (whiptail --title " Custom Container detected" --yesno " custom.txt has been detected do you want to add these containers to the stack?" 20 78); then
253
+ mapfile -t containers <<< $( cat ./services/custom.txt)
254
+ for container in " ${containers[@]} " ; do
255
+ echo " Adding $container container"
256
+ yml_builder " $container "
257
+ done
258
+ fi
259
+ fi
260
+
248
261
echo " docker-compose successfully created"
249
262
echo " run 'docker-compose up -d' to start the stack"
250
263
else
264
+
251
265
echo " Build cancelled"
252
266
253
267
fi
0 commit comments