38 lines
1.1 KiB
Bash
Executable file
38 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
# Entrypoint file for refractr
|
|
# Runs refractr with some verbosity and all configs in /etc/refractr
|
|
#
|
|
# Copyright 2025 Bryson Steck <me@brysonsteck.xyz>
|
|
#
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
#
|
|
|
|
if [ -z "$UID" ]; then
|
|
set=$(ls -lnd /etc/refractr/ | awk '{print $3}')
|
|
echo "UID not set! Setting to id $set (owner of /etc/refractr)"
|
|
export UID=$set
|
|
fi
|
|
|
|
if [ -z "$GID" ]; then
|
|
set=$(ls -lnd /etc/refractr/ | awk '{print $4}')
|
|
echo "GID not set! Setting to id $set (group of /etc/refractr)"
|
|
export GID=$set
|
|
fi
|
|
|
|
if ! ls /etc/refractr/*.toml &> /dev/null; then
|
|
echo "Failed to find any toml config files for refractr!"
|
|
echo "Make sure you copied configs or set up volumes correctly."
|
|
exit 1
|
|
fi
|
|
|
|
args=""
|
|
for config in /etc/refractr/*.toml; do
|
|
args="${args}-c '${config}' "
|
|
done
|
|
|
|
addgroup -g $GID dockeruser
|
|
adduser -u $UID -G $(grep :$GID: /etc/group | awk -F: '{print $1}') -D dockeruser
|
|
|
|
su -p - dockeruser -c "refractr -vv ${args}"
|