🔧 Update scripts and add CA cert update 🔧

Update all container scripts to 202605241245-git and add CA certificate
update step after package installation.
- rootfs/root/docker/setup/00-init.sh: updated to latest template
- rootfs/root/docker/setup/01-system.sh: updated to latest template
- rootfs/root/docker/setup/02-packages.sh: add update-ca-certificates/update-ca-trust step
- rootfs/root/docker/setup/03-files.sh: updated to latest template
- rootfs/root/docker/setup/04-users.sh: updated to latest template
- rootfs/root/docker/setup/05-custom.sh: updated to latest template
- rootfs/root/docker/setup/06-post.sh: updated to latest template
- rootfs/root/docker/setup/07-cleanup.sh: updated to latest template
- rootfs/usr/local/bin/entrypoint.sh: updated to 202605241245-git
- rootfs/usr/local/bin/pkmgr: updated to 202605241245-git
- rootfs/usr/local/etc/docker/functions/entrypoint.sh: updated to 202605241245-git

rootfs/root/docker/setup/00-init.sh
rootfs/root/docker/setup/01-system.sh
rootfs/root/docker/setup/02-packages.sh
rootfs/root/docker/setup/03-files.sh
rootfs/root/docker/setup/04-users.sh
rootfs/root/docker/setup/05-custom.sh
rootfs/root/docker/setup/06-post.sh
rootfs/root/docker/setup/07-cleanup.sh
rootfs/usr/local/bin/entrypoint.sh
rootfs/usr/local/bin/pkmgr
rootfs/usr/local/etc/docker/functions/entrypoint.sh
This commit is contained in:
2026-05-24 21:46:47 -04:00
parent 4dac625259
commit 83c3031c78
11 changed files with 459 additions and 618 deletions
+4 -3
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242059-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:15 PM EST 2026 # @@Created : Sun May 24 08:59:38 PM EDT 2026
# @@File : 00-init.sh # @@File : 00-init.sh
# @@Description : script to run init # @@Description : script to run init
# @@Changelog : newScript # @@Changelog : newScript
@@ -36,9 +36,10 @@ if [ -d "/usr/local/share/template-files/defaults" ]; then rm -Rf "/usr/local/sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+4 -3
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242059-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:15 PM EST 2026 # @@Created : Sun May 24 08:59:38 PM EDT 2026
# @@File : 01-system.sh # @@File : 01-system.sh
# @@Description : script to run system # @@Description : script to run system
# @@Changelog : newScript # @@Changelog : newScript
@@ -34,9 +34,10 @@ exitCode=0
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+10 -49
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242139-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:16 PM EST 2026 # @@Created : Sun May 24 08:59:38 PM EDT 2026
# @@File : 02-packages.sh # @@File : 02-packages.sh
# @@Description : script to run packages # @@Description : script to run packages
# @@Changelog : newScript # @@Changelog : newScript
@@ -31,59 +31,20 @@ exitCode=0
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Main script # Main script
if command -v update-ca-certificates >/dev/null 2>&1; then
# Install yay AUR helper if on Arch Linux update-ca-certificates
if [ -f /etc/arch-release ]; then elif command -v update-ca-trust >/dev/null 2>&1; then
echo "Detected Arch Linux - Installing yay AUR helper..." update-ca-trust extract
elif command -v trust >/dev/null 2>&1; then
# Install yay AUR helper if not present trust extract-compat
if ! command -v yay >/dev/null 2>&1; then
echo "Installing yay AUR helper..."
# Ensure abc user exists and has sudo rights
if ! id -u abc >/dev/null 2>&1; then
useradd -m -s /bin/bash abc
fi
echo "abc ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/abc
# Clone and build yay as abc user
rm -rf /tmp/yay
cd /tmp
git clone --depth 1 https://aur.archlinux.org/yay.git
chown -R abc:abc /tmp/yay
# Build yay with proper error handling
cd /tmp/yay
su - abc -c "cd /tmp/yay && makepkg -si --noconfirm --needed" || {
echo "ERROR: yay build failed, trying alternative method..."
# Alternative: use yay-bin from AUR (pre-compiled)
cd /tmp
rm -rf /tmp/yay-bin
git clone --depth 1 https://aur.archlinux.org/yay-bin.git
chown -R abc:abc /tmp/yay-bin
cd /tmp/yay-bin
su - abc -c "cd /tmp/yay-bin && makepkg -si --noconfirm --needed"
}
# Cleanup
cd /
rm -rf /tmp/yay /tmp/yay-bin
if command -v yay >/dev/null 2>&1; then
echo "yay installed successfully"
else
echo "WARNING: yay installation failed"
fi
fi
echo "XFCE4 and yay installation complete"
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+21 -27
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242059-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:16 PM EST 2026 # @@Created : Sun May 24 08:59:39 PM EDT 2026
# @@File : 03-files.sh # @@File : 03-files.sh
# @@Description : script to run files # @@Description : script to run files
# @@Changelog : newScript # @@Changelog : newScript
@@ -31,51 +31,55 @@ exitCode=0
if [ -d "/tmp/bin" ]; then if [ -d "/tmp/bin" ]; then
mkdir -p "/usr/local/bin" mkdir -p "/usr/local/bin"
for bin in "/tmp/bin"/*; do for bin in "/tmp/bin"/*; do
name="$(basename -- "$bin")" [ -e "$bin" ] || continue
name="${bin##*/}"
echo "Installing $name to /usr/local/bin/$name" echo "Installing $name to /usr/local/bin/$name"
copy "$bin" "/usr/local/bin/$name" cp -Rf "$bin" "/usr/local/bin/$name"
chmod -f +x "/usr/local/bin/$name" chmod -f +x "/usr/local/bin/$name"
done done
fi fi
unset bin unset bin
if [ -d "/tmp/var" ]; then if [ -d "/tmp/var" ]; then
for var in "/tmp/var"/*; do for var in "/tmp/var"/*; do
name="$(basename -- "$var")" [ -e "$var" ] || continue
name="${var##*/}"
echo "Installing $var to /var/$name" echo "Installing $var to /var/$name"
if [ -d "$var" ]; then if [ -d "$var" ]; then
mkdir -p "/var/$name" mkdir -p "/var/$name"
copy "$var/." "/var/$name/" cp -Rf "$var/." "/var/$name/"
else else
copy "$var" "/var/$name" cp -Rf "$var" "/var/$name"
fi fi
done done
fi fi
unset var unset var
if [ -d "/tmp/etc" ]; then if [ -d "/tmp/etc" ]; then
for config in "/tmp/etc"/*; do for config in "/tmp/etc"/*; do
name="$(basename -- "$config")" [ -e "$config" ] || continue
name="${config##*/}"
echo "Installing $config to /etc/$name" echo "Installing $config to /etc/$name"
if [ -d "$config" ]; then if [ -d "$config" ]; then
mkdir -p "/etc/$name" mkdir -p "/etc/$name"
copy "$config/." "/etc/$name/" cp -Rf "$config/." "/etc/$name/"
mkdir -p "/usr/local/share/template-files/config/$name" mkdir -p "/usr/local/share/template-files/config/$name"
copy "$config/." "/usr/local/share/template-files/config/$name/" cp -Rf "$config/." "/usr/local/share/template-files/config/$name/"
else else
copy "$config" "/etc/$name" cp -Rf "$config" "/etc/$name"
copy "$config" "/usr/local/share/template-files/config/$name" cp -Rf "$config" "/usr/local/share/template-files/config/$name"
fi fi
done done
fi fi
unset config unset config
if [ -d "/tmp/data" ]; then if [ -d "/tmp/data" ]; then
for data in "/tmp/data"/*; do for data in "/tmp/data"/*; do
name="$(basename -- "$data")" [ -e "$data" ] || continue
name="${data##*/}"
echo "Installing $data to /usr/local/share/template-files/data" echo "Installing $data to /usr/local/share/template-files/data"
if [ -d "$data" ]; then if [ -d "$data" ]; then
mkdir -p "/usr/local/share/template-files/data/$name" mkdir -p "/usr/local/share/template-files/data/$name"
copy "$data/." "/usr/local/share/template-files/data/$name/" cp -Rf "$data/." "/usr/local/share/template-files/data/$name/"
else else
copy "$data" "/usr/local/share/template-files/data/$name" cp -Rf "$data" "/usr/local/share/template-files/data/$name"
fi fi
done done
fi fi
@@ -83,22 +87,12 @@ unset data
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Main script # Main script
# Setup persistence directories for XFCE
echo "Setting up persistence for /data/web..."
mkdir -p /data/web/home
mkdir -p /data/web/config
mkdir -p /data/web/xfce4
mkdir -p /data/web/.config
mkdir -p /data/web/.local
# Create symlinks for XFCE config persistence (will be used at runtime)
echo "Persistence directories created in /data/web"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+4 -3
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242059-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:16 PM EST 2026 # @@Created : Sun May 24 08:59:39 PM EDT 2026
# @@File : 04-users.sh # @@File : 04-users.sh
# @@Description : script to run users # @@Description : script to run users
# @@Changelog : newScript # @@Changelog : newScript
@@ -34,9 +34,10 @@ exitCode=0
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+4 -3
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242059-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:16 PM EST 2026 # @@Created : Sun May 24 08:59:39 PM EDT 2026
# @@File : 05-custom.sh # @@File : 05-custom.sh
# @@Description : script to run custom # @@Description : script to run custom
# @@Changelog : newScript # @@Changelog : newScript
@@ -34,9 +34,10 @@ exitCode=0
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+4 -3
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242059-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:16 PM EST 2026 # @@Created : Sun May 24 08:59:39 PM EDT 2026
# @@File : 06-post.sh # @@File : 06-post.sh
# @@Description : script to run post # @@Description : script to run post
# @@Changelog : newScript # @@Changelog : newScript
@@ -34,9 +34,10 @@ exitCode=0
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+5 -4
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202601292017-git ##@Version : 202605242059-git
# @@Author : CasjaysDev # @@Author : CasjaysDev
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro> # @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
# @@License : MIT # @@License : MIT
# @@Copyright : Copyright 2026 CasjaysDev # @@Copyright : Copyright 2026 CasjaysDev
# @@Created : Thu Jan 29 08:17:16 PM EST 2026 # @@Created : Sun May 24 08:59:39 PM EDT 2026
# @@File : 07-cleanup.sh # @@File : 07-cleanup.sh
# @@Description : script to run cleanup # @@Description : script to run cleanup
# @@Changelog : newScript # @@Changelog : newScript
@@ -24,7 +24,7 @@ set -o pipefail
[ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -x$DEBUGGER_OPTIONS [ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -x$DEBUGGER_OPTIONS
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Load functions # Load functions
__find_and_remove() { [ -z "$1" ] || find "${2:-/etc}" -iname "$1" -exec rm -Rf {} \; 2>/dev/null; } __find_and_remove() { [ -z "$1" ] || find "${2:-/etc}" -iname "$1" -exec rm -Rf {} + 2>/dev/null; }
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set env variables # Set env variables
exitCode=0 exitCode=0
@@ -38,9 +38,10 @@ if [ -d "$HOME/.cache" ]; then rm -Rf "$HOME/.cache"; fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set the exit code # Set the exit code
#exitCode=$? exitCode=$?
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
exit $exitCode exit $exitCode
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+59 -108
View File
@@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202512161441-git ##@Version : 202605241245-git
# @@Author : Jason Hempstead # @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.pro # @@Contact : jason@casjaysdev.pro
# @@License : WTFPL # @@License : WTFPL
# @@ReadME : entrypoint.sh --help # @@ReadME : entrypoint.sh --help
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments # @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
# @@Created : Thursday, Jan 29, 2026 20:17 EST # @@Created : Sunday, May 24, 2026 20:59 EDT
# @@File : entrypoint.sh # @@File : entrypoint.sh
# @@Description : Entrypoint file for web # @@Description : Entrypoint file for alpine
# @@Changelog : New script # @@Changelog : New script
# @@TODO : Better documentation # @@TODO : Better documentation
# @@Other : # @@Other :
@@ -21,35 +21,15 @@
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329 # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# run trap command on exit # run trap command on exit
trap '__trap_exit_handler' EXIT trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM
trap '__trap_signal_handler' INT TERM PWR trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGPWR 2>/dev/null || true
# - - - - - - - - - - - - - - - - - - - - - - - - -
__trap_exit_handler() {
local retVal=$?
if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then
rm -Rf "$SERVICE_PID_FILE" 2>/dev/null || true
fi
exit $retVal
}
# - - - - - - - - - - - - - - - - - - - - - - - - -
__trap_signal_handler() {
local retVal=$?
echo "Container received shutdown signal"
if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then
rm -Rf "$SERVICE_PID_FILE" 2>/dev/null || true
fi
exit $retVal
}
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html # setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
if [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ]; then [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
export DEBUGGER_OPTIONS="$(<"/config/.debug")"
else
DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
fi
if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then
echo "Enabling debugging" echo "Enabling debugging"
set -o pipefail -x$DEBUGGER_OPTIONS set -o pipefail
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
export DEBUGGER="on" export DEBUGGER="on"
else else
set -o pipefail set -o pipefail
@@ -59,18 +39,12 @@ PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set bash options # Set bash options
SCRIPT_FILE="$0" SCRIPT_FILE="$0"
CONTAINER_NAME="web" CONTAINER_NAME="alpine"
SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" SCRIPT_NAME="${SCRIPT_FILE##*/}"
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}" CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# remove whitespaces from beginning argument # remove whitespaces from beginning argument
while :; do while :; do [ "$1" = " " ] && shift 1 || break; done
if [ "$1" = " " ]; then
shift 1
else
break
fi
done
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
[ "$1" = "$SCRIPT_FILE" ] && shift 1 [ "$1" = "$SCRIPT_FILE" ] && shift 1
[ "$1" = "$SCRIPT_NAME" ] && shift 1 [ "$1" = "$SCRIPT_NAME" ] && shift 1
@@ -88,7 +62,7 @@ case "$1" in
-h | --help) -h | --help)
shift 1 shift 1
echo 'Docker container for '$CONTAINER_NAME'' echo 'Docker container for '$CONTAINER_NAME''
echo "Usage: $CONTAINER_NAME [help tail cron exec start init shell certbot ssl procs ports healthcheck backup command]" echo "Usage: $CONTAINER_NAME [help tail cron exec start init shell procs ports healthcheck backup command]"
echo "" echo ""
exit 0 exit 0
;; ;;
@@ -121,8 +95,8 @@ SERVICE_UID="${SERVICE_UID:-0}"
SERVICE_GID="${SERVICE_GID:-0}" SERVICE_GID="${SERVICE_GID:-0}"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres # User and group in which the service switches to - IE: nginx,apache,mysql,postgres
#SERVICE_USER="${SERVICE_USER:-web}" # execute command as another user #SERVICE_USER="${SERVICE_USER:-alpine}" # execute command as another user
#SERVICE_GROUP="${SERVICE_GROUP:-web}" # Set the service group #SERVICE_GROUP="${SERVICE_GROUP:-alpine}" # Set the service group
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Secondary ports # Secondary ports
# specifiy other ports # specifiy other ports
@@ -136,7 +110,7 @@ WEB_SERVER_PORT=""
# enable healthcheck [yes/no] # enable healthcheck [yes/no]
HEALTH_ENABLED="yes" HEALTH_ENABLED="yes"
# comma separated list of processes for the healthcheck # comma separated list of processes for the healthcheck
SERVICES_LIST="" SERVICES_LIST="tini"
# url endpoints: [http://localhost/health,http://localhost/test] # url endpoints: [http://localhost/health,http://localhost/test]
HEALTH_ENDPOINTS="" HEALTH_ENDPOINTS=""
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -177,7 +151,7 @@ export DOMAINNAME="$(hostname -d)"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Default directories # Default directories
export SSL_DIR="${SSL_DIR:-/config/ssl}" export SSL_DIR="${SSL_DIR:-/config/ssl}"
export SSL_CA="${SSL_CERT:-/config/ssl/ca.crt}" export SSL_CA="${SSL_CA:-/config/ssl/ca.crt}"
export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}" export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}"
export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}" export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}"
export LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}" export LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}"
@@ -198,13 +172,13 @@ export NGINX_CONFIG_FILE="${NGINX_CONFIG_FILE:-$(__find_nginx_conf)}"
export MYSQL_CONFIG_FILE="${MYSQL_CONFIG_FILE:-$(__find_mysql_conf)}" export MYSQL_CONFIG_FILE="${MYSQL_CONFIG_FILE:-$(__find_mysql_conf)}"
export PGSQL_CONFIG_FILE="${PGSQL_CONFIG_FILE:-$(__find_pgsql_conf)}" export PGSQL_CONFIG_FILE="${PGSQL_CONFIG_FILE:-$(__find_pgsql_conf)}"
export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}" export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}"
export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-$ENTRYPOINT_PID_FILE}" export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -n "$CONTAINER_WEB_SERVER_WWW_REPO" ]; then if [ -n "$CONTAINER_WEB_SERVER_WWW_REPO" ]; then
www_temp_dir="/tmp/git/$(basename -- "$CONTAINER_WEB_SERVER_WWW_REPO")" www_temp_dir="/tmp/git/${CONTAINER_WEB_SERVER_WWW_REPO##*/}"
rm -Rf "${WWW_ROOT_DIR:?}"/* "${www_temp_dir:?}"/* 2>/dev/null || true rm -Rf "${WWW_ROOT_DIR:?}"/* "${www_temp_dir:?}"/* 2>/dev/null || true
mkdir -p "$WWW_ROOT_DIR" "$www_temp_dir" 2>/dev/null || true mkdir -p "$WWW_ROOT_DIR" "$www_temp_dir" 2>/dev/null || true
git clone -q "$CONTAINER_WEB_SERVER_WWW_REPO" "$www_temp_dir" 2>/dev/null || true git clone -q "$CONTAINER_WEB_SERVER_WWW_REPO" "$www_temp_dir" 2>/dev/null || true
@@ -248,8 +222,6 @@ SERVER_PORTS="${SERVER_PORTS//,/ }" #
SERVER_PORTS="${SERVER_PORTS//\/*/}" # SERVER_PORTS="${SERVER_PORTS//\/*/}" #
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# clean WEB_SERVER_PORTS variables # clean WEB_SERVER_PORTS variables
WEB_SERVER_PORTS="${WEB_SERVER_PORT//\/*/}" #
WEB_SERVER_PORTS="${WEB_SERVER_PORTS//\/*/}" #
WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }" # WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }" #
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# rewrite and merge variables # rewrite and merge variables
@@ -322,7 +294,7 @@ fi
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
if [ "$ENTRYPOINT_MESSAGE" = "yes" ]; then if [ "$ENTRYPOINT_MESSAGE" = "yes" ]; then
echo "Executing entrypoint script for web" echo "Executing entrypoint script for alpine"
fi fi
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -391,7 +363,7 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -f "/etc/hostname" ]; then if [ -f "/etc/hostname" ]; then
if [ -n "$(type -P hostname 2>/dev/null)" ]; then if command -v hostname &>/dev/null; then
hostname -F "/etc/hostname" 2>/dev/null || true hostname -F "/etc/hostname" 2>/dev/null || true
else else
HOSTNAME="$(<"/etc/hostname")" 2>/dev/null || true HOSTNAME="$(<"/etc/hostname")" 2>/dev/null || true
@@ -401,12 +373,12 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# import hosts file into container # import hosts file into container
if [ -f "/usr/local/etc/hosts" ] && [ "$UPDATE_FILE_HOSTS" = "yes" ]; then if [ -f "/usr/local/etc/hosts" ] && [ "$UPDATE_FILE_HOSTS" = "yes" ]; then
cat "/usr/local/etc/hosts" 2>/dev/null | grep -vF "$HOSTNAME" >>"/etc/hosts" 2>/dev/null || true grep -vF "$HOSTNAME" "/usr/local/etc/hosts" 2>/dev/null >>"/etc/hosts" 2>/dev/null || true
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# import resolv.conf file into container # import resolv.conf file into container
if [ "$CUSTOM_DNS" != "yes" ] && [ -f "/usr/local/etc/resolv.conf" ] && [ "$UPDATE_FILE_RESOLV" = "yes" ]; then if [ "$CUSTOM_DNS" != "yes" ] && [ -f "/usr/local/etc/resolv.conf" ] && [ "$UPDATE_FILE_RESOLV" = "yes" ]; then
cat "/usr/local/etc/resolv.conf" >"/etc/resolv.conf" 2>/dev/null || true cp -f "/usr/local/etc/resolv.conf" "/etc/resolv.conf" 2>/dev/null || true
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -n "$HOME" ] && [ -d "/usr/local/etc/skel" ]; then if [ -n "$HOME" ] && [ -d "/usr/local/etc/skel" ]; then
@@ -417,12 +389,13 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Delete any .gitkeep files # Delete any .gitkeep files (bash * does not match dotfiles by default,
# so the explicit /.gitkeep path is required at each depth)
if [ -d "/data" ]; then if [ -d "/data" ]; then
rm -Rf "/data/.gitkeep" "/data"/*/*.gitkeep 2>/dev/null || true rm -Rf "/data/.gitkeep" "/data"/*/.gitkeep 2>/dev/null || true
fi fi
if [ -d "/config" ]; then if [ -d "/config" ]; then
rm -Rf "/config/.gitkeep" "/config"/*/*.gitkeep 2>/dev/null || true rm -Rf "/config/.gitkeep" "/config"/*/.gitkeep 2>/dev/null || true
fi fi
if [ -f "/usr/local/bin/.gitkeep" ]; then if [ -f "/usr/local/bin/.gitkeep" ]; then
rm -Rf "/usr/local/bin/.gitkeep" 2>/dev/null || true rm -Rf "/usr/local/bin/.gitkeep" 2>/dev/null || true
@@ -475,26 +448,30 @@ fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# if no pid assume container restart - clean stale files on restart # if no pid assume container restart - clean stale files on restart
if [ -f "$ENTRYPOINT_PID_FILE" ]; then if [ -f "$ENTRYPOINT_PID_FILE" ]; then
START_SERVICES="no" # Check if the PID in the file is still running
touch "$ENTRYPOINT_PID_FILE" entrypoint_pid=$(<"$ENTRYPOINT_PID_FILE") 2>/dev/null
if [ -n "$entrypoint_pid" ] && kill -0 "$entrypoint_pid" 2>/dev/null; then
# Process is still running, don't restart services
START_SERVICES="no"
touch "$ENTRYPOINT_PID_FILE"
else
# PID file exists but process is dead - this is a restart
START_SERVICES="yes"
# Clean any stale PID files on restart
rm -f /run/.start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
fi
else else
START_SERVICES=yes START_SERVICES=yes
# Clean any stale PID files on first run # Clean any stale PID files on first run
rm -f /run/.start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true rm -f /run/.start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
if [ "$ENTRYPOINT_MESSAGE" = "yes" ]; then [ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
__printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Show configured listing processes # Show configured listing processes
if [ "$ENTRYPOINT_MESSAGE" = "yes" ] && [ -n "$ENV_PORTS" ]; then if [ "$ENTRYPOINT_MESSAGE" = "yes" ] && [ -n "$ENV_PORTS" ]; then
show_port="" show_port=""
for port in $ENV_PORTS; do for port in $ENV_PORTS; do [ -n "$port" ] && show_port+="$(printf '%s ' "${port// /}") "; done
if [ -n "$port" ]; then
show_port+="$(printf '%s ' "${port// /}") "
fi
done
__printf_space "40" "The following ports are open:" "$show_port" __printf_space "40" "The following ports are open:" "$show_port"
unset port show_port unset port show_port
fi fi
@@ -512,7 +489,7 @@ __set_user_group_id $SERVICE_USER ${SERVICE_UID:-} ${SERVICE_GID:-}
__run_message __run_message
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Just start services # Just start services
START_SERVICES="${START_SERVICES:-SYSTEM_INIT}" START_SERVICES="${START_SERVICES:-yes}"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Determine if we should start services based on command # Determine if we should start services based on command
# Only skip service start for the 'init' command # Only skip service start for the 'init' command
@@ -529,6 +506,9 @@ if [ "$START_SERVICES" = "yes" ] || [ -z "$1" ]; then
echo "$$" >"$ENTRYPOINT_PID_FILE" echo "$$" >"$ENTRYPOINT_PID_FILE"
__start_init_scripts "/usr/local/etc/docker/init.d" __start_init_scripts "/usr/local/etc/docker/init.d"
CONTAINER_INIT="${CONTAINER_INIT:-no}" CONTAINER_INIT="${CONTAINER_INIT:-no}"
# Services started successfully - enter monitoring mode
__no_exit
exit $?
fi fi
START_SERVICES="no" START_SERVICES="no"
fi fi
@@ -538,7 +518,7 @@ export START_SERVICES CONTAINER_INIT ENTRYPOINT_PID_FILE
case "$1" in case "$1" in
init) init)
shift 1 shift 1
echo "Container has been Initialized" __log_info "Container has been initialized"
exit 0 exit 0
;; ;;
tail) tail)
@@ -567,10 +547,10 @@ logs)
tail -Fq /data/logs/*/* tail -Fq /data/logs/*/*
;; ;;
clean) clean)
log_files="$(find "/data/logs" -type f)" mapfile -t log_files < <(find "/data/logs" -type f 2>/dev/null)
for log in "${log_files[@]}"; do for log in "${log_files[@]}"; do
echo "clearing $log" __log_info "Clearing log file: $log"
printf '' >$log printf '' >"$log"
done done
;; ;;
*) *)
@@ -582,7 +562,7 @@ logs)
cron) cron)
shift 1 shift 1
__cron "$@" & __cron "$@" &
echo "cron script is running with pid: $!" __log_info "Cron script is running with PID: $!"
exit exit
;; ;;
# backup data and config dirs # backup data and config dirs
@@ -605,16 +585,16 @@ healthcheck)
healthPorts="${WEB_SERVER_PORTS:-}" healthPorts="${WEB_SERVER_PORTS:-}"
healthEndPoints="${HEALTH_ENDPOINTS:-}" healthEndPoints="${HEALTH_ENDPOINTS:-}"
SERVICES_LIST="${arguments:-$SERVICES_LIST}" SERVICES_LIST="${arguments:-$SERVICES_LIST}"
services="$(echo "${SERVICES_LIST//,/ }")" services="${SERVICES_LIST//,/ }"
healthMessage="Everything seems to be running" healthMessage="Everything seems to be running"
[ "$healthEnabled" = "yes" ] || exit 0 [ "$healthEnabled" = "yes" ] || exit 0
if [ -d "/run/healthcheck" ] && [ "$(ls -A "/run/healthcheck" | wc -l)" -ne 0 ]; then if [ -d "/run/healthcheck" ] && ! __is_dir_empty "/run/healthcheck"; then
for service in /run/healthcheck/*; do for service in /run/healthcheck/*; do
name=$(basename -- $service) name="${service##*/}"
services+="$name " services+="$name "
done done
fi fi
services="$(echo "$services" | tr ' ' '\n' | sort -u | grep -v '^$')" services="$(printf '%s\n' $services | sort -u | grep -v '^$')"
for proc in $services; do for proc in $services; do
if [ -n "$proc" ]; then if [ -n "$proc" ]; then
if ! __pgrep "$proc"; then if ! __pgrep "$proc"; then
@@ -623,8 +603,8 @@ healthcheck)
fi fi
fi fi
done done
for port in $ports; do for port in $healthPorts; do
if [ -n "$(type -P netstat)" ] && [ -n "$port" ]; then if command -v netstat &>/dev/null && [ -n "$port" ]; then
if ! netstat -taupln | grep -q ":$port "; then if ! netstat -taupln | grep -q ":$port "; then
echo "$port isn't open" >&2 echo "$port isn't open" >&2
healthStatus=$((healthStatus + 1)) healthStatus=$((healthStatus + 1))
@@ -648,38 +628,17 @@ healthcheck)
# show open ports # show open ports
ports) ports)
shift 1 shift 1
ports="$(__netstat -taupln | awk -F ' ' '{print $4}' | awk -F ':' '{print $2}' | sort --unique --version-sort | grep -v '^$' | grep '^' || echo '')" ports="$(__netstat -taupln 2>/dev/null | awk '{ split($4, a, ":"); if (a[2] != "") print a[2] }' | sort -uV)"
[ -n "$ports" ] && printf '%s\n%s\n' "The following are servers:" "$ports" | tr '\n' ' ' [ -n "$ports" ] && printf '%s\n%s\n' "The following are servers:" "$ports" | tr '\n' ' '
exit $? exit $?
;; ;;
# show running processes # show running processes
procs) procs)
shift 1 shift 1
ps="$(__ps axco command | grep -vE 'COMMAND|grep|ps' | sort -u || grep '^' || echo '')" ps="$(__ps axco command 2>/dev/null | grep -vE '^(COMMAND|grep|ps)$' | sort -u)"
[ -n "$ps" ] && printf '%s\n%s\n' "Found the following processes" "$ps" | tr '\n' ' ' [ -n "$ps" ] && printf '%s\n%s\n' "Found the following processes" "$ps" | tr '\n' ' '
exit $? exit $?
;; ;;
# setup ssl
ssl)
shift 1
__create_ssl_cert
exit $?
;;
# manage ssl certificate
certbot)
shift 1
CERT_BOT_ENABLED="yes"
if [ "$1" = "create" ]; then
shift 1
__certbot "create"
elif [ "$1" = "renew" ]; then
shift 1
__certbot "renew certonly --force-renew"
else
__exec_command "certbot" "$@"
fi
exit $?
;;
# Launch shell # Launch shell
*/bin/sh | */bin/bash | bash | sh | shell) */bin/sh | */bin/bash | bash | sh | shell)
shift 1 shift 1
@@ -698,11 +657,7 @@ start)
export PATH="/usr/local/etc/docker/init.d:$PATH" export PATH="/usr/local/etc/docker/init.d:$PATH"
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
scripts="$(ls -A "/usr/local/etc/docker/init.d")" scripts="$(ls -A "/usr/local/etc/docker/init.d")"
if [ -n "$scripts" ]; then [ -n "$scripts" ] && echo "$scripts" || echo "No scripts found in: /usr/local/etc/docker/init.d"
echo "$scripts"
else
echo "No scripts found in: /usr/local/etc/docker/init.d"
fi
exit exit
elif [ "$1" = "all" ]; then elif [ "$1" = "all" ]; then
shift $# shift $#
@@ -721,11 +676,7 @@ start)
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ ! -f "$ENTRYPOINT_PID_FILE" ]; then if [ ! -f "$ENTRYPOINT_PID_FILE" ]; then
echo "$$" >"$ENTRYPOINT_PID_FILE" echo "$$" >"$ENTRYPOINT_PID_FILE"
if [ "$START_SERVICES" = "no" ] && [ "$CONTAINER_INIT" = "yes" ]; then [ "$START_SERVICES" = "no" ] && [ "$CONTAINER_INIT" = "yes" ] || __start_init_scripts "/usr/local/etc/docker/init.d"
:
else
__start_init_scripts "/usr/local/etc/docker/init.d"
fi
fi fi
__no_exit __no_exit
else else
+2 -1
View File
@@ -103,7 +103,7 @@ install)
[ -n "$1" ] || exit 0 [ -n "$1" ] || exit 0
[ "$USER_UID" -eq 0 ] || [ "$USER" = "root" ] || pkmgr_install_cmd="sudo $pkmgr_install_cmd" [ "$USER_UID" -eq 0 ] || [ "$USER" = "root" ] || pkmgr_install_cmd="sudo $pkmgr_install_cmd"
if [ -f "$1" ]; then if [ -f "$1" ]; then
install_list="$(cat "$1")" install_list="$(tr '\n' ' ' < "$1")"
else else
install_list="$*" install_list="$*"
fi fi
@@ -140,3 +140,4 @@ clean)
esac esac
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# end # end
File diff suppressed because it is too large Load Diff