mirror of
https://github.com/dockersrc/go
synced 2026-07-14 17:45:54 -04:00
711972c88b
Build and Push / build (push) Has been cancelled
Finish syncing generated Docker template files against upstream templates: remove dead template-files ARGs from the Dockerfile, sync bin-script boilerplate to the current shell/sh template, migrate the non-standard rootfs/etc dir to rootfs/tmp/etc, fix a gitignore bug that silently dropped rootfs/tmp/, correct the README license, and document the go-tools toolchain-stage exception in the runbook. - AI.md: document that language toolchain build stages (e.g. `FROM golang:alpine AS go-tools`) are intentionally exempt from the PULL_URL/GEN_DOCKERFILE_APP_DIR org rule - Dockerfile: remove dead DEFAULT_FILE_DIR/DEFAULT_DATA_DIR/DEFAULT_CONF_DIR/DEFAULT_TEMPLATE_DIR ARGs and their mkdir usage — the template-files directory no longer exists - README.md: fix stale license claim (MIT) to match the actual LICENSE.md (WTFPL) - .gitignore: anchor the tmp/ pattern to /tmp/ so it stops silently swallowing the required rootfs/tmp/ directory - rootfs/etc/profile.d/go.sh -> rootfs/tmp/etc/profile.d/go.sh: migrate the non-standard rootfs/etc dir to the tmp/etc convention (rootfs/root, rootfs/tmp, rootfs/usr are the only valid rootfs root dirs; 03-files.sh copies tmp/etc/* at build time) - rootfs/usr/local/bin/copy, rootfs/usr/local/bin/symlink: sync APPNAME assignment to the current template style and add the missing trap '' EXIT line - rootfs/usr/local/bin/healthcheck: sync APPNAME assignment and add the missing trap '' EXIT line AI.md Dockerfile .gitignore README.md rootfs/etc/profile.d/go.sh rootfs/tmp/ rootfs/usr/local/bin/copy rootfs/usr/local/bin/healthcheck rootfs/usr/local/bin/symlink
81 lines
2.7 KiB
Bash
Executable File
81 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# shellcheck shell=sh
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
##@Version : 202605051306-git
|
|
# @@Author : Jason Hempstead
|
|
# @@Contact : jason@casjaysdev.pro
|
|
# @@License : WTFPL
|
|
# @@ReadME : copy --help
|
|
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
|
|
# @@Created : Tuesday, May 05, 2026 13:06 EDT
|
|
# @@File : copy
|
|
# @@Description : copies a file and shows progress
|
|
# @@Changelog : Refactored for self-contained operation
|
|
# @@TODO : Better documentation
|
|
# @@Other :
|
|
# @@Resource :
|
|
# @@Terminal App : no
|
|
# @@sudo/root : no
|
|
# @@Template : shell/sh
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
APPNAME="${0##*/}"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# colorization
|
|
if [ -n "$NO_COLOR" ]; then
|
|
__printf_color() { printf '%b' "$1\n" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
|
|
else
|
|
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf "%b" "$(tput setaf "$DEFAULT_COLOR" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
__unlink() { [ -L "$1" ] && rm -f -- "$1" >/dev/null; }
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# custom functions
|
|
__copy() {
|
|
exitCode=0
|
|
if [ -d "$1" ]; then
|
|
__printf_color "Copying $1/* to $2/"
|
|
__unlink "$2"
|
|
mkdir -p "$2"
|
|
for f in "$1"/* "$1"/.[!.]* "$1"/..?*; do
|
|
[ -e "$f" ] || [ -L "$f" ] || continue
|
|
base=$(basename -- "$f")
|
|
__copy "$f" "$2/$base" || exitCode=$?
|
|
done
|
|
elif [ -f "$1" ] || [ -L "$1" ]; then
|
|
__printf_color "Copying $1 to $2"
|
|
__unlink "$2"
|
|
cp -Rf "$1" "$2"
|
|
exitCode=$?
|
|
fi
|
|
return $exitCode
|
|
}
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Define variables
|
|
DEFAULT_COLOR="254"
|
|
COPY_EXIT_STATUS=0
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
trap '' EXIT
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Main application
|
|
if [ $# -ne 2 ]; then
|
|
__printf_color "USAGE: $APPNAME to from" "1" >&2
|
|
COPY_EXIT_STATUS=1
|
|
elif [ ! -e "$1" ]; then
|
|
__printf_color "$1 does not exist" >&2
|
|
COPY_EXIT_STATUS=2
|
|
else
|
|
__printf_color "Copying $1 to $2" "4"
|
|
__copy "$1" "$2" >/dev/null
|
|
COPY_EXIT_STATUS=$?
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# End application
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# lets exit with code
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
exit $COPY_EXIT_STATUS
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# ex: ts=2 sw=2 et filetype=sh
|