parent
3966c96763
commit
16522c68d8
2
scripts/dist/arch.sh
vendored
2
scripts/dist/arch.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# This script returns the normalized machine architecture (amd64, arm64, or arm).
|
||||
# An error is returned if the architecture is currently not supported by PhotoPrism.
|
||||
|
|
2
scripts/dist/audit.sh
vendored
2
scripts/dist/audit.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
######################################## TEST STORAGE FOLDER PERMISSIONS ########################################
|
||||
|
||||
|
|
2
scripts/dist/cleanup.sh
vendored
2
scripts/dist/cleanup.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(/usr/bin/id -u) != "0" ]]; then
|
||||
|
|
2
scripts/dist/dist-upgrade.sh
vendored
2
scripts/dist/dist-upgrade.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(/usr/bin/id -u) != "0" ]]; then
|
||||
|
|
41
scripts/dist/entrypoint-init.sh
vendored
41
scripts/dist/entrypoint-init.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# INITIALIZES CONTAINER PACKAGES AND PERMISSIONS
|
||||
|
||||
|
@ -28,34 +28,35 @@ case $DOCKER_ENV in
|
|||
;;
|
||||
|
||||
*)
|
||||
echo "unsupported init environment \"$DOCKER_ENV\"";
|
||||
echo "init: unsupported environment $DOCKER_ENV";
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ${PHOTOPRISM_UID} =~ $re ]] && [[ ${PHOTOPRISM_UID} != "0" ]]; then
|
||||
if [[ ${PHOTOPRISM_GID} =~ $re ]] && [[ ${PHOTOPRISM_GID} != "0" ]]; then
|
||||
/usr/sbin/groupadd -g "${PHOTOPRISM_GID}" "group_${PHOTOPRISM_GID}" 2>/dev/null
|
||||
/usr/sbin/useradd -o -u "${PHOTOPRISM_UID}" -g "${PHOTOPRISM_GID}" -d "/photoprism" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
/usr/sbin/usermod -g "${PHOTOPRISM_GID}" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
|
||||
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
|
||||
echo "updating filesystem permissions..."
|
||||
echo "PHOTOPRISM_DISABLE_CHOWN: \"true\" disables filesystem permission updates"
|
||||
/bin/chown --preserve-root -Rcf "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" "${CHOWN_DIRS[@]}"
|
||||
/bin/chmod --preserve-root -Rcf u+rwX "${CHMOD_DIRS[@]}"
|
||||
fi
|
||||
CHOWN="${PHOTOPRISM_UID}:${PHOTOPRISM_GID}"
|
||||
else
|
||||
/usr/sbin/useradd -o -u "${PHOTOPRISM_UID}" -g 1000 -d "/photoprism" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
/usr/sbin/usermod -g 1000 "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
CHOWN="${PHOTOPRISM_UID}"
|
||||
fi
|
||||
|
||||
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
|
||||
echo "updating filesystem permissions..."
|
||||
echo "PHOTOPRISM_DISABLE_CHOWN: \"true\" disables filesystem permission updates"
|
||||
/bin/chown --preserve-root -Rcf "${PHOTOPRISM_UID}" "${CHOWN_DIRS[@]}"
|
||||
/bin/chmod --preserve-root -Rcf u+rwX "${CHMOD_DIRS[@]}"
|
||||
if [[ ${PHOTOPRISM_UID} -ge 500 ]]; then
|
||||
if [[ ${PHOTOPRISM_GID} =~ $re ]] && [[ ${PHOTOPRISM_GID} != "0" ]] && [[ ${PHOTOPRISM_GID} -ge 500 ]]; then
|
||||
/usr/sbin/groupadd -g "${PHOTOPRISM_GID}" "group_${PHOTOPRISM_GID}" 2>/dev/null
|
||||
/usr/sbin/useradd -o -u "${PHOTOPRISM_UID}" -g "${PHOTOPRISM_GID}" -d "/photoprism" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
/usr/sbin/usermod -g "${PHOTOPRISM_GID}" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
else
|
||||
/usr/sbin/useradd -o -u "${PHOTOPRISM_UID}" -g 1000 -d "/photoprism" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
/usr/sbin/usermod -g 1000 "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${CHOWN} ]] && [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
|
||||
echo "init: updating filesystem permissions"
|
||||
echo "note: PHOTOPRISM_DISABLE_CHOWN=\"true\" disables permission updates"
|
||||
/bin/chown --preserve-root -Rcf "${CHOWN}" "${CHOWN_DIRS[@]}"
|
||||
/bin/chmod --preserve-root -Rcf u+rwX "${CHMOD_DIRS[@]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# do nothing if PHOTOPRISM_INIT was not set
|
||||
|
@ -68,7 +69,7 @@ INIT_LOCK="/scripts/.init-lock"
|
|||
# execute targets via /usr/bin/make
|
||||
if [[ ! -e ${INIT_LOCK} ]]; then
|
||||
for INIT_TARGET in $PHOTOPRISM_INIT; do
|
||||
echo "init $INIT_TARGET..."
|
||||
echo "init: $INIT_TARGET"
|
||||
/usr/bin/make -C "$INIT_SCRIPTS" "$INIT_TARGET"
|
||||
done
|
||||
|
||||
|
|
38
scripts/dist/entrypoint.sh
vendored
38
scripts/dist/entrypoint.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# regular expressions
|
||||
re='^[0-9]+$'
|
||||
|
@ -12,16 +12,16 @@ export DOCKER_TAG=${DOCKER_TAG:-unknown}
|
|||
case $DOCKER_ENV in
|
||||
prod)
|
||||
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/scripts:/opt/photoprism/bin:/usr/local/bin:/usr/bin";
|
||||
INIT_SCRIPT="/scripts/entrypoint-init.sh"
|
||||
INIT_SCRIPT="/scripts/entrypoint-init.sh";
|
||||
;;
|
||||
|
||||
develop)
|
||||
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/scripts:/usr/local/go/bin:/go/bin:/usr/local/bin:/usr/bin";
|
||||
INIT_SCRIPT="/go/src/github.com/photoprism/photoprism/scripts/dist/entrypoint-init.sh"
|
||||
INIT_SCRIPT="/go/src/github.com/photoprism/photoprism/scripts/dist/entrypoint-init.sh";
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "unknown environment \"$DOCKER_ENV\"";
|
||||
echo "entrypoint: unknown environment $DOCKER_ENV";
|
||||
INIT_SCRIPT=""
|
||||
;;
|
||||
esac
|
||||
|
@ -42,20 +42,23 @@ if [[ -z ${PHOTOPRISM_UID} ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# docker image info
|
||||
DOCKER_IMAGE="$PHOTOPRISM_ARCH-$DOCKER_ENV/$DOCKER_TAG"
|
||||
|
||||
# initialize container packages and permissions
|
||||
if [[ ${INIT_SCRIPT} ]] && [[ -f "${INIT_SCRIPT}" ]]; then
|
||||
if [[ $(/usr/bin/id -u) == "0" ]]; then
|
||||
echo "init $DOCKER_IMAGE as root"
|
||||
echo "started $DOCKER_TAG as root ($PHOTOPRISM_ARCH-$DOCKER_ENV)"
|
||||
/bin/bash -c "${INIT_SCRIPT}"
|
||||
else
|
||||
echo "init $DOCKER_IMAGE as uid $(/usr/bin/id -u)"
|
||||
echo "started $DOCKER_TAG as uid $(/usr/bin/id -u) ($PHOTOPRISM_ARCH-$DOCKER_ENV)"
|
||||
/usr/bin/sudo -E "${INIT_SCRIPT}"
|
||||
fi
|
||||
else
|
||||
echo "started $DOCKER_IMAGE as uid $(/usr/bin/id -u)"
|
||||
echo "started $DOCKER_TAG as uid $(/usr/bin/id -u) without init script ($PHOTOPRISM_ARCH-$DOCKER_ENV)"
|
||||
fi
|
||||
|
||||
# display documentation info and link
|
||||
if [[ $DOCKER_ENV == "prod" ]]; then
|
||||
echo "Problems? Our Troubleshooting Checklists help you quickly diagnose and solve them:";
|
||||
echo "https://docs.photoprism.app/getting-started/troubleshooting/";
|
||||
fi
|
||||
|
||||
# set explicit home directory
|
||||
|
@ -74,12 +77,15 @@ else
|
|||
fi
|
||||
|
||||
# display additional container info for troubleshooting
|
||||
echo "umask: \"$(umask)\" ($(umask -S))"
|
||||
echo "home-directory: ${HOME}"
|
||||
echo "storage-path: ${PHOTOPRISM_STORAGE_PATH}"
|
||||
echo "originals-path: ${PHOTOPRISM_ORIGINALS_PATH}"
|
||||
echo "import-path: ${PHOTOPRISM_IMPORT_PATH}"
|
||||
echo "assets-path: ${PHOTOPRISM_ASSETS_PATH}"
|
||||
echo "file umask....: \"$(umask)\" ($(umask -S))"
|
||||
echo "home directory: ${HOME}"
|
||||
echo "assets path...: ${PHOTOPRISM_ASSETS_PATH:-default}"
|
||||
echo "storage path..: ${PHOTOPRISM_STORAGE_PATH:-default}"
|
||||
echo "config path...: ${PHOTOPRISM_CONFIG_PATH:-default}"
|
||||
echo "cache path....: ${PHOTOPRISM_CACHE_PATH:-default}"
|
||||
echo "backup path...: ${PHOTOPRISM_BACKUP_PATH:-default}"
|
||||
echo "import path...: ${PHOTOPRISM_IMPORT_PATH:-default}"
|
||||
echo "originals path: ${PHOTOPRISM_ORIGINALS_PATH:-default}"
|
||||
|
||||
# change to another user and group on request
|
||||
if [[ ${INIT_SCRIPT} ]] && [[ $(/usr/bin/id -u) == "0" ]] && [[ ${PHOTOPRISM_UID} =~ $re ]] && [[ ${PHOTOPRISM_UID} != "0" ]]; then
|
||||
|
|
2
scripts/dist/heif-convert.sh
vendored
2
scripts/dist/heif-convert.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z $1 ]] && [[ -z $2 ]]; then
|
||||
echo "Usage: heif-convert <filename> <output>" 1>&2
|
||||
|
|
2
scripts/dist/install-chrome.sh
vendored
2
scripts/dist/install-chrome.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(id -u) != "0" ]]; then
|
||||
|
|
2
scripts/dist/install-darktable.sh
vendored
2
scripts/dist/install-darktable.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(id -u) != "0" ]]; then
|
||||
|
|
2
scripts/dist/install-davfs.sh
vendored
2
scripts/dist/install-davfs.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(id -u) != "0" ]]; then
|
||||
|
|
2
scripts/dist/install-go.sh
vendored
2
scripts/dist/install-go.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
GOLANG_VERSION=1.18
|
||||
|
||||
|
|
2
scripts/dist/install-gpu.sh
vendored
2
scripts/dist/install-gpu.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(id -u) != "0" ]]; then
|
||||
|
|
2
scripts/dist/install-mariadb.sh
vendored
2
scripts/dist/install-mariadb.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(id -u) != "0" ]]; then
|
||||
|
|
2
scripts/dist/install-nodejs.sh
vendored
2
scripts/dist/install-nodejs.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
# abort if not executed as root
|
||||
if [[ $(id -u) != "0" ]]; then
|
||||
|
|
2
scripts/dist/install-tensorflow.sh
vendored
2
scripts/dist/install-tensorflow.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
|
|
2
scripts/dist/tensorflow-driver.sh
vendored
2
scripts/dist/tensorflow-driver.sh
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
CPU_DETECTED=$(/usr/bin/lshw -c processor -json 2>/dev/null)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user