Skip to content
This repository was archived by the owner on Apr 23, 2024. It is now read-only.

Commit 43117b0

Browse files
committed
Address issues arising from #5
1 parent 9a26d29 commit 43117b0

File tree

9 files changed

+71
-21
lines changed

9 files changed

+71
-21
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN \
2424
libzen-dev \
2525
python3-dev && \
2626
apk add -U --update --no-cache \
27-
curl \
27+
grep \
2828
libjpeg \
2929
libxslt \
3030
python3 \
@@ -61,3 +61,5 @@ COPY root/ /
6161

6262
# ports and volumes
6363
VOLUME /config
64+
65+
ENTRYPOINT ["/init-pmm"]

Dockerfile.aarch64

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN \
2424
libzen-dev \
2525
python3-dev && \
2626
apk add -U --update --no-cache \
27-
curl \
27+
grep \
2828
libjpeg \
2929
libxslt \
3030
python3 \
@@ -61,3 +61,5 @@ COPY root/ /
6161

6262
# ports and volumes
6363
VOLUME /config
64+
65+
ENTRYPOINT ["/init-pmm"]

Dockerfile.armhf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN \
2424
libzen-dev \
2525
python3-dev && \
2626
apk add -U --update --no-cache \
27-
curl \
27+
grep \
2828
libjpeg \
2929
libxslt \
3030
python3 \
@@ -61,3 +61,5 @@ COPY root/ /
6161

6262
# ports and volumes
6363
VOLUME /config
64+
65+
ENTRYPOINT ["/init-pmm"]

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ The architectures supported by this image are:
6060

6161
## Application Setup
6262

