Sync template with config-backup

This commit is contained in:
Out Of Ideas 2023-11-30 14:56:03 -06:00
parent 1d28ba0c2d
commit 388f10e904

View file

@ -1,4 +1,5 @@
#!/usr/local/bin/bash
#!/bin/bash
############################################################ ############################################################
# scriptTemplate # # scriptTemplate #
# # # #
@ -63,7 +64,29 @@ Help()
} }
############################################################ ############################################################
# Check fer root # # Public Domain Declaration #
############################################################
PUBLIC_DOMAIN_DECLARATION='
This software is hereby released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, with or without modification. There are no restrictions or requirements for the use of this software.
This software is provided "as is," without any warranty, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, or non-infringement. In no event shall the authors be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with this software or the use or other dealings in this software.
To the fullest extent possible under law, the authors have waived all copyright and patent rights to this software. You are free to use this software without any restrictions on copyright or patent rights.
This Public Domain declaration, including the waiver of
copyright and patent rights, applies to the full extent
permitted by applicable laws and regulations.
'
############################################################
# Version #
############################################################
VERSION="scripTemplate v0"
############################################################
# Check for root #
############################################################ ############################################################
CheckRoot() CheckRoot()
{ {
@ -75,6 +98,25 @@ CheckRoot()
fi fi
} }
############################################################
# Check for user #
############################################################
CheckUser()
{
# If we are running as root, we exit the program.
if [ `id -u` == 0 ]
then
echo "ERROR: You must NOT be root user to run this program"
exit
fi
}
############################################################
# Check for dependencies #
############################################################
############################################################ ############################################################
############################################################ ############################################################
# Main Program # # Main Program #
@ -88,27 +130,43 @@ CheckRoot()
# Sanity checks # # Sanity checks #
############################################################ ############################################################
# Are we running as root? # Are we running as root?
# CheckRoot #CheckRoot
CheckUser
# Is 'git' comand found?
CheckGit
# Initialize variables
option="" option=""
Msg="Hello world!" Msg=""
# Unset variables
unset VERBOSE
############################################################ ############################################################
# Process the input options. Add options as needed. # # Process the input options. Add options as needed. #
############################################################ ############################################################
# Get the options # Get the options
while getopts ":h" option; do while getopts ":hpvV" option;
do
case $option in case $option in
h) # display Help h) # display Help
Help Help
exit;; exit;;
p) # display $PUBLIC_DOMAIN_DECLARATION
echo $PUBLIC_DOMAIN_DECLARATION
exit;;
v) # enable $VERBOSE
VERBOSE=true;;
V) # display $VERSION
echo $VERSION
exit;;
\?) # incorrect option \?) # incorrect option
echo "Error: Invalid option" echo "Error: Invalid option"
exit;; exit;;
esac esac
done done
echo "$Msg" # Display a message before the program starts
#echo "$Msg"