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:
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run init
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -o pipefail
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run system
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -o pipefail
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run packages
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -o pipefail
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run files
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -o pipefail
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run users
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -o pipefail
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run custom
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -o pipefail
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run post
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -o pipefail
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510221732-git
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@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
|
||||
# @@Description : script to run cleanup
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@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 -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
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : GEN_SCRIPT_REPLACE_VERSION
|
||||
# @@Author : GEN_SCRIPT_REPLACE_AUTHOR
|
||||
# @@Contact : GEN_SCRIPT_REPLACE_EMAIL
|
||||
# @@License : GEN_SCRIPT_REPLACE_LICENSE
|
||||
##@Version : 202511291153-git
|
||||
# @@Author : Jason Hempstead
|
||||
# @@Contact : jason@casjaysdev.pro
|
||||
# @@License : WTFPL
|
||||
# @@ReadME : entrypoint.sh --help
|
||||
# @@Copyright : GEN_SCRIPT_REPLACE_COPYRIGHT
|
||||
# @@Created : GEN_SCRIPT_REPLACE_DATE
|
||||
# @@Copyright : Copyright: (c) 2025 Jason Hempstead, Casjays Developments
|
||||
# @@Created : Saturday, Nov 29, 2025 11:53 EST
|
||||
# @@File : entrypoint.sh
|
||||
# @@Description : Entrypoint file for GEN_SCRIPT_REPLACE_APPNAME
|
||||
# @@Changelog : GEN_SCRIPT_REPLACE_CHANGELOG
|
||||
# @@TODO : GEN_SCRIPT_REPLACE_TODO
|
||||
# @@Other : GEN_SCRIPT_REPLACE_OTHER
|
||||
# @@Resource : GEN_SCRIPT_REPLACE_RES
|
||||
# @@Terminal App : GEN_SCRIPT_REPLACE_TERMINAL
|
||||
# @@sudo/root : GEN_SCRIPT_REPLACE_SUDO
|
||||
# @@Description : Entrypoint file for debian
|
||||
# @@Changelog : New script
|
||||
# @@TODO : Better documentation
|
||||
# @@Other :
|
||||
# @@Resource :
|
||||
# @@Terminal App : no
|
||||
# @@sudo/root : no
|
||||
# @@Template : other/docker-entrypoint
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# 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
|
||||
SCRIPT_FILE="$0"
|
||||
CONTAINER_NAME="GEN_SCRIPT_REPLACE_APPNAME"
|
||||
CONTAINER_NAME="debian"
|
||||
SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)"
|
||||
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
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# 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_GROUP="${SERVICE_GROUP:-GEN_SCRIPT_REPLACE_APPNAME}" # Set the service group
|
||||
#SERVICE_USER="${SERVICE_USER:-debian}" # execute command as another user
|
||||
#SERVICE_GROUP="${SERVICE_GROUP:-debian}" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Secondary ports
|
||||
SERVER_PORTS="" # specifiy other ports
|
||||
@@ -258,7 +258,7 @@ fi
|
||||
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||
# Show start message
|
||||
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
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# 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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user