QUIET='n'
SIMULATE="n"
-VERSION="0.2.2"
+VERSION="0.3.0"
BASE_NAME="$(basename ${0})"
BASE_DIR="$(dirname ${0})"
ARCH="x86_64"
HAS_MOUNTED="n"
-MOUNTPOINT="/var/tmp/centos8-stream-${ARCH}"
+MOUNTPOINT_ROOT="/var/tmp/centos8-stream-${ARCH}"
IMAGE_ROOT="/var/www/cobbler/ks_mirror"
IMAGE_DIR="${IMAGE_ROOT}/CentOS-8-Stream-${ARCH}"
LAST_TSTAMP="0"
;;
-q|--quiet)
QUIET="y"
+ RED=""
+ YELLOW=""
+ GREEN=""
+ BLUE=""
+ CYAN=""
+ NORMAL=""
shift
;;
--nocolor)
}
+#------------------------------------------------------------------------------
+MKDIR() {
+
+ local cmd="mkdir $*"
+ if [[ "${VERBOSE}" == "y" ]] ; then
+ cmd="mkdir --verbose $*"
+ fi
+ if [[ "${SIMULATE}" == "y" ]] ; then
+ info "Executing: ${cmd}"
+ return
+ fi
+ debug "Executing: ${cmd}"
+ eval ${cmd}
+}
+
#------------------------------------------------------------------------------
set_locale() {
}
+#------------------------------------------------------------------------------
+check_dirs() {
+
+ info "Checking directories ..."
+
+ local dir=
+ local all_ok="y"
+
+ for dir in "${IMAGE_ROOT}" ; do
+ debug "Checking '${CYAN}${dir}${NORMAL}' ..."
+ if [[ ! -d "${dir}" ]] ; then
+ error "Directory '${RED}${dir}${NORMAL}' not found."
+ all_ok="n"
+ fi
+ done
+
+ if [[ "${all_ok}" != "y" ]] ; then
+ exit 5
+ fi
+
+ for dir in "${MOUNTPOINT_ROOT}" ; do
+ debug "Checking '${CYAN}${dir}${NORMAL}' ..."
+ if [[ ! -d "${dir}" ]] ; then
+ MKDIR -p "${dir}"
+ fi
+ done
+
+}
+
#------------------------------------------------------------------------------
create_urls() {
check_preferences
LOGFILE="${LOG_ROOTDIR}/${LOG_BASENAME}"
+ check_dirs
empty_line
dline