63-
There is a [walkthrough](https://github.com/meisnate12/Plex-Meta-Manager/wiki/Docker-Walkthrough#setting-up-the-initial-config-file) available to help get you up and running.
63+
There is a [walkthrough](https://metamanager.wiki/en/latest/home/guides/docker.html#setting-up-the-initial-config-file) available to help get you up and running.
6464

65-
This image supports all of the environment variables listed [here](https://github.com/meisnate12/Plex-Meta-Manager/wiki/Run-Commands-&-Environmental-Variables)
65+
This image supports all of the environment variables listed [here](https://metamanager.wiki/en/latest/home/environmental.html)
6666

6767
To perform a one-time run use `docker run` (or `docker-compose run`) with the `--rm` and `-e PMM_RUN=True` arguments. This will cause the container to process your config immediately instead of waiting for the scheduled time, and delete the old container after completion.
6868

69-
For more information see the [official wiki](https://github.com/meisnate12/Plex-Meta-Manager/wiki).
69+
For more information see the [official wiki](https://metamanager.wiki).
7070

7171
## Usage
7272

@@ -238,5 +238,6 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
238238

239239
## Versions
240240

241+
* **25.10.22:** - Support commandline args and relative paths.
241242
* **03.10.22:** - Rebase to Alpine 3.16, migrate to s6v3.
242243
* **30.01.22:** - Initial Release.

readme-vars.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ optional_block_1: false
4848
# application setup block
4949
app_setup_block_enabled: true
5050
app_setup_block: |
51-
There is a [walkthrough](https://github.com/meisnate12/Plex-Meta-Manager/wiki/Docker-Walkthrough#setting-up-the-initial-config-file) available to help get you up and running.
51+
There is a [walkthrough](https://metamanager.wiki/en/latest/home/guides/docker.html#setting-up-the-initial-config-file) available to help get you up and running.
5252
53-
This image supports all of the environment variables listed [here](https://github.com/meisnate12/Plex-Meta-Manager/wiki/Run-Commands-&-Environmental-Variables)
53+
This image supports all of the environment variables listed [here](https://metamanager.wiki/en/latest/home/environmental.html)
5454
5555
To perform a one-time run use `docker run` (or `docker-compose run`) with the `--rm` and `-e PMM_RUN=True` arguments. This will cause the container to process your config immediately instead of waiting for the scheduled time, and delete the old container after completion.
5656
57-
For more information see the [official wiki](https://github.com/meisnate12/Plex-Meta-Manager/wiki).
57+
For more information see the [official wiki](https://metamanager.wiki).
5858
5959
# changelog
6060
changelogs:
61+
- { date: "25.10.22:", desc: "Support commandline args and relative paths." }
6162
- { date: "03.10.22:", desc: "Rebase to Alpine 3.16, migrate to s6v3." }
6263
- { date: "30.01.22:", desc: "Initial Release." }
Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
#!/usr/bin/with-contenv bash
22

3+
cd / || exit 1
4+
35
# halt startup if no config file is found
4-
if [ ! -e "${PMM_CONFIG:-/config/config.yml}" ]; then
5-
echo "No config file found at ${PMM_CONFIG:-/config/config.yml}, halting init."
6-
s6-rc -bad change
6+
if [[ -n ${PMM_CONFIG} ]]; then
7+
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+
else
11+
CONFIG_FILE="/config/config.yml"
712
fi
813

9-
cd / || exit 1
14+
if [[ -n "${CONFIG_FILE}" ]] && [[ ! -e "${CONFIG_FILE}" ]]; then
15+
echo "No config file found at ${CONFIG_FILE}, halting init."
16+
s6-rc -bad change
17+
fi
1018

11-
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${PMM_CONFIG:-/config/config.yml}" --run
19+
if { echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--run|-r)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; } && { echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--config|-c)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; }; then
20+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py ${CLI_OPTIONS}
21+
elif echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--run|-r)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; then
22+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" ${CLI_OPTIONS:+"$CLI_OPTIONS"}
23+
elif echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--config|-c)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; then
24+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --run ${CLI_OPTIONS}
25+
else
26+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --run --config "${CONFIG_FILE}" ${CLI_OPTIONS:+"$CLI_OPTIONS"}
27+
fi
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
#!/usr/bin/with-contenv bash
22

3+
cd / || exit 1
4+
35
# halt startup if no config file is found
4-
if [ ! -e "${PMM_CONFIG:-/config/config.yml}" ]; then
5-
echo "No config file found at ${PMM_CONFIG:-/config/config.yml}, halting init."
6-
s6-rc -bad change
6+
if [[ -n ${PMM_CONFIG} ]]; then
7+
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+
else
11+
CONFIG_FILE="/config/config.yml"
712
fi
813

9-
cd / || exit 1
14+
if [[ -n "${CONFIG_FILE}" ]] && [[ ! -e "${CONFIG_FILE}" ]]; then
15+
echo "No config file found at ${CONFIG_FILE}, halting init."
16+
s6-rc -bad change
17+
fi
1018

11-
exec \
12-
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${PMM_CONFIG:-/config/config.yml}" --time "${PMM_TIME:-03:00}"
19+
if { echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--time|-t)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; } && { echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--config|-c)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; }; then
20+
exec \
21+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py ${CLI_OPTIONS:+"$CLI_OPTIONS"}
22+
elif echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--time|-t)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; then
23+
exec \
24+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" ${CLI_OPTIONS:+"$CLI_OPTIONS"}
25+
elif echo "${CLI_OPTIONS}" | grep -qPo '[\s]?(--config|-c)([^\S])(.+\/[^\/]+)\.(yml|yaml)'; then
26+
exec \
27+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --time "${PMM_TIME:-03:00}" ${CLI_OPTIONS:+"$CLI_OPTIONS"}
28+
else
29+
exec \
30+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" --time "${PMM_TIME:-03:00}" ${CLI_OPTIONS:+"$CLI_OPTIONS"}
31+
fi

root/init-hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/with-contenv bash
22

3-
if [[ $(tr "[:upper:]" "[:lower:]" <<<"${PMM_RUN}") = "true" ]]; then
3+
if [[ $(tr "[:upper:]" "[:lower:]" <<<"${PMM_RUN}") = "true" ]] || [[ ${CLI_OPTIONS} = *"-r"* ]] || [[ ${CLI_OPTIONS} = *"--run"* ]]; then
44
rm -rf /etc/s6-overlay/s6-rc.d/svc-pmm
55
rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/svc-pmm
66
rm -rf /etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-pmm-config

root/init-pmm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
if [ "${1:0:1}" = '-' ]; then
4+
export CLI_OPTIONS="$@"
5+
set --
6+
fi
7+
exec /init "$@"

0 commit comments

Comments
 (0)