]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Chore: Use self-documenting long options in Docker startup scripts (#7275)
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Tue, 16 Jul 2024 17:27:12 +0000 (10:27 -0700)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2024 17:27:12 +0000 (10:27 -0700)
docker/docker-entrypoint.sh
docker/docker-prepare.sh

index 017e37384f47812e4aa9b7142cfe236d8afb2d7b..903d578da6721519e3e5623d4397c3f54efcd86e 100755 (executable)
@@ -10,8 +10,8 @@ map_uidgid() {
        local -r usermap_new_gid=${USERMAP_GID:-${usermap_original_gid:-$usermap_new_uid}}
        if [[ ${usermap_new_uid} != "${usermap_original_uid}" || ${usermap_new_gid} != "${usermap_original_gid}" ]]; then
                echo "Mapping UID and GID for paperless:paperless to $usermap_new_uid:$usermap_new_gid"
-               usermod -o -u "${usermap_new_uid}" paperless
-               groupmod -o -g "${usermap_new_gid}" paperless
+               usermod --non-unique --uid "${usermap_new_uid}" paperless
+               groupmod --non-unique --gid "${usermap_new_gid}" paperless
        fi
 }
 
@@ -42,7 +42,7 @@ custom_container_init() {
                fi
 
                # Make sure custom init directory has files in it
-               if [ -n "$(/bin/ls -A "${custom_script_dir}" 2>/dev/null)" ]; then
+               if [ -n "$(/bin/ls --almost-all "${custom_script_dir}" 2>/dev/null)" ]; then
                        echo "[custom-init] files found in ${custom_script_dir} executing"
                        # Loop over files in the directory
                        for SCRIPT in "${custom_script_dir}"/*; do
@@ -86,13 +86,13 @@ initialize() {
                "${CONSUME_DIR}"; do
                if [[ ! -d "${dir}" ]]; then
                        echo "Creating directory ${dir}"
-                       mkdir --parents "${dir}"
+                       mkdir --parents --verbose "${dir}"
                fi
        done
 
        local -r tmp_dir="${PAPERLESS_SCRATCH_DIR:=/tmp/paperless}"
        echo "Creating directory scratch directory ${tmp_dir}"
-       mkdir --parents "${tmp_dir}"
+       mkdir --parents --verbose "${tmp_dir}"
 
        set +e
        echo "Adjusting permissions of paperless files. This may take a while."
@@ -102,7 +102,7 @@ initialize() {
                "${DATA_DIR}" \
                "${MEDIA_ROOT_DIR}" \
                "${CONSUME_DIR}"; do
-               find "${dir}" -not \( -user paperless -and -group paperless \) -exec chown paperless:paperless {} +
+               find "${dir}" -not \( -user paperless -and -group paperless \) -exec chown --changes paperless:paperless {} +
        done
        set -e
 
@@ -127,7 +127,7 @@ install_languages() {
        for lang in "${langs[@]}"; do
                pkg="tesseract-ocr-$lang"
 
-               if dpkg -s "$pkg" &>/dev/null; then
+               if dpkg --status "$pkg" &>/dev/null; then
                        echo "Package $pkg already installed!"
                        continue
                fi
@@ -138,7 +138,7 @@ install_languages() {
                fi
 
                echo "Installing package $pkg..."
-               if ! apt-get -y install "$pkg" &>/dev/null; then
+               if ! apt-get --assume-yes install "$pkg" &>/dev/null; then
                        echo "Could not install $pkg"
                        exit 1
                fi
@@ -148,7 +148,7 @@ install_languages() {
 echo "Paperless-ngx docker container starting..."
 
 gosu_cmd=(gosu paperless)
-if [ "$(id -u)" == "$(id -u paperless)" ]; then
+if [ "$(id --user)" == "$(id --user paperless)" ]; then
        gosu_cmd=()
 fi
 
index 30d1237e5bb6e9a62850da48e2c68c469995027f..e3d9245357de3b8f07c8f4eace338dcaccc01b50 100755 (executable)
@@ -13,7 +13,7 @@ wait_for_postgres() {
 
        # Disable warning, host and port can't have spaces
        # shellcheck disable=SC2086
-       while [ ! "$(pg_isready -h ${host} -p ${port})" ]; do
+       while [ ! "$(pg_isready --host ${host} --port ${port})" ]; do
 
                if [ $attempt_num -eq $max_attempts ]; then
                        echo "Unable to connect to database."
@@ -25,6 +25,7 @@ wait_for_postgres() {
                attempt_num=$(("$attempt_num" + 1))
                sleep 5
        done
+       echo "Connected to PostgreSQL"
 }
 
 wait_for_mariadb() {
@@ -51,6 +52,7 @@ wait_for_mariadb() {
                attempt_num=$(("$attempt_num" + 1))
                sleep 5
        done
+       echo "Connected to MariaDB"
 }
 
 wait_for_redis() {