Skip to content

Commit

Permalink
Fix perms
Browse files Browse the repository at this point in the history
  • Loading branch information
dubo-dubon-duponey committed Mar 19, 2024
1 parent 304fb49 commit 0d7f48c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
28 changes: 18 additions & 10 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,22 @@ Be sure to run `./hack/lint.sh` and `./hack/test.sh` before submitting anything.
* no write
* no cap
* use the provided infrastructure
* runnable artifacts go to:
* `/boot/bin` (read-only)
* configuration should be read from:
* `/config` (read-only)
* certificates should go to:
* `/certs` (either read-only or read-write)
* persistent application data should use:
* `/data` (usually read-write)
* volatile data should use:
* `/tmp` (usually read-write)
* runnable artifacts go to:
* `/boot/bin` (read-only)
* configuration should be read from:
* `/magnetar/system/config` (read-only)
* and:
* `/magnetar/user/config` (read-write, user controlled)
* certificates should go to:
* `/magnetar/user/data` (either read-only or read-write)
* or:
* `/magnetar/system/data` (read-only)
* persistent application data should use:
* `/magnerar/system/data` (usually read-only)
* runtime data (socket, pipes) should use:
* `/magnerar/runtime`
* temp data (logs, states, etc) should use:
* `/magnerar/state`
* cache should use:
* `/magnerar/cache`
* only use chroot to downgrade if you really REALLY need to start your entrypoint with "root"
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ RUN --mount=type=secret,uid=100,id=CA \
&& apt-get -qq autoremove \
&& apt-get -qq clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/*

# Deviate avahi temporary files into /tmp (there is a socket, so, probably need exec). Avahi is also braindead and requires the folder to belong to user avahi
Expand Down Expand Up @@ -321,8 +322,8 @@ EXPOSE $ADVANCED_AIRPLAY_PORT/tcp
EXPOSE 319
EXPOSE 320

VOLUME $XDG_RUNTIME_DIR
VOLUME $XDG_CACHE_HOME
VOLUME $XDG_STATE_HOME
VOLUME "$XDG_RUNTIME_DIR"
VOLUME "$XDG_CACHE_HOME"
VOLUME "$XDG_STATE_HOME"

HEALTHCHECK --interval=120s --timeout=30s --start-period=10s --retries=1 CMD rtsp-health || exit 1
11 changes: 6 additions & 5 deletions context/runtime/boot/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ nqptp &
[ "${MOD_MQTT_ENABLED:-}" == true ] && MOD_MQTT_ENABLED=yes || MOD_MQTT_ENABLED=no
[ "${MOD_MQTT_COVER:-}" == true ] && MOD_MQTT_COVER=yes || MOD_MQTT_COVER=no

cp "$XDG_CONFIG_DIRS"/shairport-sync/main.conf "$XDG_RUNTIME_DIR"/shairport-sync/main.conf
[ ! -e "$XDG_CONFIG_HOME"/shairport-sync/main.conf ] || cat "$XDG_CONFIG_HOME"/shairport-sync/main.conf >> "$XDG_RUNTIME_DIR"/shairport-sync/main.conf
configuration="$(cat "$XDG_CONFIG_DIRS"/shairport-sync/main.conf)"
[ ! -e "$XDG_CONFIG_HOME"/shairport-sync/main.conf ] || configuration+="$(cat "$XDG_CONFIG_HOME"/shairport-sync/main.conf)"

# shellcheck disable=SC2016
printf 'mqtt {
configuration+="$(printf 'mqtt {
enabled = "%s"; // set this to yes to enable the mqtt-metadata-service
hostname = "%s"; // Hostname of the MQTT Broker
port = %s; // Port on the MQTT Broker to connect to
Expand Down Expand Up @@ -54,8 +54,9 @@ printf 'mqtt {
"${MOD_MQTT_CA:-NULL}" \
"${MOD_MQTT_CERT:-NULL}" \
"${MOD_MQTT_KEY:-NULL}" \
"$MOD_MQTT_COVER" \
>> "$XDG_RUNTIME_DIR"/shairport-sync/main.conf
"$MOD_MQTT_COVER")"

printf "%s" "$configuration" > "$XDG_RUNTIME_DIR"/shairport-sync/main.conf

# https://github.com/mikebrady/shairport-sync/blob/master/scripts/shairport-sync.conf
args=(\
Expand Down
4 changes: 1 addition & 3 deletions context/runtime/boot/mdns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ mdns::start::dbus(){
# https://man7.org/linux/man-pages/man3/sd_bus_default.3.html
# https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html

# $XDG_RUNTIME_DIR=/tmp/runtime
# Configuration file also has that ^ hardcoded, so, cannot use the variable...

local dbussocket=/magnetar/runtime/dbus/system_bus_socket
# Configuration file also has that ^ hardcoded, so, cannot use the variable...

# Ensure directory exists
helpers::dir::writable "$(dirname "$dbussocket")" create
Expand Down

0 comments on commit 0d7f48c

Please sign in to comment.