mirror of
				https://github.com/dockersrc/almalinux
				synced 2025-11-04 07:02:09 -05:00 
			
		
		
		
	🗃️ Committing everything that changed 🗃️
rootfs/usr/local/bin/copy rootfs/usr/local/bin/symlink
This commit is contained in:
		
							
								
								
									
										71
									
								
								rootfs/usr/local/bin/copy
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										71
									
								
								rootfs/usr/local/bin/copy
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# shellcheck shell=bash
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
##@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)"
 | 
			
		||||
SCRIPT_SRC_DIR="${BASH_SOURCE%/*}"
 | 
			
		||||
COPY_CWD="$(realpath "$PWD")"
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# script functions
 | 
			
		||||
if [ "$SHOW_RAW" != "true" ]; then
 | 
			
		||||
  __printf_color() { printf "%b" "$(tput setaf "${2:-7}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
 | 
			
		||||
else
 | 
			
		||||
  # Disable colorization
 | 
			
		||||
  __printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && 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="254"
 | 
			
		||||
COPY_EXIT_STATUS=0
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Main application
 | 
			
		||||
if [ $# -ne 2 ] || [ ! -e "$1" ]; then
 | 
			
		||||
  __printf_color "Usage: $APPNAME from to"
 | 
			
		||||
  exit 1
 | 
			
		||||
else
 | 
			
		||||
  [ -e "$2" ] && rm -Rf "$2"
 | 
			
		||||
  cp -Rf "$1" "$2"
 | 
			
		||||
  COPY_EXIT_STATUS=$?
 | 
			
		||||
fi
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# End application
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# lets exit with code
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
exit $COPY_EXIT_STATUS
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# ex: ts=2 sw=2 et filetype=sh
 | 
			
		||||
							
								
								
									
										75
									
								
								rootfs/usr/local/bin/symlink
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										75
									
								
								rootfs/usr/local/bin/symlink
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,75 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# shellcheck shell=bash
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
##@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      :
 | 
			
		||||
# @@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)"
 | 
			
		||||
SCRIPT_SRC_DIR="${BASH_SOURCE%/*}"
 | 
			
		||||
SYMLINK_CWD="$(realpath "$PWD")"
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# script functions
 | 
			
		||||
if [ "$SHOW_RAW" != "true" ]; then
 | 
			
		||||
  __printf_color() { printf "%b" "$(tput setaf "${2:-7}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
 | 
			
		||||
else
 | 
			
		||||
  # Disable colorization
 | 
			
		||||
  __printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && 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="254"
 | 
			
		||||
SYMLINK_EXIT_STATUS=0
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Main application
 | 
			
		||||
if [ $# -ne 2 ] || [ ! -e "$1" ]; then
 | 
			
		||||
  __printf_color "Usage: $APPNAME from to"
 | 
			
		||||
  exit 1
 | 
			
		||||
else
 | 
			
		||||
  if [ -L "$2" ]; then
 | 
			
		||||
    unlink "$2"
 | 
			
		||||
  elif [ -e "$2" ]; then
 | 
			
		||||
    rm -Rf "$2"
 | 
			
		||||
  fi
 | 
			
		||||
  ln -sf "$1" "$2"
 | 
			
		||||
  SYMLINK_EXIT_STATUS=$?
 | 
			
		||||
fi
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# End application
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# lets exit with code
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
exit $SYMLINK_EXIT_STATUS
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# ex: ts=2 sw=2 et filetype=sh
 | 
			
		||||
		Reference in New Issue
	
	Block a user