TT#37257 Structure the code inside scripts/services for further refactoring

Change-Id: Iaba999afc50f9ac4588e3129d4466ac0ad9cc02e
changes/93/23493/5
Alexander Lutay 8 years ago
parent 7fa3b63fcd
commit 1a2456da05

@ -113,6 +113,28 @@ systed_daemon_reload_preset() {
fi
}
is_absolute_path() {
local dir=$1
if [[ ! "${dir}" =~ ^/ ]] ; then
log_error "${dir} is not an absolute path"
return 1
fi
return 0
}
is_non_git_folder() {
local dir=$1
if [[ ! -d "${dir}/.git" ]] ; then
log_info "${dir} has no support of .services"
return 1
fi
return 0
}
# main script
DRYRUN='false'
@ -132,15 +154,9 @@ TMPFILE="$(mktemp)"
log_debug "TMPFILE = $TMPFILE"
for dir in ${CONFIG_POOL} ; do
if ! [[ "${dir}" =~ ^/ ]] ; then
log_error "${dir} is not an absolute path"
continue
fi
is_absolute_path "${dir}" || continue
is_non_git_folder "${dir}" || continue
pushd "${dir}" >/dev/null
if [ ! -d .git ] ; then
log_info "$dir has no support of .services"
continue
fi
for file in $(git status --porcelain | sed 's/^...//') ; do
if [ -r "$file" ] && [ -r "${SERVICES_POOL_BASE}/${dir}/${file}".services ] ; then
log_debug "unifyer ${SERVICES_POOL_BASE}/${dir}/${file}.services"

Loading…
Cancel
Save