mirror of
https://github.com/casjaysdevdocker/ampache
synced 2026-05-19 02:47:55 -04:00
🗃️ Removed the .claude/settings.local.json 🗃️
Some checks failed
ampache / release-ampache (push) Has been cancelled
Some checks failed
ampache / release-ampache (push) Has been cancelled
Dockerfile .env.scripts .gitattributes .gitea/ .gitignore LICENSE.md README.md rootfs/root/docker/setup/04-users.sh rootfs/root/docker/setup/05-custom.sh rootfs/tmp/ rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/bin/pkmgr rootfs/usr/local/etc/docker/bin/ rootfs/usr/local/etc/docker/init.d/
This commit is contained in:
@@ -1,38 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202502050828-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@ReadME :
|
||||
# @@Copyright : Copyright 2023 CasjaysDev
|
||||
# @@Created : Mon Aug 28 06:48:42 PM EDT 2023
|
||||
# @@File : 04-users.sh
|
||||
# @@Description : script to run users
|
||||
# casjaysdevdocker/ampache - 04-users.sh
|
||||
# Defensive user/group creation. The Alpine apache2 and mariadb packages
|
||||
# normally create their service users, but we ensure here.
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2016
|
||||
# shellcheck disable=SC2031
|
||||
# shellcheck disable=SC2120
|
||||
# shellcheck disable=SC2155
|
||||
# shellcheck disable=SC2199
|
||||
# shellcheck disable=SC2317
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
[ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -x$DEBUGGER_OPTIONS
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set env variables
|
||||
|
||||
exitCode=0
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Predefined actions
|
||||
if ! getent group apache >/dev/null 2>&1; then
|
||||
addgroup -S apache 2>/dev/null || true
|
||||
fi
|
||||
if ! getent passwd apache >/dev/null 2>&1; then
|
||||
adduser -S -G apache -h /var/www -s /sbin/nologin apache 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Main script
|
||||
if ! getent group mysql >/dev/null 2>&1; then
|
||||
addgroup -S mysql 2>/dev/null || true
|
||||
fi
|
||||
if ! getent passwd mysql >/dev/null 2>&1; then
|
||||
adduser -S -G mysql -h /data/db/mariadb -s /sbin/nologin mysql 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
|
||||
@@ -1,26 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
# casjaysdevdocker/ampache - 05-custom.sh
|
||||
# 1. Wipe distro defaults under /etc/{apache2,php84,my.cnf.d}/* and
|
||||
# drop in our optimized configs from /tmp/etc/.
|
||||
# 2. Fetch the upstream Ampache prebuilt zip and unpack it under
|
||||
# /usr/local/share/ampache.
|
||||
# 3. Stage runtime dirs that the init.d scripts will need.
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
set -e -o pipefail
|
||||
[ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -x$DEBUGGER_OPTIONS
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set env variables
|
||||
|
||||
exitCode=0
|
||||
export PHP_VERSION=$PHP_VERSION NODE_VERSION=$NODE_VERSION NODE_MANAGER=$NODE_MANAGER WWW_ROOT_DIR="$WWW_ROOT_DIR"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Main script - simplified for now
|
||||
echo "Skipping template downloads for faster build"
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p /usr/share/webapps/ampache
|
||||
mkdir -p /config /data
|
||||
AMPACHE_VERSION="${AMPACHE_VERSION:-7.9.3}"
|
||||
AMPACHE_PHP_TAG="${AMPACHE_PHP_TAG:-php8.4}"
|
||||
AMPACHE_URL="https://github.com/ampache/ampache/releases/download/${AMPACHE_VERSION}/ampache-${AMPACHE_VERSION}_all_${AMPACHE_PHP_TAG}.zip"
|
||||
AMPACHE_INSTALL_DIR="/usr/local/share/ampache"
|
||||
|
||||
# Download Ampache if needed (commented out for now)
|
||||
# cd /usr/share/webapps
|
||||
# git clone https://github.com/ampache/ampache.git ampache || true
|
||||
echo "Wiping distro defaults and installing optimized configs"
|
||||
for svc in apache2 php84 my.cnf.d; do
|
||||
src="/tmp/etc/$svc"
|
||||
dst="/etc/$svc"
|
||||
[ -d "$src" ] || continue
|
||||
# Preserve mime.types + magic from the apache2 package; we don't ship our own.
|
||||
if [ "$svc" = "apache2" ]; then
|
||||
[ -f "$dst/mime.types" ] && cp -f "$dst/mime.types" "/tmp/${svc}_mime.types.preserve" || true
|
||||
[ -f "$dst/magic" ] && cp -f "$dst/magic" "/tmp/${svc}_magic.preserve" || true
|
||||
fi
|
||||
rm -Rf "$dst"/*
|
||||
mkdir -p "$dst"
|
||||
cp -Rf "$src/." "$dst/"
|
||||
if [ "$svc" = "apache2" ]; then
|
||||
[ -f "/tmp/${svc}_mime.types.preserve" ] && mv -f "/tmp/${svc}_mime.types.preserve" "$dst/mime.types"
|
||||
[ -f "/tmp/${svc}_magic.preserve" ] && mv -f "/tmp/${svc}_magic.preserve" "$dst/magic"
|
||||
fi
|
||||
# Drop a copy under template-files/config/ so /config/$svc gets seeded on first run.
|
||||
mkdir -p "/usr/local/share/template-files/config/$svc"
|
||||
cp -Rf "$dst/." "/usr/local/share/template-files/config/$svc/"
|
||||
done
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
echo "Fetching Ampache ${AMPACHE_VERSION} (${AMPACHE_PHP_TAG})"
|
||||
mkdir -p "$AMPACHE_INSTALL_DIR"
|
||||
cd /tmp
|
||||
if ! wget -q -O /tmp/ampache.zip "$AMPACHE_URL"; then
|
||||
echo "Failed to download $AMPACHE_URL" >&2
|
||||
exit 10
|
||||
fi
|
||||
unzip -q -o /tmp/ampache.zip -d "$AMPACHE_INSTALL_DIR"
|
||||
rm -f /tmp/ampache.zip
|
||||
|
||||
# Some upstream zips unpack into a versioned subdir; flatten if needed.
|
||||
if [ -d "$AMPACHE_INSTALL_DIR/ampache-${AMPACHE_VERSION}" ]; then
|
||||
shopt -s dotglob
|
||||
mv "$AMPACHE_INSTALL_DIR/ampache-${AMPACHE_VERSION}"/* "$AMPACHE_INSTALL_DIR/"
|
||||
rmdir "$AMPACHE_INSTALL_DIR/ampache-${AMPACHE_VERSION}"
|
||||
shopt -u dotglob
|
||||
fi
|
||||
|
||||
if [ ! -f "$AMPACHE_INSTALL_DIR/public/index.php" ]; then
|
||||
echo "Ampache install layout unexpected: $AMPACHE_INSTALL_DIR/public/index.php missing" >&2
|
||||
ls -la "$AMPACHE_INSTALL_DIR" | head -20 >&2
|
||||
exit 11
|
||||
fi
|
||||
|
||||
mkdir -p "$AMPACHE_INSTALL_DIR/config"
|
||||
|
||||
echo "Creating runtime dirs"
|
||||
mkdir -p /run/apache2 /run/php-fpm /run/mysqld /tmp/php-sessions \
|
||||
/var/log/apache2 \
|
||||
/usr/local/share/template-files/config/ampache
|
||||
|
||||
# Seed for /config/ampache
|
||||
cat <<'EOF' >/usr/local/share/template-files/config/ampache/.gitkeep
|
||||
# Placeholder. Real ampache.cfg.php is generated by install.php on first
|
||||
# web visit, then mirrored to this directory by 99-ampache.sh post_execute.
|
||||
EOF
|
||||
|
||||
# Make sure the apache user owns the app tree (composer artifacts ship as
|
||||
# www-data:www-data by default, but apache uid/gid differ on Alpine).
|
||||
if id apache >/dev/null 2>&1; then
|
||||
chown -Rf apache:apache "$AMPACHE_INSTALL_DIR" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit $exitCode
|
||||
|
||||
Reference in New Issue
Block a user