mirror of
https://github.com/dockersrc/debian
synced 2025-11-30 04:12:58 -05:00
🗃️ Fixed rootfs/** files 🗃️
Some checks failed
Some checks failed
Dockerfile .env.scripts 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/copy rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/bin/symlink rootfs/usr/local/etc/docker/functions/entrypoint.sh
This commit is contained in:
41
.env.scripts
41
.env.scripts
@@ -1,10 +1,10 @@
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202509200514-git
|
##@Version : 202511291148-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 2025 CasjaysDev
|
||||||
# @@Created : Sat Sep 20 05:14:01 AM EDT 2025
|
# @@Created : Sat Nov 29 11:48:49 AM EST 2025
|
||||||
# @@File : .env.scripts
|
# @@File : .env.scripts
|
||||||
# @@Description : Variables for gen-dockerfile and buildx scripts
|
# @@Description : Variables for gen-dockerfile and buildx scripts
|
||||||
# @@Changelog : newScript
|
# @@Changelog : newScript
|
||||||
@@ -14,32 +14,32 @@
|
|||||||
# @@Terminal App : yes
|
# @@Terminal App : yes
|
||||||
# @@sudo/root : yes
|
# @@sudo/root : yes
|
||||||
# @@Template : templates/dockerfiles/dotenv.template
|
# @@Template : templates/dockerfiles/dotenv.template
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# entrypoint Settings
|
# entrypoint Settings
|
||||||
DOCKER_ENTYPOINT_PORTS_WEB="${DOCKER_ENTYPOINT_PORTS_WEB}"
|
DOCKER_ENTYPOINT_PORTS_WEB="${DOCKER_ENTYPOINT_PORTS_WEB}"
|
||||||
DOCKER_ENTYPOINT_PORTS_SRV="${DOCKER_ENTYPOINT_PORTS_SRV}"
|
DOCKER_ENTYPOINT_PORTS_SRV="${DOCKER_ENTYPOINT_PORTS_SRV}"
|
||||||
DOCKER_ENTYPOINT_HEALTH_APPS="$DOCKER_ENTYPOINT_HEALTH_APPS"
|
DOCKER_ENTYPOINT_HEALTH_APPS="$DOCKER_ENTYPOINT_HEALTH_APPS"
|
||||||
DOCKER_ENTYPOINT_HEALTH_ENDPOINTS="$DOCKER_ENTYPOINT_HEALTH_ENDPOINTS"
|
DOCKER_ENTYPOINT_HEALTH_ENDPOINTS="$DOCKER_ENTYPOINT_HEALTH_ENDPOINTS"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Dockerfile info
|
# Dockerfile info
|
||||||
ENV_DOCKERFILE="Dockerfile"
|
ENV_DOCKERFILE="Dockerfile"
|
||||||
ENV_IMAGE_NAME="debian"
|
ENV_IMAGE_NAME="debian"
|
||||||
ENV_USE_TEMPLATE="debian"
|
ENV_USE_TEMPLATE="debian"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Maintainer info
|
# Maintainer info
|
||||||
ENV_ORG_NAME="casjaysdev"
|
ENV_ORG_NAME="casjaysdev"
|
||||||
ENV_VENDOR="CasjaysDev"
|
ENV_VENDOR="CasjaysDev"
|
||||||
ENV_AUTHOR="CasjaysDev"
|
ENV_AUTHOR="CasjaysDev"
|
||||||
ENV_MAINTAINER="CasjaysDev <docker-admin@casjaysdev.pro>"
|
ENV_MAINTAINER="CasjaysDev <docker-admin@casjaysdev.pro>"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Repository URLs (Full URLs)
|
# Repository URLs (Full URLs)
|
||||||
# ENV_GIT_REPO_URL: Complete Git repository URL for source code
|
# ENV_GIT_REPO_URL: Complete Git repository URL for source code
|
||||||
ENV_GIT_REPO_URL="https://github.com/casjaysdevdocker/debian"
|
ENV_GIT_REPO_URL="https://github.com/casjaysdevdocker/debian"
|
||||||
# ENV_REGISTRY_URL: Complete registry URL for reference (NOT used for pushing)
|
# ENV_REGISTRY_URL: Complete registry URL for reference (NOT used for pushing)
|
||||||
ENV_REGISTRY_URL="docker.io/casjaysdevdocker/debian"
|
ENV_REGISTRY_URL="https://hub.docker.com/casjaysdevdocker/debian"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Push Configuration
|
# Push Configuration
|
||||||
# ENV_IMAGE_PUSH: Complete push destination (this IS used for pushing)
|
# ENV_IMAGE_PUSH: Complete push destination (this IS used for pushing)
|
||||||
ENV_IMAGE_PUSH="casjaysdev/debian"
|
ENV_IMAGE_PUSH="casjaysdev/debian"
|
||||||
@@ -47,33 +47,36 @@ ENV_IMAGE_PUSH="casjaysdev/debian"
|
|||||||
ENV_IMAGE_TAG="latest"
|
ENV_IMAGE_TAG="latest"
|
||||||
# ENV_ADD_TAGS: Additional tags, comma-separated (USE_DATE = auto date tag)
|
# ENV_ADD_TAGS: Additional tags, comma-separated (USE_DATE = auto date tag)
|
||||||
ENV_ADD_TAGS="USE_DATE"
|
ENV_ADD_TAGS="USE_DATE"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Additional push destinations (if needed)
|
# Additional push destinations (if needed)
|
||||||
ENV_ADD_IMAGE_PUSH=""
|
ENV_ADD_IMAGE_PUSH=""
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Pull Configuration
|
# Pull Configuration
|
||||||
# ENV_PULL_URL: Source image to pull from (base image)
|
# ENV_PULL_URL: Source image to pull from (base image)
|
||||||
ENV_PULL_URL="debian"
|
ENV_PULL_URL="debian"
|
||||||
# ENV_DISTRO_TAG: Tag for the pull source image
|
# ENV_DISTRO_TAG: Tag for the pull source image
|
||||||
ENV_DISTRO_TAG="${IMAGE_VERSION}"
|
ENV_DISTRO_TAG="${IMAGE_VERSION}"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Env
|
# Env
|
||||||
SERVICE_PORT=""
|
SERVICE_PORT=""
|
||||||
EXPOSE_PORTS=""
|
EXPOSE_PORTS=""
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
# IF using a lanuage such as go, php, rust, ruby, etc set the version here.
|
||||||
|
LANG_VERSION=""
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Versions
|
# Versions
|
||||||
PHP_VERSION="system"
|
PHP_VERSION="system"
|
||||||
NODE_VERSION="system"
|
NODE_VERSION="system"
|
||||||
NODE_MANAGER="system"
|
NODE_MANAGER="system"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Default directories
|
# Default directories
|
||||||
WWW_ROOT_DIR="/usr/local/share/httpd/default"
|
WWW_ROOT_DIR="/usr/local/share/httpd/default"
|
||||||
DEFAULT_FILE_DIR="/usr/local/share/template-files"
|
DEFAULT_FILE_DIR="/usr/local/share/template-files"
|
||||||
DEFAULT_DATA_DIR="/usr/local/share/template-files/data"
|
DEFAULT_DATA_DIR="/usr/local/share/template-files/data"
|
||||||
DEFAULT_CONF_DIR="/usr/local/share/template-files/config"
|
DEFAULT_CONF_DIR="/usr/local/share/template-files/config"
|
||||||
DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults"
|
DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
ENV_PACKAGES="bash-completion git curl wget sudo unzip tini xz-utils iproute2 pinentry-curses bsd-mailx procps net-tools bsd-mailx postfix python3-icu python3-pip certbot ca-certificates jq "
|
ENV_PACKAGES="bash-completion git curl wget sudo unzip tini xz-utils iproute2 pinentry-curses bsd-mailx procps net-tools bsd-mailx postfix python3-icu python3-pip certbot ca-certificates jq "
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# ex: ts=2 sw=2 et filetype=sh
|
# ex: ts=2 sw=2 et filetype=sh
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@@ -1,7 +1,7 @@
|
|||||||
# Docker image for debian using the debian template
|
# Docker image for debian using the debian template
|
||||||
ARG IMAGE_NAME="debian"
|
ARG IMAGE_NAME="debian"
|
||||||
ARG PHP_SERVER="debian"
|
ARG PHP_SERVER="debian"
|
||||||
ARG BUILD_DATE="202509161149"
|
ARG BUILD_DATE="202511291148"
|
||||||
ARG LANGUAGE="en_US.UTF-8"
|
ARG LANGUAGE="en_US.UTF-8"
|
||||||
ARG TIMEZONE="America/New_York"
|
ARG TIMEZONE="America/New_York"
|
||||||
ARG WWW_ROOT_DIR="/usr/local/share/httpd/default"
|
ARG WWW_ROOT_DIR="/usr/local/share/httpd/default"
|
||||||
@@ -227,12 +227,12 @@ LABEL org.opencontainers.image.authors="${LICENSE}"
|
|||||||
LABEL org.opencontainers.image.created="${BUILD_DATE}"
|
LABEL org.opencontainers.image.created="${BUILD_DATE}"
|
||||||
LABEL org.opencontainers.image.version="${BUILD_VERSION}"
|
LABEL org.opencontainers.image.version="${BUILD_VERSION}"
|
||||||
LABEL org.opencontainers.image.schema-version="${BUILD_VERSION}"
|
LABEL org.opencontainers.image.schema-version="${BUILD_VERSION}"
|
||||||
LABEL org.opencontainers.image.url="docker.io"
|
LABEL org.opencontainers.image.url="https://hub.docker.com/casjaysdevdocker/debian"
|
||||||
LABEL org.opencontainers.image.source="docker.io"
|
LABEL org.opencontainers.image.source="https://hub.docker.com/casjaysdevdocker/debian"
|
||||||
LABEL org.opencontainers.image.vcs-type="Git"
|
LABEL org.opencontainers.image.vcs-type="Git"
|
||||||
LABEL org.opencontainers.image.revision="${BUILD_VERSION}"
|
LABEL org.opencontainers.image.revision="${BUILD_VERSION}"
|
||||||
LABEL org.opencontainers.image.source="https://github.com/casjaysdev/debian"
|
LABEL org.opencontainers.image.source="https://github.com/casjaysdevdocker/debian"
|
||||||
LABEL org.opencontainers.image.documentation="https://github.com/casjaysdev/debian"
|
LABEL org.opencontainers.image.documentation="https://github.com/casjaysdevdocker/debian"
|
||||||
LABEL com.github.containers.toolbox="false"
|
LABEL com.github.containers.toolbox="false"
|
||||||
|
|
||||||
ENV ENV=~/.bashrc
|
ENV ENV=~/.bashrc
|
||||||
@@ -262,6 +262,5 @@ EXPOSE ${SERVICE_PORT} ${ENV_PORTS}
|
|||||||
|
|
||||||
STOPSIGNAL SIGRTMIN+3
|
STOPSIGNAL SIGRTMIN+3
|
||||||
|
|
||||||
CMD [ "tail", "-f", "/dev/null" ]
|
|
||||||
ENTRYPOINT [ "tini", "-p", "SIGTERM","--", "/usr/local/bin/entrypoint.sh" ]
|
ENTRYPOINT [ "tini", "-p", "SIGTERM","--", "/usr/local/bin/entrypoint.sh" ]
|
||||||
HEALTHCHECK --start-period=10m --interval=5m --timeout=15s CMD [ "/usr/local/bin/entrypoint.sh", "healthcheck" ]
|
HEALTHCHECK --start-period=10m --interval=5m --timeout=15s CMD [ "/usr/local/bin/entrypoint.sh", "healthcheck" ]
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:21 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@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
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:21 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@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
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:21 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@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
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:21 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@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
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:21 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@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
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:22 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@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
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:22 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@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
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510221732-git
|
##@Version : 202511291153-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 2025 CasjaysDev
|
||||||
# @@Created : Wed Oct 22 05:32:22 PM EDT 2025
|
# @@Created : Sat Nov 29 11:53:08 AM EST 2025
|
||||||
# @@File : 07-cleanup.sh
|
# @@File : 07-cleanup.sh
|
||||||
# @@Description : script to run cleanup
|
# @@Description : script to run cleanup
|
||||||
# @@Changelog : newScript
|
# @@Changelog : newScript
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# @@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
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# shellcheck shell=sh
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
##@Version : 202408102055-git
|
|
||||||
# @@Author : Jason Hempstead
|
|
||||||
# @@Contact : jason@casjaysdev.pro
|
|
||||||
# @@License : LICENSE.md
|
|
||||||
# @@ReadME : copy --help
|
|
||||||
# @@Copyright : Copyright: (c) 2024 Jason Hempstead, Casjays Developments
|
|
||||||
# @@Created : Saturday, Aug 10, 2024 20:55 EDT
|
|
||||||
# @@File : copy
|
|
||||||
# @@Description : copies a file and shows progress
|
|
||||||
# @@Changelog : New script
|
|
||||||
# @@TODO : Better documentation
|
|
||||||
# @@Other :
|
|
||||||
# @@Resource :
|
|
||||||
# @@Terminal App : no
|
|
||||||
# @@sudo/root : no
|
|
||||||
# @@Template : shell/bash
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
# shellcheck disable=SC2031
|
|
||||||
# shellcheck disable=SC2120
|
|
||||||
# shellcheck disable=SC2155
|
|
||||||
# shellcheck disable=SC2199
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# script variables
|
|
||||||
APPNAME="$(basename "$0" 2>/dev/null)"
|
|
||||||
VERSION="202408102055-git"
|
|
||||||
RUN_USER="$USER"
|
|
||||||
SET_UID="$(id -u)"
|
|
||||||
COPY_CWD="$(realpath "$PWD")"
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# script functions
|
|
||||||
if [ "$SHOW_RAW" != "true" ]; then
|
|
||||||
__printf_color() { printf "%b" "$(tput setaf "${2:-$DEFAULT_COLOR}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
|
|
||||||
else
|
|
||||||
# Disable colorization
|
|
||||||
__printf_color() { printf '%b\n' "$1" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# check for command
|
|
||||||
__cmd_exists() { which $1 >/dev/null 2>&1 || return 1; }
|
|
||||||
__function_exists() { builtin type $1 >/dev/null 2>&1 || return 1; }
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# custom functions
|
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# Define Variables
|
|
||||||
DEFAULT_COLOR="7"
|
|
||||||
COPY_EXIT_STATUS=0
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# Main application
|
|
||||||
{ [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; }
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
is_link="$(ls -la "$2" 2>/dev/null | awk '{print $NF}')"
|
|
||||||
if [ "$1" != "$is_link" ]; then
|
|
||||||
if [ -d "$1" ]; then
|
|
||||||
mkdir -p "$2"
|
|
||||||
cp -Rf "$1/." "$2/"
|
|
||||||
COPY_EXIT_STATUS=$?
|
|
||||||
elif [ -e "$1" ]; then
|
|
||||||
cp -Rf "$1" "$2"
|
|
||||||
COPY_EXIT_STATUS=$?
|
|
||||||
else
|
|
||||||
COPY_EXIT_STATUS=2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# End application
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# lets exit with code
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
exit $COPY_EXIT_STATUS
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# ex: ts=2 sw=2 et filetype=sh
|
|
||||||
|
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : GEN_SCRIPT_REPLACE_VERSION
|
##@Version : 202511291153-git
|
||||||
# @@Author : GEN_SCRIPT_REPLACE_AUTHOR
|
# @@Author : Jason Hempstead
|
||||||
# @@Contact : GEN_SCRIPT_REPLACE_EMAIL
|
# @@Contact : jason@casjaysdev.pro
|
||||||
# @@License : GEN_SCRIPT_REPLACE_LICENSE
|
# @@License : WTFPL
|
||||||
# @@ReadME : entrypoint.sh --help
|
# @@ReadME : entrypoint.sh --help
|
||||||
# @@Copyright : GEN_SCRIPT_REPLACE_COPYRIGHT
|
# @@Copyright : Copyright: (c) 2025 Jason Hempstead, Casjays Developments
|
||||||
# @@Created : GEN_SCRIPT_REPLACE_DATE
|
# @@Created : Saturday, Nov 29, 2025 11:53 EST
|
||||||
# @@File : entrypoint.sh
|
# @@File : entrypoint.sh
|
||||||
# @@Description : Entrypoint file for GEN_SCRIPT_REPLACE_APPNAME
|
# @@Description : Entrypoint file for debian
|
||||||
# @@Changelog : GEN_SCRIPT_REPLACE_CHANGELOG
|
# @@Changelog : New script
|
||||||
# @@TODO : GEN_SCRIPT_REPLACE_TODO
|
# @@TODO : Better documentation
|
||||||
# @@Other : GEN_SCRIPT_REPLACE_OTHER
|
# @@Other :
|
||||||
# @@Resource : GEN_SCRIPT_REPLACE_RES
|
# @@Resource :
|
||||||
# @@Terminal App : GEN_SCRIPT_REPLACE_TERMINAL
|
# @@Terminal App : no
|
||||||
# @@sudo/root : GEN_SCRIPT_REPLACE_SUDO
|
# @@sudo/root : no
|
||||||
# @@Template : other/docker-entrypoint
|
# @@Template : other/docker-entrypoint
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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
|
||||||
@@ -31,7 +31,7 @@ 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="GEN_SCRIPT_REPLACE_APPNAME"
|
CONTAINER_NAME="debian"
|
||||||
SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)"
|
SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)"
|
||||||
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
|
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -84,8 +84,8 @@ SERVICE_UID="${SERVICE_UID:-0}" # set the user id
|
|||||||
SERVICE_GID="${SERVICE_GID:-0}" # set the group id
|
SERVICE_GID="${SERVICE_GID:-0}" # set the group id
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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:-GEN_SCRIPT_REPLACE_APPNAME}" # execute command as another user
|
#SERVICE_USER="${SERVICE_USER:-debian}" # execute command as another user
|
||||||
SERVICE_GROUP="${SERVICE_GROUP:-GEN_SCRIPT_REPLACE_APPNAME}" # Set the service group
|
#SERVICE_GROUP="${SERVICE_GROUP:-debian}" # Set the service group
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Secondary ports
|
# Secondary ports
|
||||||
SERVER_PORTS="" # specifiy other ports
|
SERVER_PORTS="" # specifiy other ports
|
||||||
@@ -258,7 +258,7 @@ fi
|
|||||||
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||||
# Show start message
|
# Show start message
|
||||||
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
||||||
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && echo "Executing entrypoint script for GEN_SCRIPT_REPLACE_APPNAME"
|
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && echo "Executing entrypoint script for debian"
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set reusable variables
|
# Set reusable variables
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# shellcheck shell=sh
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
##@Version : 202408102055-git
|
|
||||||
# @@Author : Jason Hempstead
|
|
||||||
# @@Contact : jason@casjaysdev.pro
|
|
||||||
# @@License : LICENSE.md
|
|
||||||
# @@ReadME : symlink --help
|
|
||||||
# @@Copyright : Copyright: (c) 2024 Jason Hempstead, Casjays Developments
|
|
||||||
# @@Created : Saturday, Aug 10, 2024 20:55 EDT
|
|
||||||
# @@File : symlink
|
|
||||||
# @@Description : symlink a file and shows progress
|
|
||||||
# @@Changelog : New script
|
|
||||||
# @@TODO : Better documentation
|
|
||||||
# @@Other :
|
|
||||||
# @@Resource :
|
|
||||||
# @@Terminal App : no
|
|
||||||
# @@sudo/root : no
|
|
||||||
# @@Template : shell/bash
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
# shellcheck disable=SC2031
|
|
||||||
# shellcheck disable=SC2120
|
|
||||||
# shellcheck disable=SC2155
|
|
||||||
# shellcheck disable=SC2199
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# script variables
|
|
||||||
APPNAME="$(basename "$0" 2>/dev/null)"
|
|
||||||
VERSION="202408102055-git"
|
|
||||||
RUN_USER="$USER"
|
|
||||||
SET_UID="$(id -u)"
|
|
||||||
COPY_CWD="$(realpath "$PWD")"
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# script functions
|
|
||||||
if [ "$SHOW_RAW" != "true" ]; then
|
|
||||||
__printf_color() { printf "%b" "$(tput setaf "${2:-$DEFAULT_COLOR}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
|
|
||||||
else
|
|
||||||
# Disable colorization
|
|
||||||
__printf_color() { printf '%b\n' "$1" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# check for command
|
|
||||||
__cmd_exists() { which $1 >/dev/null 2>&1 || return 1; }
|
|
||||||
__function_exists() { builtin type $1 >/dev/null 2>&1 || return 1; }
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# custom functions
|
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# Define Variables
|
|
||||||
DEFAULT_COLOR="7"
|
|
||||||
SYMLINK_EXIT_STATUS=0
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# Main application
|
|
||||||
{ [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; }
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
is_link="$(ls -la "$2" 2>/dev/null | awk '{print $NF}')"
|
|
||||||
if [ "$1" != "$is_link" ]; then
|
|
||||||
if [ -e "$1" ]; then
|
|
||||||
ln -sf "$1" "$2"
|
|
||||||
SYMLINK_EXIT_STATUS=$?
|
|
||||||
else
|
|
||||||
SYMLINK_EXIT_STATUS=2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# End application
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# lets exit with code
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
exit $SYMLINK_EXIT_STATUS
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# ex: ts=2 sw=2 et filetype=sh
|
|
||||||
|
|
||||||
@@ -628,6 +628,8 @@ __set_user_group_id() {
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__create_service_user() {
|
__create_service_user() {
|
||||||
local exitStatus=0
|
local exitStatus=0
|
||||||
|
local max_attempts=100
|
||||||
|
local attempt=0
|
||||||
local create_user="${1:-$SERVICE_USER}"
|
local create_user="${1:-$SERVICE_USER}"
|
||||||
local create_group="${2:-${SERVICE_GROUP:-$create_user}}"
|
local create_group="${2:-${SERVICE_GROUP:-$create_user}}"
|
||||||
local create_home_dir="${3:-$WORK_DIR}"
|
local create_home_dir="${3:-$WORK_DIR}"
|
||||||
@@ -635,55 +637,118 @@ __create_service_user() {
|
|||||||
local create_gid="${5:-${SERVICE_GID:-$USER_GID}}"
|
local create_gid="${5:-${SERVICE_GID:-$USER_GID}}"
|
||||||
local random_id="$(__generate_random_uids)"
|
local random_id="$(__generate_random_uids)"
|
||||||
local create_home_dir="${create_home_dir:-/home/$create_user}"
|
local create_home_dir="${create_home_dir:-/home/$create_user}"
|
||||||
grep -shq "^$create_user:" "/etc/passwd" && grep -shq "^$create_group:" "/etc/group" && return
|
local log_file="/data/logs/init.txt"
|
||||||
|
# Ensure log directory exists
|
||||||
|
[ -d "$(dirname "$log_file")" ] || mkdir -p "$(dirname "$log_file")" 2>/dev/null
|
||||||
|
# Validate that we have at least a user or group to create
|
||||||
|
if [ -z "$create_user" ] && [ -z "$create_group" ]; then
|
||||||
|
echo "Error: No user or group specified to create" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
# Validate user/group name format (alphanumeric, underscore, hyphen; must start with letter or underscore)
|
||||||
|
if [ -n "$create_user" ] && ! echo "$create_user" | grep -qE '^[a-z_][a-z0-9_-]*$'; then
|
||||||
|
echo "Error: Invalid username format '$create_user' - must start with letter/underscore, contain only lowercase alphanumeric, underscore, or hyphen" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ -n "$create_group" ] && ! echo "$create_group" | grep -qE '^[a-z_][a-z0-9_-]*$'; then
|
||||||
|
echo "Error: Invalid group name format '$create_group' - must start with letter/underscore, contain only lowercase alphanumeric, underscore, or hyphen" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
# Check if user and group already exist
|
||||||
|
if grep -shq "^$create_user:" "/etc/passwd" && grep -shq "^$create_group:" "/etc/group"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# Root user/group - nothing to create
|
||||||
if [ "$create_user" = "root" ] && [ "$create_group" = "root" ]; then
|
if [ "$create_user" = "root" ] && [ "$create_group" = "root" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "$RUNAS_USER" != "root" ] && [ "$RUNAS_USER" != "" ]; then
|
# Override with RUNAS_USER if specified and not root
|
||||||
|
if [ -n "$RUNAS_USER" ] && [ "$RUNAS_USER" != "root" ]; then
|
||||||
create_user="$RUNAS_USER"
|
create_user="$RUNAS_USER"
|
||||||
create_group="$RUNAS_USER"
|
create_group="$RUNAS_USER"
|
||||||
create_uid="${create_uid:-1000}"
|
create_uid="${create_uid:-1000}"
|
||||||
create_gid="${create_gid:-1000}"
|
create_gid="${create_gid:-1000}"
|
||||||
fi
|
fi
|
||||||
create_uid="$(__get_uid "$create_user" || echo "$create_uid")"
|
# Get existing UID/GID or use provided values
|
||||||
create_gid="$(__get_gid "$create_user" || echo "$create_gid")"
|
create_uid="$(__get_uid "$create_user" 2>/dev/null || echo "$create_uid")"
|
||||||
[ -n "$create_uid" ] && [ "$create_uid" != "0" ] || create_uid="$random_id"
|
create_gid="$(__get_gid "$create_user" 2>/dev/null || echo "$create_gid")"
|
||||||
[ -n "$create_gid" ] && [ "$create_gid" != "0" ] || create_gid="$random_id"
|
# Ensure we have valid non-root UID/GID
|
||||||
while :; do
|
if [ -z "$create_uid" ] || [ "$create_uid" = "0" ]; then
|
||||||
if __check_for_uid "$create_uid" && __check_for_guid "$create_gid"; then
|
create_uid="$random_id"
|
||||||
create_uid=$(($random_id + 1))
|
|
||||||
create_gid="$create_uid"
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$create_gid" ] || [ "$create_gid" = "0" ]; then
|
||||||
|
create_gid="$random_id"
|
||||||
|
fi
|
||||||
|
# Validate UID/GID are numeric and within valid range
|
||||||
|
if ! echo "$create_uid" | grep -qE '^[0-9]+$' || [ "$create_uid" -lt 1 ] || [ "$create_uid" -gt 65534 ]; then
|
||||||
|
echo "Error: Invalid UID '$create_uid' - must be a number between 1 and 65534" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if ! echo "$create_gid" | grep -qE '^[0-9]+$' || [ "$create_gid" -lt 1 ] || [ "$create_gid" -gt 65534 ]; then
|
||||||
|
echo "Error: Invalid GID '$create_gid' - must be a number between 1 and 65534" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
# Find available UID/GID if current ones are taken (with loop protection)
|
||||||
|
while __check_for_uid "$create_uid" || __check_for_guid "$create_gid"; do
|
||||||
|
attempt=$((attempt + 1))
|
||||||
|
if [ $attempt -ge $max_attempts ]; then
|
||||||
|
echo "Error: Could not find available UID/GID after $max_attempts attempts" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
random_id=$((random_id + 1))
|
||||||
|
create_uid="$random_id"
|
||||||
|
create_gid="$random_id"
|
||||||
done
|
done
|
||||||
|
# Create group if needed
|
||||||
if [ -n "$create_group" ] && ! __check_for_group "$create_group"; then
|
if [ -n "$create_group" ] && ! __check_for_group "$create_group"; then
|
||||||
echo "creating system group $create_group"
|
echo "Creating system group '$create_group' with GID $create_gid"
|
||||||
groupadd --force --system -g $create_gid $create_group 2>/dev/stderr | tee -a "/data/logs/init.txt" >/dev/null
|
if ! groupadd --force --system -g "$create_gid" "$create_group" 2>&1 | tee -a "$log_file"; then
|
||||||
grep -shq "$create_group" "/etc/group" || exitStatus=$((exitStatus + 1))
|
echo "Error: Failed to create group '$create_group'" >&2
|
||||||
|
exitStatus=$((exitStatus + 1))
|
||||||
|
elif ! grep -shq "^$create_group:" "/etc/group"; then
|
||||||
|
echo "Error: Group '$create_group' not found in /etc/group after creation" >&2
|
||||||
|
exitStatus=$((exitStatus + 1))
|
||||||
fi
|
fi
|
||||||
if [ -n "$create_user" ] && ! __check_for_user "$create_user"; then
|
|
||||||
echo "creating system user $create_user"
|
|
||||||
useradd --system --uid $create_uid --gid $create_group --comment "Account for $create_user" --home-dir "$create_home_dir" --shell /bin/false $create_user 2>/dev/stderr | tee -a "/data/logs/init.txt" >/dev/null
|
|
||||||
grep -shq "$create_user" "/etc/passwd" || exitStatus=$((exitStatus + 1))
|
|
||||||
fi
|
fi
|
||||||
|
# Create user if needed (only if group creation succeeded)
|
||||||
|
if [ $exitStatus -eq 0 ] && [ -n "$create_user" ] && ! __check_for_user "$create_user"; then
|
||||||
|
echo "Creating system user '$create_user' with UID $create_uid"
|
||||||
|
if ! useradd --system --uid "$create_uid" --gid "$create_group" --comment "Account for $create_user" --home-dir "$create_home_dir" --shell /bin/false "$create_user" 2>&1 | tee -a "$log_file"; then
|
||||||
|
echo "Error: Failed to create user '$create_user'" >&2
|
||||||
|
exitStatus=$((exitStatus + 1))
|
||||||
|
elif ! grep -shq "^$create_user:" "/etc/passwd"; then
|
||||||
|
echo "Error: User '$create_user' not found in /etc/passwd after creation" >&2
|
||||||
|
exitStatus=$((exitStatus + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Setup user environment if creation succeeded
|
||||||
if [ $exitStatus -eq 0 ] && [ -n "$create_group" ] && [ -n "$create_user" ]; then
|
if [ $exitStatus -eq 0 ] && [ -n "$create_group" ] && [ -n "$create_user" ]; then
|
||||||
export WORK_DIR="${create_home_dir:-}"
|
export WORK_DIR="${create_home_dir:-}"
|
||||||
if [ -n "$WORK_DIR" ]; then
|
if [ -n "$WORK_DIR" ]; then
|
||||||
[ -d "$WORK_DIR" ] || mkdir -p "$WORK_DIR"
|
if [ ! -d "$WORK_DIR" ]; then
|
||||||
[ -d "/etc/.skel" ] && cp -Rf /etc/.skel/. "$WORK_DIR/"
|
if ! mkdir -p "$WORK_DIR" 2>/dev/null; then
|
||||||
|
echo "Warning: Failed to create home directory '$WORK_DIR'" >&2
|
||||||
fi
|
fi
|
||||||
if [ -d "/etc/sudoers.d" ] && [ ! -f "/etc/sudoers.d/$create_user" ]; then
|
|
||||||
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/$create_user"
|
|
||||||
elif [ -f "/etc/sudoers" ] && ! grep -qs "$create_user" "/etc/sudoers"; then
|
|
||||||
echo "$create_user ALL=(ALL) NOPASSWD: ALL" ? >>"/etc/sudoers"
|
|
||||||
fi
|
fi
|
||||||
exitStatus=0
|
if [ -d "/etc/.skel" ] && [ -d "$WORK_DIR" ]; then
|
||||||
|
cp -Rf /etc/.skel/. "$WORK_DIR/" 2>/dev/null || echo "Warning: Failed to copy skeleton files to '$WORK_DIR'" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Setup sudo access
|
||||||
|
if [ -d "/etc/sudoers.d" ]; then
|
||||||
|
if [ ! -f "/etc/sudoers.d/$create_user" ]; then
|
||||||
|
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/$create_user" 2>/dev/null || echo "Warning: Failed to create sudoers file for '$create_user'" >&2
|
||||||
|
chmod 0440 "/etc/sudoers.d/$create_user" 2>/dev/null
|
||||||
|
fi
|
||||||
|
elif [ -f "/etc/sudoers" ] && ! grep -qs "^$create_user " "/etc/sudoers"; then
|
||||||
|
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >>"/etc/sudoers" 2>/dev/null || echo "Warning: Failed to add '$create_user' to sudoers" >&2
|
||||||
|
fi
|
||||||
SERVICE_UID="$create_uid"
|
SERVICE_UID="$create_uid"
|
||||||
SERVICE_GID="$create_gid"
|
SERVICE_GID="$create_gid"
|
||||||
SERVICE_USER="$create_user"
|
SERVICE_USER="$create_user"
|
||||||
SERVICE_GROUP="$create_group"
|
SERVICE_GROUP="$create_group"
|
||||||
else
|
else
|
||||||
|
echo "Warning: Falling back to root user due to creation errors" >&2
|
||||||
SERVICE_UID=0
|
SERVICE_UID=0
|
||||||
SERVICE_GID=0
|
SERVICE_GID=0
|
||||||
SERVICE_USER=root
|
SERVICE_USER=root
|
||||||
|
|||||||
Reference in New Issue
Block a user