1
1
#!/usr/bin/with-contenv bash
2
2
3
+ IFS="|" read -r -a CLI_OPTIONS <<< "$CLI_OPTIONS_STRING"
4
+
3
5
cd / || exit 1
4
6
5
7
# halt startup if no config file is found
6
8
if [[ -n ${PMM_CONFIG} ]]; then
7
9
CONFIG_FILE=${PMM_CONFIG}
8
- elif echo "${CLI_OPTIONS}" | grep -qPo '([\s]|^)(--config|-c)([\s])(.+\/[^\/]+)\.(yml|yaml)'; then
9
- CONFIG_FILE=$(echo "${CLI_OPTIONS}" | grep -Po '([\s]|^)(--config|-c)([\s])\K(.+\/[^\/]+)\.(yml|yaml)')
10
+ elif echo "${CLI_OPTIONS[@] }" | grep -qPo '([\s]|^)(--config|-c)([\s])(.+\/[^\/]+)\.(yml|yaml)'; then
11
+ CONFIG_FILE=$(echo "${CLI_OPTIONS[@] }" | grep -Po '([\s]|^)(--config|-c)([\s])\K(.+\/[^\/]+)\.(yml|yaml)')
10
12
else
11
13
CONFIG_FILE="/config/config.yml"
12
14
fi
@@ -16,16 +18,16 @@ if [[ -n "${CONFIG_FILE}" ]] && [[ ! -e "${CONFIG_FILE}" ]]; then
16
18
s6-rc -bad change
17
19
fi
18
20
19
- if { echo "${CLI_OPTIONS}" | grep -qPo '([\s]|^)(--time|-t)([\s])'; } && { echo "${CLI_OPTIONS}" | grep -qPo '([\s]|^)(--config|-c)([\s])(.+\/[^\/]+)\.(yml|yaml)'; }; then
21
+ if { echo "${CLI_OPTIONS[@] }" | grep -qPo '([\s]|^)(--time|-t)([\s])'; } && { echo "${CLI_OPTIONS[@] }" | grep -qPo '([\s]|^)(--config|-c)([\s])(.+\/[^\/]+)\.(yml|yaml)'; }; then
20
22
exec \
21
- s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py ${CLI_OPTIONS}
22
- elif echo "${CLI_OPTIONS}" | grep -qPo '([\s]|^)(--time|-t)([\s])'; then
23
+ s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py " ${CLI_OPTIONS[@]}"
24
+ elif echo "${CLI_OPTIONS[@] }" | grep -qPo '([\s]|^)(--time|-t)([\s])'; then
23
25
exec \
24
- s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" ${CLI_OPTIONS}
25
- elif echo "${CLI_OPTIONS}" | grep -qPo '([\s]|^)(--config|-c)([\s])(.+\/[^\/]+)\.(yml|yaml)'; then
26
+ s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" " ${CLI_OPTIONS[@]}"
27
+ elif echo "${CLI_OPTIONS[@] }" | grep -qPo '([\s]|^)(--config|-c)([\s])(.+\/[^\/]+)\.(yml|yaml)'; then
26
28
exec \
27
- s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --time "${PMM_TIME:-03:00}" ${CLI_OPTIONS}
29
+ s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --time "${PMM_TIME:-03:00}" " ${CLI_OPTIONS[@]}"
28
30
else
29
31
exec \
30
- s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" --time "${PMM_TIME:-03:00}" ${CLI_OPTIONS}
32
+ s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" --time "${PMM_TIME:-03:00}" " ${CLI_OPTIONS[@]}"
31
33
fi
0 commit comments