Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
#
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
#
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
ex_rtl_state_set() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	local _workdir="${1}" _pkg_fname="${2}" _done_fname_pfx;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	_done_fname_pfx="${_workdir}/.${_pkg_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	shift 2; while [ ${#} -ge 1 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		if [ -z "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			shift; continue;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		elif [ "${1#-}" != "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			ex_rtl_fileop rm "${_done_fname_pfx}.${1#-}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			ex_rtl_fileop touch "${_done_fname_pfx}.${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	shift; done;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
};
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
ex_rtl_state_test() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	local _workdir="${1}" _pkg_name="${2}" _build_step="${3}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		_restart_at="${4}" _done_fname;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	_done_fname="${_workdir}/.${_pkg_name}.${_build_step}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if [ -z "${_restart_at}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_fileop test "${_done_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	elif [ "${_restart_at}" = "ALL" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		! ex_rtl_lmatch "${_restart_at}" , "${_build_step}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
};
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
# vim:filetype=sh