From 8860b9b713b2e2dea4cd78d197d610ffd3963992 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Sun, 6 Sep 2020 22:06:23 +0200 Subject: Adding the possibility to decide when to rebuild machines Add HOURLY/DAILY/WEEKLY/MONTHLY_MACHINES to /etc/mkosibuild to select when to rebuild the machines --- mkosibuild-cron | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mkosibuild-cron b/mkosibuild-cron index 41179e2..7678e6e 100755 --- a/mkosibuild-cron +++ b/mkosibuild-cron @@ -24,7 +24,25 @@ export CRONSUFFIX MACHINES=() # Import config to override above config -[[ -r /etc/mkosibuild ]] && . /etc/mkosibuild +if [[ -r /etc/mkosibuild ]]; then + . /etc/mkosibuild + crondir="$(echo "$0" | awk -F'/' '{print $3}')" + if [[ "${crondir}" == "cron.hourly" ]] && [[ -n "${HOURLY_MACHINES+x}" ]]; then + MACHINES=("${HOURLY_MACHINES[*]}") + elif [[ "${crondir}" == "cron.daily" ]] && [[ -n "${DAILY_MACHINES+x}" ]]; then + MACHINES=("${DAILY_MACHINES[*]}") + elif [[ "${crondir}" == "cron.weekly" ]] && [[ -n "${WEEKLY_MACHINES+x}" ]]; then + MACHINES=("${WEEKLY_MACHINES[*]}") + elif [[ "${crondir}" == "cron.monthly" ]] && [[ -n "${MONTHLY_MACHINES+x}" ]]; then + MACHINES=("${MONTHLY_MACHINES[*]}") + fi +fi + + +for machine in ${MACHINES[*]}; do + echo "${machine}" +done +exit # Check if logdir exists, and create it if not [[ -d "${LOGDIR}" ]] || mkdir "${LOGDIR}" -- cgit v1.2.3