mirror of
https://github.com/casjaysdevdocker/tor
synced 2026-06-24 14:01:07 -04:00
🔧 Sync all project files with updated templates 🔧
Update all template-derived files to the 202605261603-git template
version. Service-specific init scripts were committed separately in
fd24da283f03; this commit covers the remaining boilerplate files.
- .env.scripts: bump version 202510220838-git → 202605261603-git, copyright 2025 → 2026
- .gitattributes: update template-generation timestamp
- .gitignore: expand with editor configs, AI tool configs, env/secret, build artifact, test/coverage, and local-override patterns
- rootfs/root/docker/setup/00-init.sh: sync to new template version
- rootfs/root/docker/setup/01-system.sh: sync to new template version
- rootfs/root/docker/setup/02-packages.sh: sync to new template version (CA cert update commands)
- rootfs/root/docker/setup/03-files.sh: sync to new template version (explicit /tmp/{bin,var,etc,data} loops)
- rootfs/root/docker/setup/04-users.sh: sync to new template version
- rootfs/root/docker/setup/05-custom.sh: sync to new template version
- rootfs/root/docker/setup/06-post.sh: sync to new template version
- rootfs/root/docker/setup/07-cleanup.sh: sync to new template version (__find_and_remove helper)
- rootfs/usr/local/bin/entrypoint.sh: sync to new template version
- rootfs/usr/local/etc/docker/functions/entrypoint.sh: sync to new template version
- rootfs/usr/local/share/template-files/config/env/default.sample: bump version stamp
- rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh: bump version stamp
.env.scripts
.gitattributes
.gitignore
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/etc/docker/functions/entrypoint.sh
rootfs/usr/local/share/template-files/config/env/default.sample
rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510220838-git
|
##@Version : 202605261603-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 08:38:42 AM EDT 2025
|
# @@Created : Wed Oct 22 08:38:42 AM EDT 2025
|
||||||
# @@File : .env.scripts
|
# @@File : .env.scripts
|
||||||
# @@Description : Variables for gen-dockerfile and buildx scripts
|
# @@Description : Variables for gen-dockerfile and buildx scripts
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
# Template generated on Sat Nov 29 11:57:12 AM EST 2025 from https://github.com/alexkaratarakis/gitattributes"
|
# Template generated on Mon May 26 03:38:00 PM EDT 2026 from https://github.com/alexkaratarakis/gitattributes"
|
||||||
# Common settings that generally should always be used with your language specific settings
|
# Common settings that generally should always be used with your language specific settings
|
||||||
# Auto detect text files and perform LF normalization
|
# Auto detect text files and perform LF normalization
|
||||||
* text=auto
|
* text=auto
|
||||||
|
|||||||
+155
-18
@@ -1,4 +1,4 @@
|
|||||||
# gitignore created on 05/05/26 at 14:38
|
# gitignore created on 05/26/26 at 15:38
|
||||||
# Disable reminder in prompt
|
# Disable reminder in prompt
|
||||||
ignoredirmessage
|
ignoredirmessage
|
||||||
|
|
||||||
@@ -6,10 +6,12 @@ ignoredirmessage
|
|||||||
**/.build_failed*
|
**/.build_failed*
|
||||||
|
|
||||||
# OS generated files
|
# OS generated files
|
||||||
|
|
||||||
### Linux ###
|
### Linux ###
|
||||||
|
# Backup files left by editors
|
||||||
*~
|
*~
|
||||||
|
|
||||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
# Temporary files left when a process holds an open handle to a deleted file
|
||||||
.fuse_hidden*
|
.fuse_hidden*
|
||||||
|
|
||||||
# KDE directory preferences
|
# KDE directory preferences
|
||||||
@@ -18,11 +20,11 @@ ignoredirmessage
|
|||||||
# Linux trash folder which might appear on any partition or disk
|
# Linux trash folder which might appear on any partition or disk
|
||||||
.Trash-*
|
.Trash-*
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
# NFS stale file handles
|
||||||
.nfs*
|
.nfs*
|
||||||
|
|
||||||
### macOS ###
|
### macOS ###
|
||||||
# General
|
.DS_Store
|
||||||
.DS_Store?
|
.DS_Store?
|
||||||
.AppleDouble
|
.AppleDouble
|
||||||
.LSOverride
|
.LSOverride
|
||||||
@@ -46,20 +48,23 @@ Network Trash Folder
|
|||||||
Temporary Items
|
Temporary Items
|
||||||
.apdisk
|
.apdisk
|
||||||
|
|
||||||
### macOS Patch ###
|
|
||||||
# iCloud generated files
|
# iCloud generated files
|
||||||
*.icloud
|
*.icloud
|
||||||
|
|
||||||
### Windows ###
|
### Windows ###
|
||||||
# Windows thumbnail cache files
|
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
Thumbs.db:encryptable
|
Thumbs.db:encryptable
|
||||||
ehthumbs.db
|
ehthumbs.db
|
||||||
ehthumbs_vista.db
|
ehthumbs_vista.db
|
||||||
|
|
||||||
# Dump file
|
# Crash dump files
|
||||||
*.stackdump
|
*.stackdump
|
||||||
|
|
||||||
|
# Core dumps (Linux/macOS)
|
||||||
|
core
|
||||||
|
core.*
|
||||||
|
vgcore.*
|
||||||
|
|
||||||
# Folder config file
|
# Folder config file
|
||||||
[Dd]esktop.ini
|
[Dd]esktop.ini
|
||||||
|
|
||||||
@@ -73,20 +78,146 @@ $RECYCLE.BIN/
|
|||||||
*.msm
|
*.msm
|
||||||
*.msp
|
*.msp
|
||||||
|
|
||||||
# misc
|
|
||||||
!*/README*
|
|
||||||
!inc/main.bash
|
|
||||||
|
|
||||||
# Windows shortcuts
|
# Windows shortcuts
|
||||||
*.lnk
|
*.lnk
|
||||||
|
|
||||||
# ignore commit message
|
### Editors ###
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
# JetBrains IDEs (IntelliJ, GoLand, RustRover, PyCharm, etc.)
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
# Vim / Neovim
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
.netrwhist
|
||||||
|
Session.vim
|
||||||
|
.vim/
|
||||||
|
|
||||||
|
# Sublime Text
|
||||||
|
*.sublime-workspace
|
||||||
|
*.sublime-project
|
||||||
|
|
||||||
|
# Eclipse / generic Java IDEs
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
### AI tool local configs (personal settings, never commit) ###
|
||||||
|
# Claude Code
|
||||||
|
.claude/settings.local.json
|
||||||
|
.claude/*.lock
|
||||||
|
|
||||||
|
# Cursor
|
||||||
|
.cursor/
|
||||||
|
.cursorignore
|
||||||
|
.cursorindexingignore
|
||||||
|
|
||||||
|
# GitHub Copilot
|
||||||
|
.copilot/
|
||||||
|
|
||||||
|
# Codeium
|
||||||
|
.codeium/
|
||||||
|
|
||||||
|
# Tabnine
|
||||||
|
.tabnine/
|
||||||
|
|
||||||
|
# Aider
|
||||||
|
.aider/
|
||||||
|
.aider.conf.yml
|
||||||
|
.aider.model.settings.yml
|
||||||
|
.aiderignore
|
||||||
|
|
||||||
|
# General AI assistant local state
|
||||||
|
.ai/
|
||||||
|
.ai.local/
|
||||||
|
|
||||||
|
### Environment and secrets ###
|
||||||
|
# Local env overrides — never commit credentials
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Private keys and certificates
|
||||||
|
*.pem
|
||||||
|
*.key
|
||||||
|
*.p12
|
||||||
|
*.pfx
|
||||||
|
|
||||||
|
### Build artifacts ###
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# Rust
|
||||||
|
target/
|
||||||
|
|
||||||
|
# C / C++ / compiled objects
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
### Dependency directories ###
|
||||||
|
# Node
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Go (vendored deps are sometimes committed intentionally, so gitignore only the cache)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
.Python
|
||||||
|
*.egg-info/
|
||||||
|
.eggs/
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
|
||||||
|
### Logs ###
|
||||||
|
*.log
|
||||||
|
logs/
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
### Temporary and cache ###
|
||||||
|
tmp/
|
||||||
|
.tmp/
|
||||||
|
*.tmp
|
||||||
|
*.cache
|
||||||
|
.cache/
|
||||||
|
|
||||||
|
### Test and coverage ###
|
||||||
|
coverage/
|
||||||
|
.coverage
|
||||||
|
*.cover
|
||||||
|
*.coverprofile
|
||||||
|
htmlcov/
|
||||||
|
.nyc_output/
|
||||||
|
.pytest_cache/
|
||||||
|
.tox/
|
||||||
|
|
||||||
|
### Misc — always allow ###
|
||||||
|
!*/README*
|
||||||
|
!inc/main.bash
|
||||||
|
|
||||||
|
### Project-specific patterns ###
|
||||||
|
# ignore commit message files
|
||||||
**/.gitcommit
|
**/.gitcommit
|
||||||
|
|
||||||
# ignore .build_failed files
|
# ignore backup files
|
||||||
**/.build_failed*
|
|
||||||
|
|
||||||
# ignore .bak files
|
|
||||||
**/*.bak
|
**/*.bak
|
||||||
|
|
||||||
# ignore .no_push files
|
# ignore .no_push files
|
||||||
@@ -95,10 +226,16 @@ $RECYCLE.BIN/
|
|||||||
# ignore .no_git files
|
# ignore .no_git files
|
||||||
**/.no_git
|
**/.no_git
|
||||||
|
|
||||||
# ignore .installed files
|
# ignore .installed marker files
|
||||||
**/.installed
|
**/.installed
|
||||||
|
|
||||||
# ignore work in progress files
|
# ignore work-in-progress rewrite/refactor scripts
|
||||||
**/*.rewrite.sh
|
**/*.rewrite.sh
|
||||||
**/*.refactor.sh
|
**/*.refactor.sh
|
||||||
|
|
||||||
|
# ignore local override scripts and configs
|
||||||
|
**/*.local.sh
|
||||||
|
**/*.local.conf
|
||||||
|
**/*.local.yaml
|
||||||
|
**/*.local.yml
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:50 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/00-init.sh
|
# @@Template : templates/dockerfiles/init_scripts/00-init.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:50 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/01-system.sh
|
# @@Template : templates/dockerfiles/init_scripts/01-system.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:50 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/02-packages.sh
|
# @@Template : templates/dockerfiles/init_scripts/02-packages.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -31,12 +31,20 @@ exitCode=0
|
|||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Main script
|
# Main script
|
||||||
|
if command -v update-ca-certificates >/dev/null 2>&1; then
|
||||||
|
update-ca-certificates
|
||||||
|
elif command -v update-ca-trust >/dev/null 2>&1; then
|
||||||
|
update-ca-trust extract
|
||||||
|
elif command -v trust >/dev/null 2>&1; then
|
||||||
|
trust extract-compat
|
||||||
|
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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:50 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/03-files.sh
|
# @@Template : templates/dockerfiles/init_scripts/03-files.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -29,70 +29,70 @@ exitCode=0
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Predefined actions
|
# Predefined actions
|
||||||
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
|
||||||
echo "Installing $name to /usr/local/bin/$name"
|
name="${bin##*/}"
|
||||||
copy "$bin" "/usr/local/bin/$name"
|
echo "Installing $name to /usr/local/bin/$name"
|
||||||
chmod -f +x "/usr/local/bin/$name"
|
cp -Rf "$bin" "/usr/local/bin/$name"
|
||||||
done
|
chmod -f +x "/usr/local/bin/$name"
|
||||||
|
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
|
||||||
echo "Installing $var to /var/$name"
|
name="${var##*/}"
|
||||||
if [ -d "$var" ]; then
|
echo "Installing $var to /var/$name"
|
||||||
mkdir -p "/var/$name"
|
if [ -d "$var" ]; then
|
||||||
copy "$var/." "/var/$name/"
|
mkdir -p "/var/$name"
|
||||||
else
|
cp -Rf "$var/." "/var/$name/"
|
||||||
copy "$var" "/var/$name"
|
else
|
||||||
fi
|
cp -Rf "$var" "/var/$name"
|
||||||
done
|
fi
|
||||||
|
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
|
||||||
echo "Installing $config to /etc/$name"
|
name="${config##*/}"
|
||||||
if [ -d "$config" ]; then
|
echo "Installing $config to /etc/$name"
|
||||||
mkdir -p "/etc/$name"
|
if [ -d "$config" ]; then
|
||||||
copy "$config/." "/etc/$name/"
|
mkdir -p "/etc/$name"
|
||||||
mkdir -p "/usr/local/share/template-files/config/$name"
|
cp -Rf "$config/." "/etc/$name/"
|
||||||
copy "$config/." "/usr/local/share/template-files/config/$name/"
|
mkdir -p "/usr/local/share/template-files/config/$name"
|
||||||
else
|
cp -Rf "$config/." "/usr/local/share/template-files/config/$name/"
|
||||||
copy "$config" "/etc/$name"
|
else
|
||||||
copy "$config" "/usr/local/share/template-files/config/$name"
|
cp -Rf "$config" "/etc/$name"
|
||||||
fi
|
cp -Rf "$config" "/usr/local/share/template-files/config/$name"
|
||||||
done
|
fi
|
||||||
|
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
|
||||||
echo "Installing $data to /usr/local/share/template-files/data"
|
name="${data##*/}"
|
||||||
if [ -d "$data" ]; then
|
echo "Installing $data to /usr/local/share/template-files/data"
|
||||||
mkdir -p "/usr/local/share/template-files/data/$name"
|
if [ -d "$data" ]; then
|
||||||
copy "$data/." "/usr/local/share/template-files/data/$name/"
|
mkdir -p "/usr/local/share/template-files/data/$name"
|
||||||
else
|
cp -Rf "$data/." "/usr/local/share/template-files/data/$name/"
|
||||||
copy "$data" "/usr/local/share/template-files/data/$name"
|
else
|
||||||
fi
|
cp -Rf "$data" "/usr/local/share/template-files/data/$name"
|
||||||
done
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
unset data
|
unset data
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Main script
|
# Main script
|
||||||
for tor_bin in server relay bridge exit; do
|
|
||||||
if [ ! -f "/usr/local/bin/tor-$tor_bin" ]; then
|
|
||||||
cp -Rf "$(type -P tor 2>/dev/null)" "/usr/local/bin/tor-$tor_bin"
|
|
||||||
chmod +x "/usr/local/bin/tor-$tor_bin"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:50 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/04-users.sh
|
# @@Template : templates/dockerfiles/init_scripts/04-users.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:51 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/05-custom.sh
|
# @@Template : templates/dockerfiles/init_scripts/05-custom.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:52 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/06-post.sh
|
# @@Template : templates/dockerfiles/init_scripts/06-post.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@@ -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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202511210523-git
|
##@Version : 202605261538-git
|
||||||
# @@Author : CasjaysDev
|
# @@Author : CasjaysDev
|
||||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||||
# @@License : MIT
|
# @@License : MIT
|
||||||
# @@Copyright : Copyright 2025 CasjaysDev
|
# @@Copyright : Copyright 2026 CasjaysDev
|
||||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
# @@Created : Tue May 26 03:38:52 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
|
||||||
@@ -17,14 +17,14 @@
|
|||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/init_scripts/07-cleanup.sh
|
# @@Template : templates/dockerfiles/init_scripts/07-cleanup.sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
set -o pipefail
|
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
|
||||||
@@ -33,16 +33,15 @@ exitCode=0
|
|||||||
# Predefined actions
|
# Predefined actions
|
||||||
if [ -d "/tmp" ]; then rm -Rf "/tmp"/*; fi
|
if [ -d "/tmp" ]; then rm -Rf "/tmp"/*; fi
|
||||||
if [ -d "$HOME/.cache" ]; then rm -Rf "$HOME/.cache"; fi
|
if [ -d "$HOME/.cache" ]; then rm -Rf "$HOME/.cache"; fi
|
||||||
rm -Rf "/etc/privoxy"/*.new
|
|
||||||
rm -Rf "/etc/privoxy"/*/*.new
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Main script
|
# Main script
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202602061352-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 : Tuesday, May 05, 2026 14:38 EDT
|
# @@Created : Tuesday, May 26, 2026 15:38 EDT
|
||||||
# @@File : entrypoint.sh
|
# @@File : entrypoint.sh
|
||||||
# @@Description : Entrypoint file for tor
|
# @@Description : Entrypoint file for alpine
|
||||||
# @@Changelog : New script
|
# @@Changelog : New script
|
||||||
# @@TODO : Better documentation
|
# @@TODO : Better documentation
|
||||||
# @@Other :
|
# @@Other :
|
||||||
@@ -21,17 +21,25 @@
|
|||||||
# 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 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM PWR
|
trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM
|
||||||
|
trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGPWR 2>/dev/null || true
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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
|
||||||
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
|
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
|
||||||
{ [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -o pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail
|
if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then
|
||||||
|
echo "Enabling debugging"
|
||||||
|
set -o pipefail
|
||||||
|
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
||||||
|
export DEBUGGER="on"
|
||||||
|
else
|
||||||
|
set -o pipefail
|
||||||
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"
|
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="tor"
|
CONTAINER_NAME="alpine"
|
||||||
SCRIPT_NAME="${SCRIPT_FILE##*/}"
|
SCRIPT_NAME="${SCRIPT_FILE##*/}"
|
||||||
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
|
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -54,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
|
||||||
;;
|
;;
|
||||||
@@ -87,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:-tor}" # execute command as another user
|
#SERVICE_USER="${SERVICE_USER:-alpine}" # execute command as another user
|
||||||
#SERVICE_GROUP="${SERVICE_GROUP:-tor}" # Set the service group
|
#SERVICE_GROUP="${SERVICE_GROUP:-alpine}" # Set the service group
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Secondary ports
|
# Secondary ports
|
||||||
# specifiy other ports
|
# specifiy other ports
|
||||||
@@ -143,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}"
|
||||||
@@ -164,7 +172,7 @@ 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}"
|
||||||
@@ -214,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
|
||||||
@@ -288,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 tor"
|
echo "Executing entrypoint script for alpine"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -357,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
|
||||||
@@ -372,7 +378,7 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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
|
||||||
@@ -383,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
|
||||||
@@ -442,7 +449,7 @@ 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
|
||||||
# Check if the PID in the file is still running
|
# Check if the PID in the file is still running
|
||||||
entrypoint_pid=$(cat "$ENTRYPOINT_PID_FILE" 2>/dev/null || echo "")
|
entrypoint_pid=$(<"$ENTRYPOINT_PID_FILE") 2>/dev/null
|
||||||
if [ -n "$entrypoint_pid" ] && kill -0 "$entrypoint_pid" 2>/dev/null; then
|
if [ -n "$entrypoint_pid" ] && kill -0 "$entrypoint_pid" 2>/dev/null; then
|
||||||
# Process is still running, don't restart services
|
# Process is still running, don't restart services
|
||||||
START_SERVICES="no"
|
START_SERVICES="no"
|
||||||
@@ -451,12 +458,12 @@ if [ -f "$ENTRYPOINT_PID_FILE" ]; then
|
|||||||
# PID file exists but process is dead - this is a restart
|
# PID file exists but process is dead - this is a restart
|
||||||
START_SERVICES="yes"
|
START_SERVICES="yes"
|
||||||
# Clean any stale PID files on restart
|
# Clean any stale PID files on restart
|
||||||
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
|
||||||
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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
|
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
|
||||||
@@ -482,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
|
||||||
@@ -540,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
|
||||||
__log_info "Clearing log file: $log"
|
__log_info "Clearing log file: $log"
|
||||||
printf '' >$log
|
printf '' >"$log"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -578,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="${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
|
||||||
@@ -596,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))
|
||||||
@@ -621,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
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202605241142-git
|
##@Version : 202605241245-git
|
||||||
# @@Author : Jason Hempstead
|
# @@Author : Jason Hempstead
|
||||||
# @@Contact : git-admin@casjaysdev.pro
|
# @@Contact : git-admin@casjaysdev.pro
|
||||||
# @@License : LICENSE.md
|
# @@License : LICENSE.md
|
||||||
@@ -356,92 +356,6 @@ __update_ssl_certs() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__certbot() {
|
|
||||||
[ -n "$(type -P 'certbot')" ] || return 1
|
|
||||||
local options="$1"
|
|
||||||
local statusCode=0
|
|
||||||
local domain_list=""
|
|
||||||
local certbot_key_opts=""
|
|
||||||
local ADD_CERTBOT_DOMAINS=""
|
|
||||||
local CERTBOT_DOMAINS="${CERTBOT_DOMAINS:-$HOSTNAME}"
|
|
||||||
local CERT_BOT_MAIL="${CERT_BOT_MAIL:-ssl-admin@$CERTBOT_DOMAINS}"
|
|
||||||
local certbot_key_opts=""
|
|
||||||
mkdir -p "/config/letsencrypt"
|
|
||||||
__symlink "/etc/letsencrypt" "/config/letsencrypt"
|
|
||||||
is_renewal="$(find /etc/letsencrypt/renewal -type f 2>/dev/null || false)"
|
|
||||||
[ -f "/config/env/ssl.sh" ] && . "/config/env/ssl.sh"
|
|
||||||
[ -f "/config/certbot/env.sh" ] && . "/config/certbot/env.sh"
|
|
||||||
if [ -n "$SSL_KEY" ]; then
|
|
||||||
mkdir -p "$(dirname "$SSL_KEY")" 2>/dev/null || true
|
|
||||||
else
|
|
||||||
echo "The variable SSL_KEY is not set" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ -n "$SSL_CERT" ]; then
|
|
||||||
mkdir -p "$(dirname "$SSL_CERT")" 2>/dev/null || true
|
|
||||||
else
|
|
||||||
echo "The variable SSL_CERT is not set" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
domain_list="$CERTBOT_DOMAINS www.$CERTBOT_DOMAINS mail.$CERTBOT_DOMAINS"
|
|
||||||
domain_list="$(echo "$domain_list" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
|
||||||
if [ "$CERT_BOT_ENABLED" != "true" ]; then
|
|
||||||
export CERT_BOT_ENABLED=""
|
|
||||||
return 10
|
|
||||||
fi
|
|
||||||
if [ -z "$CERT_BOT_MAIL" ]; then
|
|
||||||
echo "The variable CERT_BOT_MAIL is not set" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ -z "$CERTBOT_DOMAINS" ]; then
|
|
||||||
echo "The variable CERTBOT_DOMAINS is not set" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
for domain in $CERTBOT_DOMAINS; do
|
|
||||||
[ -n "$domain" ] && ADD_CERTBOT_DOMAINS+="-d $domain "
|
|
||||||
done
|
|
||||||
local expand_opt=""
|
|
||||||
if [ -n "$is_renewal" ]; then
|
|
||||||
options="renew"
|
|
||||||
ADD_CERTBOT_DOMAINS=""
|
|
||||||
else
|
|
||||||
options="certonly"
|
|
||||||
expand_opt="--expand"
|
|
||||||
fi
|
|
||||||
certbot_key_opts="$ADD_CERTBOT_DOMAINS"
|
|
||||||
if [ -f "/config/certbot/setup.sh" ]; then
|
|
||||||
\bash "/config/certbot/setup.sh"
|
|
||||||
statusCode=$?
|
|
||||||
elif [ -f "/etc/named/certbot.sh" ]; then
|
|
||||||
\bash "/etc/named/certbot.sh"
|
|
||||||
statusCode=$?
|
|
||||||
elif [ -f "/config/certbot/dns.conf" ]; then
|
|
||||||
if certbot $options -n --dry-run --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/dns.conf $certbot_key_opts; then
|
|
||||||
certbot $options -n --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/dns.conf $certbot_key_opts
|
|
||||||
fi
|
|
||||||
statusCode=$?
|
|
||||||
elif [ -f "/config/certbot/certbot.conf" ]; then
|
|
||||||
if certbot $options -n --dry-run --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/certbot.conf $certbot_key_opts; then
|
|
||||||
certbot $options -n --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/certbot.conf $certbot_key_opts
|
|
||||||
fi
|
|
||||||
statusCode=$?
|
|
||||||
elif [ -f "/config/named/certbot-update.conf" ]; then
|
|
||||||
if certbot $options -n --dry-run --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/named/certbot-update.conf $certbot_key_opts; then
|
|
||||||
certbot $options -n --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/named/certbot-update.conf $certbot_key_opts
|
|
||||||
fi
|
|
||||||
statusCode=$?
|
|
||||||
else
|
|
||||||
if [ -n "$ADD_CERTBOT_DOMAINS" ]; then
|
|
||||||
certbot $options --agree-tos -m $CERT_BOT_MAIL --webroot "${WWW_ROOT_DIR:-/usr/local/share/httpd/default}" $certbot_key_opts
|
|
||||||
statusCode=$?
|
|
||||||
else
|
|
||||||
statusCode=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
[ $statusCode -eq 0 ] && __update_ssl_certs
|
|
||||||
return $statusCode
|
|
||||||
}
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
__display_user_info() {
|
__display_user_info() {
|
||||||
if [ -n "$user_name" ] || [ -n "$user_pass" ] || [ -n "$root_user_name" ] || [ -n "$root_user_pass" ]; then
|
if [ -n "$user_name" ] || [ -n "$user_pass" ] || [ -n "$root_user_name" ] || [ -n "$root_user_pass" ]; then
|
||||||
__banner "User info"
|
__banner "User info"
|
||||||
@@ -483,29 +397,26 @@ __init_config_etc() {
|
|||||||
}
|
}
|
||||||
__create_ssl_cert() {
|
__create_ssl_cert() {
|
||||||
local SSL_DIR="${SSL_DIR:-/etc/ssl}"
|
local SSL_DIR="${SSL_DIR:-/etc/ssl}"
|
||||||
if ! __certbot certonly; then
|
[ -f "/config/env/ssl.sh" ] && . "/config/env/ssl.sh"
|
||||||
[ -f "/config/env/ssl.sh" ] && . "/config/env/ssl.sh"
|
if [ -z "$SSL_DIR" ]; then
|
||||||
if [ -z "$SSL_DIR" ]; then
|
echo "SSL_DIR is unset" >&2
|
||||||
echo "SSL_DIR is unset"
|
return 1
|
||||||
return 1
|
fi
|
||||||
fi
|
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
||||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
if [ -n "$FORCE_SSL" ] || [ ! -f "$SSL_CERT" ] || [ ! -f "$SSL_KEY" ]; then
|
||||||
if [ -n "$FORCE_SSL" ] || [ ! -f "$SSL_CERT" ] || [ ! -f "$SSL_KEY" ]; then
|
echo "Setting Country to $COUNTRY and Setting State/Province to $STATE and Setting City to $CITY"
|
||||||
echo "Setting Country to $COUNTRY and Setting State/Province to $STATE and Setting City to $CITY"
|
echo "Setting OU to $UNIT and Setting ORG to $ORG and Setting server to $CN"
|
||||||
echo "Setting OU to $UNIT and Setting ORG to $ORG and Setting server to $CN"
|
echo "All variables can be overwritten by creating a /config/.ssl.env and setting the variables there"
|
||||||
echo "All variables can be overwritten by creating a /config/.ssl.env and setting the variables there"
|
echo "Creating ssl key and certificate in $SSL_DIR and will be valid for $((VALID_FOR / 365)) year[s]"
|
||||||
echo "Creating ssl key and certificate in $SSL_DIR and will be valid for $((VALID_FOR / 365)) year[s]"
|
openssl req \
|
||||||
#
|
-new \
|
||||||
openssl req \
|
-newkey rsa:$RSA \
|
||||||
-new \
|
-days $VALID_FOR \
|
||||||
-newkey rsa:$RSA \
|
-nodes \
|
||||||
-days $VALID_FOR \
|
-x509 \
|
||||||
-nodes \
|
-subj "/C=${COUNTRY// /\\ }/ST=${STATE// /\\ }/L=${CITY// /\\ }/O=${ORG// /\\ }/OU=${UNIT// /\\ }/CN=${CN// /\\ }" \
|
||||||
-x509 \
|
-keyout "$SSL_KEY" \
|
||||||
-subj "/C=${COUNTRY// /\\ }/ST=${STATE// /\\ }/L=${CITY// /\\ }/O=${ORG// /\\ }/OU=${UNIT// /\\ }/CN=${CN// /\\ }" \
|
-out "$SSL_CERT"
|
||||||
-keyout "$SSL_KEY" \
|
|
||||||
-out "$SSL_CERT"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then
|
if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then
|
||||||
__update_ssl_certs
|
__update_ssl_certs
|
||||||
@@ -577,7 +488,6 @@ __init_couchdb() {
|
|||||||
# Show available init functions
|
# Show available init functions
|
||||||
__init_help() {
|
__init_help() {
|
||||||
echo '
|
echo '
|
||||||
__certbot
|
|
||||||
__update_ssl_certs
|
__update_ssl_certs
|
||||||
__create_ssl_cert
|
__create_ssl_cert
|
||||||
'
|
'
|
||||||
@@ -1533,27 +1443,16 @@ __is_htdocs_mounted() {
|
|||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__initialize_ssl_certs() {
|
__initialize_ssl_certs() {
|
||||||
[ "$SSL_ENABLED" = "yes" ] && __certbot
|
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
||||||
if [ -d "/config/letsencrypt" ]; then
|
if [ "$SSL_ENABLED" = "yes" ]; then
|
||||||
mkdir -p "/etc/letsencrypt"
|
if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then
|
||||||
__file_copy "/config/letsencrypt" "/etc/letsencrypt/"
|
if [ -n "$SSL_CA" ] && [ -f "$SSL_CA" ]; then
|
||||||
elif [ -d "/etc/letsencrypt" ] && [ ! -d "/config/letsencrypt" ]; then
|
mkdir -p "$SSL_DIR/certs"
|
||||||
mkdir -p "/config/letsencrypt"
|
cat "$SSL_CA" >>"/etc/ssl/certs/ca-certificates.crt"
|
||||||
__file_copy "/etc/letsencrypt" "/config/letsencrypt/"
|
|
||||||
else
|
|
||||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
|
||||||
if [ "$SSL_ENABLED" = "true" ] || [ "$SSL_ENABLED" = "yes" ]; then
|
|
||||||
if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then
|
|
||||||
SSL_ENABLED="true"
|
|
||||||
if [ -n "$SSL_CA" ] && [ -f "$SSL_CA" ]; then
|
|
||||||
mkdir -p "$SSL_DIR/certs"
|
|
||||||
cat "$SSL_CA" >>"/etc/ssl/certs/ca-certificates.crt"
|
|
||||||
cp -Rf "/." "$SSL_DIR/"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
|
||||||
__create_ssl_cert
|
|
||||||
fi
|
fi
|
||||||
|
__update_ssl_certs
|
||||||
|
else
|
||||||
|
__create_ssl_cert
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
type update-ca-certificates &>/dev/null && update-ca-certificates &>/dev/null
|
type update-ca-certificates &>/dev/null && update-ca-certificates &>/dev/null
|
||||||
@@ -1743,6 +1642,6 @@ export ENTRYPOINT_DATA_INIT_FILE DATA_DIR_INITIALIZED ENTRYPOINT_CONFIG_INIT_FIL
|
|||||||
export ENTRYPOINT_PID_FILE ENTRYPOINT_INIT_FILE ENTRYPOINT_FIRST_RUN
|
export ENTRYPOINT_PID_FILE ENTRYPOINT_INIT_FILE ENTRYPOINT_FIRST_RUN
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# export the functions
|
# export the functions
|
||||||
export -f __get_pid __start_init_scripts __is_running __certbot __update_ssl_certs __create_ssl_cert
|
export -f __get_pid __start_init_scripts __is_running __update_ssl_certs __create_ssl_cert
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# end of functions
|
# end of functions
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ DATABASE_DIR_SUPABASE="${DATABASE_DIR_SUPABASE:-$DATABASE_BASE_DIR/supabase}"
|
|||||||
DOCKER_HOST="unix://var/run/docker.sock"
|
DOCKER_HOST="unix://var/run/docker.sock"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# File locations
|
# File locations
|
||||||
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
|
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}"
|
||||||
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
|
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
|
||||||
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
|
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
|
||||||
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
|
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# File locations
|
# File locations
|
||||||
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
|
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}"
|
||||||
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
|
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
|
||||||
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
|
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
|
||||||
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
|
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
|
||||||
|
|||||||
Reference in New Issue
Block a user