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

Commit dd4f13f

Browse files
authored
Merge pull request #6 from linuxserver/rework
2 parents e37c754 + 5487312 commit dd4f13f

File tree

9 files changed

+78
-21
lines changed

9 files changed

+78
-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: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
#!/usr/bin/with-contenv bash
22

3+
IFS="|" read -r -a CLI_OPTIONS <<< "$CLI_OPTIONS_STRING"
4+
5+
cd / || exit 1
6+
37
# 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
8+
if [[ -n "${PMM_CONFIG}" ]]; then
9+
CONFIG_FILE="${PMM_CONFIG}"
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)')
12+
else
13+
CONFIG_FILE="/config/config.yml"
714
fi
815

9-
cd / || exit 1
16+
if [[ -n "${CONFIG_FILE}" ]] && [[ ! -e "${CONFIG_FILE}" ]]; then
17+
echo "No config file found at ${CONFIG_FILE}, halting init."
18+
echo "[ls.io-init] done."
19+
s6-rc -bad change
20+
fi
1021

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

3+
IFS="|" read -r -a CLI_OPTIONS <<< "$CLI_OPTIONS_STRING"
4+
5+
cd / || exit 1
6+
37
# 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
8+
if [[ -n "${PMM_CONFIG}" ]]; then
9+
CONFIG_FILE="${PMM_CONFIG}"
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)')
12+
else
13+
CONFIG_FILE="/config/config.yml"
714
fi
815

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

11-
exec \
12-
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${PMM_CONFIG:-/config/config.yml}" --time "${PMM_TIME:-03:00}"
21+
if { echo "${CLI_OPTIONS[@]}" | grep -qPo '([\s]|^)(--time|-t)([\s])'; } && { echo "${CLI_OPTIONS[@]}" | grep -qPo '([\s]|^)(--config|-c)([\s])(.+\/[^\/]+)\.(yml|yaml)'; }; then
22+
exec \
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
25+
exec \
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
28+
exec \
29+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --time "${PMM_TIME:-03:00}" "${CLI_OPTIONS[@]}"
30+
else
31+
exec \
32+
s6-setuidgid abc python3 /app/pmm/plex_meta_manager.py --config "${CONFIG_FILE}" --time "${PMM_TIME:-03:00}" "${CLI_OPTIONS[@]}"
33+
fi

root/init-hook

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

3-
if [[ $(tr "[:upper:]" "[:lower:]" <<<"${PMM_RUN}") = "true" ]]; then
3+
IFS="|" read -r -a CLI_OPTIONS <<< "$CLI_OPTIONS_STRING"
4+
5+
if [[ $(tr "[:upper:]" "[:lower:]" <<<"${PMM_RUN}") = "true" ]] || echo "${CLI_OPTIONS[@]}" | grep -qPo '([\s]|^)(--run|--tests|--run-tests|--run-collections|--run-libraries|--run-metadata-files|--resume|-r|-rm|-rl|-rc|-rt|re)([\s]|$)'; then
46
rm -rf /etc/s6-overlay/s6-rc.d/svc-pmm
57
rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/svc-pmm
68
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_STRING=$(printf "%s|" "$@")
5+
set --
6+
fi
7+
exec /init "$@"

0 commit comments

Comments
 (0)