diff options
author | Dennis Eriksen <d@ennis.no> | 2020-09-06 22:06:23 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2020-09-06 22:06:23 +0200 |
commit | 8860b9b713b2e2dea4cd78d197d610ffd3963992 (patch) | |
tree | b5c29fe5a7ec80ec8428ded70d479d4b173ba9e6 | |
parent | add symlink to nspawn-dir, and other small fixes (diff) | |
download | mkosibuild-8860b9b713b2e2dea4cd78d197d610ffd3963992.tar.gz |
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
-rwxr-xr-x | mkosibuild-cron | 20 |
1 files changed, 19 insertions, 1 deletions
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}" |