tidy script init (4/4) - top level cmd "auto redirect" handling

Partial fix for #952919

Gbp-Dch: Short
Closes: #952919
This commit is contained in:
Lyndon Brown 2020-02-22 02:46:28 +00:00 committed by Luca Boccassi
parent dff08fa3f7
commit b4598b234c
4 changed files with 30 additions and 27 deletions

View File

@ -29,3 +29,24 @@ Init_config_data ()
Read_conffiles $(Common_config_files)
Set_defaults
}
Maybe_auto_redirect ()
{
local TYPE="${1}"; shift
case "${TYPE}" in
clean|config|build)
;;
*)
Echo_error "Unknown auto redirect type"
exit 1
;;
esac
local AUTO_SCRIPT="auto/${TYPE}"
if [ -x "${AUTO_SCRIPT}" ]; then
Echo_message "Executing ${AUTO_SCRIPT} script."
./"${AUTO_SCRIPT}" "${@}"
exit ${?}
fi
}

View File

@ -17,16 +17,10 @@ set -e
Auto_build_config
# Redirecting to auto script if required
if [ "${1}" != "noauto" ] && [ -x auto/build ]
then
Echo_message "Executing auto/build script."
./auto/build "${@}"
exit ${?}
fi
if [ "${1}" = "noauto" ]
then
if [ "${1}" = "noauto" ]; then
shift
else
Maybe_auto_redirect build
fi
# Setting static variables

View File

@ -14,16 +14,10 @@ set -e
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
# Redirecting to auto script if required
if [ "${1}" != "noauto" ] && [ -x auto/clean ]
then
Echo_message "Executing auto/clean script."
./auto/clean "${@}"
exit ${?}
fi
if [ "${1}" = "noauto" ]
then
if [ "${1}" = "noauto" ]; then
shift
else
Maybe_auto_redirect clean
fi
# Setting static variables

View File

@ -883,16 +883,10 @@ then
fi
# Redirecting to auto script if required
if [ "${1}" != "noauto" ] && [ -x auto/config ]
then
Echo_message "Executing auto/config script."
./auto/config "${@}"
exit ${?}
fi
if [ "${1}" = "noauto" ]
then
if [ "${1}" = "noauto" ]; then
shift
else
Maybe_auto_redirect config
fi
# Reading system configuration