Blame subr/rtl.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
#
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
# . ./build.vars and set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
# See warning at the top of build.vars.
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
#
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
date() { command date +"${1:-${TIMESTAMP_FMT}}"; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
get_var_unsafe() { eval echo \${${1}}; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
set_var_unsafe() { eval ${1}=\"${2}\"; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
push_IFS() { _pI_IFS="${IFS}"; IFS="${1}"; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
pop_IFS() { IFS="${_pI_IFS}"; unset _pI_IFS; };
Lucio Andrés Illanes Albornoz (arab, vxp) 99690f
set_build_dir() { PKG_BUILD_DIR=${1}-${2}-${PKG_TARGET}; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
split() { push_IFS "${1}"; set -- ${2}; pop_IFS; echo "${*}"; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
test_cmd() { command -v "${1}" >/dev/null; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
unsplit() { push_IFS "${1}"; shift; set -- "${@}"; echo "${*}"; pop_IFS; };
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
get_vars_unsafe() {
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		_gvu_vval="$(eval echo \${${1}})";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		[ -z "${_gvu_vval}" ] || _gvu_vval_="${_gvu_vval}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		shift;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	done; echo "${_gvu_vval_}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	unset _gvu_vval _gvu_vval_;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
log_msg() {
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	_lm_lvl=${1}; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
	if [ "${_lm_lvl#v}" != "${_lm_lvl}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
	&& [ ${ARG_VERBOSE:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
		return;
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	case ${_lm_lvl} in
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		failexit) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		fail) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		info) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
		vnfo) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		succ) printf "\033[0m\033[${LOG_MSG_SUCC_COLOUR}m"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		warn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
		varn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	if [ $# -gt 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		printf "==> %s %s %s\033[0m\n" "$(date "${TIMESTAMP_FMT}")" "${1}" "$*";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		printf "==> %s %s\033[0m\n" "$(date "${TIMESTAMP_FMT}")" "${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	fi; [ ${_lm_lvl} = failexit ] && exit 1 || unset _lm_lvl;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
insecure_mkdir() {
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		if [ -z "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		elif [ ! -e "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
			log_msg varn "Making directory \`${1}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			mkdir -p -- "${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		fi; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
match_list() {
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	_ml_cmp="${3}"; push_IFS "${2}"; set -- ${1}; pop_IFS;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		if [ "${1}" = "${_ml_cmp}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			unset _ml_cmp; return 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		fi; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	done; unset _ml_cmp; return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
secure_cd() {
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	if [ \( -z "${1}" \) -o \( ! -e "${1}" \) ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		(cd "${1}"; [ "${PWD#${PREFIX_ROOT}}" = "${PWD}" ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			return 1 || return 0);
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		if [ ${?} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
			log_msg varn "Changing working directory to \`${1}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			cd -- "${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		else
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			log_msg failexit "secure_cd() called with pathname \`${1}' not below \${PREFIX_ROOT} (${PREFIX_ROOT}). This is a bug.";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
secure_rm() {
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		if [ -z "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		elif [ -e "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			if [ -d "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
				_sr_pname_check="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			else
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
				_sr_pname_check="$(dirname "${1}")";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			(cd "${_sr_pname_check}"; [ "${PWD#${PREFIX_ROOT}}" = "${PWD}" ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
				return 1 || return 0);
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			if [ ${?} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
				unset _sr_pname_check;
Lucio Andrés Illanes Albornoz (arab, vxp) 02175d
				log_msg varn "Removing directory or file \`${1}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
				rm -rf -- "${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			else
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
				log_msg failexit "secure_rm() called with pathname \`${1}' not below \${PREFIX_ROOT} (${PREFIX_ROOT}). This is a bug.";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		fi; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
is_build_script_done() {
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	if [ "${1}" = "clean" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		if match_list "${ARG_RESTART}" , ${BUILD_PACKAGE_LC}	\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		&& [ -n "${ARG_RESTART_AT}" ]				\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		&& match_list "${ARG_RESTART_AT}" , "${1}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			return 1;		# Build
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		else
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			return 0;		# Skip
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	elif [ "${ARG_RESTART}" = "ALL" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		return 1;			# Build
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	elif match_list "${ARG_RESTART}" , ${BUILD_PACKAGE_LC}; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		if [ -n "${ARG_RESTART_AT}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			if [ "${ARG_RESTART_AT}" = "ALL" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				return 1;	# Build
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			elif match_list "${ARG_RESTART_AT}" , "${1}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				return 1;	# Build
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			else
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				return 0;	# Skip
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		else
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			return 1;		# Build
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	elif [ -f ${WORKDIR}/.${2:-${BUILD_PACKAGE_LC}}.${1} ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		return 0;		# Skip
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		return 1;		# Build
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
log_env_vars() {
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	log_msg info "Variables for this ${1:-build}:"; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	while [ ${_lev_nvar:=0} -lt ${#} ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		_lev_arg="$(eval echo \${${_lev_nvar}})";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		_lev_arg="${_lev_arg%%=*}";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		if [ ${#_lev_arg} -gt ${_lev_arg_len_max:=0} ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			_lev_arg_len_max=${#_lev_arg};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		fi; : $((_lev_nvar+=1));
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	done; unset _lev_nvar _lev_arg;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		log_msg info "$(printf					\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			"%${_lev_arg_len_max}.${_lev_arg_len_max}s=%s"	\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			"${1%%=*}" "$(get_var_unsafe ${1#*=})")";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		shift;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	done; unset _lev_arg_len_max;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
parse_with_pkg_name() {
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	PKG_NAME=${1}; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	_pwpn_pkg_name_uc=$(echo ${PKG_NAME} | tr a-z A-Z);
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	if [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URL)" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	&& [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URLS_GIT)" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	&& [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_VERSION)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		unset _pwpn_pkg_name_uc;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars.";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		for _pwpn_vname in ${PKG_BUILD_VARS}; do
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			if [ -n "$(get_var_unsafe DEFAULT_${_pwpn_vname})" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe DEFAULT_${_pwpn_vname})";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			if [ -n "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			if [ "${BUILD}" = "debug" ]	\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			&& [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			elif [ "${BUILD}" = "release" ]	\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			&& [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			elif [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
				set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		done; unset _pwpn_vname;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	[ -z "${PKG_FNAME}" ] && PKG_FNAME=${PKG_URL##*/};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	[ -z "${PKG_SUBDIR}" ] && PKG_SUBDIR=${PKG_FNAME%%.tar*};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	[ -n "${PKG_ENV_VARS_EXTRA}" ] && set_env_vars_with_sep : "${PKG_ENV_VARS_EXTRA}";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	for _pwpn_env_var in $(set); do
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		if [ "${_pwpn_env_var#PKG_${_pwpn_pkg_name_uc}}" != "${_pwpn_env_var}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			_pwpn_env_vars="${_pwpn_env_vars:+${_pwpn_env_vars} }${_pwpn_env_var%%=*}";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	if [ -n "${_pwpn_env_vars}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		log_env_vars "build" ${_pwpn_env_vars};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	fi; unset _pwpn_pkg_name_uc _pwpn_env_var _pwpn_env_vars;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
run_cmd_unsplit() {
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	_rcu_cmd=${1}; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		[ -n "${1}" ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			_rcu_cmdline="${_rcu_cmdline:+${_rcu_cmdline}:}${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		shift;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	push_IFS :; ${_rcu_cmd} ${_rcu_cmdline}; _rcu_rc=$?; pop_IFS;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	unset _rcu_cmd _rcu_cmdline; return ${_rcu_rc};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
set_build_script_done() {
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	_sbsd_script_fname=${BUILD_PACKAGE_LC};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	_sbsd_done_fname=${WORKDIR}/.${_sbsd_script_fname};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	while [ $# -ge 1 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		if [ "${1#-}" != "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			secure_rm ${_sbsd_done_fname}.${1#-};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		else
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			touch ${_sbsd_done_fname}.${1};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
			log_msg info "Finished build step ${1} of \`${_sbsd_script_fname}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		fi; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	done; unset _sbsd_script_fname _sbsd_done_fname;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
set_env_vars_with_sep() {
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	_sevws_sep=${1}; shift; push_IFS ${_sevws_sep}; set -- ${1};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
		export "${1}"; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
	done; unset _sevws_sep; pop_IFS;
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
};
Lucio Andrés Illanes Albornoz (arab, vxp) ce047e
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
# vim:filetype=sh