Lucio Andrés Illanes Albornoz 14fe23
#
8d7a8a
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
Lucio Andrés Illanes Albornoz 14fe23
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
RTL_NL="
Lucio Andrés Illanes Albornoz 14fe23
";
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
# XXX optimise
Lucio Andrés Illanes Albornoz 14fe23
# implement %<...{...,...}...>
Lucio Andrés Illanes Albornoz 14fe23
# support multiple %<...*...> in same spec
Lucio Andrés Illanes Albornoz 14fe23
# split_ = unfold_
Lucio Andrés Illanes Albornoz 14fe23
# impl 3/ 1## 1# 1%% 1%
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# DSL functor implementation
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
# {{{ rtlp_install_v2_fmap($_rstatus, $_rparams, $_prefix, $_spec, $_fn, [$_param[...], --, [$_spec[...]]])
e9fa07
rtlp_install_v2_fmap() {
e9fa07
	local	_ri2f_rstatus="${1#\$}" _ri2f_rparams="${2#\$}" _ri2f_prefix="${3}" _ri2f_spec="${4}" _ri2f_fn="${5}"	\
e9fa07
		_ri2f_IFS0="${IFS:- 	}" _ri2f_paramsc=0 _ri2f_spec_cur="" _ri2f_spec_list="" _ri2f_spec0=""		\
e9fa07
		_ri2f_specsc=0 _ri2f_nspec=0 _ri2f_rc=0 IFS;
e9fa07
	shift 5;
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
	while [ "${#}" -gt 0 ] && [ "x${1}" != "x--" ]; do
e9fa07
		: $((_ri2f_paramsc+=1)); local "${_ri2f_rparams}${_ri2f_paramsc}=${1}"; shift;
Lucio Andrés Illanes Albornoz 14fe23
	done; shift;
Lucio Andrés Illanes Albornoz 14fe23
	while [ "${#}" -gt 0 ] && [ "x${1}" != "x--" ]; do
e9fa07
		: $((_ri2f_specsc+=1)); local "_ri2f_specs${_ri2f_specsc}=${1}"; shift;
Lucio Andrés Illanes Albornoz 14fe23
	done;
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	if rtlp_install_v2_fmap_params "${_ri2f_rstatus}" "${_ri2f_rparams}" \$_ri2f_spec ""\
e9fa07
	&& rtlp_install_v2_fmap_patterns "${_ri2f_rstatus}" "${_ri2f_rparams}" "${_ri2f_prefix}" "${_ri2f_spec}" \$_ri2f_spec_list; then
e9fa07
		IFS="${RTL_NL}"; for _ri2f_spec_cur in ${_ri2f_spec_list}; do
e9fa07
			IFS="${_ri2f_IFS0}"; set --;
e9fa07
			_ri2f_nspec=1; while [ "${_ri2f_nspec}" -le "${_ri2f_specsc}" ]; do
e9fa07
				eval _ri2f_spec0=\"\${_ri2f_specs${_ri2f_nspec}}\";
e9fa07
				rtlp_install_v2_fmap_params	\
e9fa07
					"${_ri2f_rstatus}"	\
e9fa07
					"${_ri2f_rparams}"	\
e9fa07
					\$_ri2f_spec0 "${_ri2f_spec_cur}";
e9fa07
				eval set -- '"${@}"' '"${_ri2f_spec0}"'; : $((_ri2f_nspec+=1));
Lucio Andrés Illanes Albornoz 14fe23
			done;
e9fa07
			eval "${_ri2f_fn}" \"\$\{@\}\"; _ri2f_rc=$((${?} ? ${?} : ${_ri2f_rc}));
e9fa07
			[ "${_ri2f_rc}" -ne 0 ] && break;
e9fa07
		done; IFS="${_ri2f_IFS0}";
Lucio Andrés Illanes Albornoz 14fe23
	else
e9fa07
		_ri2f_rc=1;
Lucio Andrés Illanes Albornoz 14fe23
	fi;
e9fa07
	return "${_ri2f_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_fmap_params($_rstatus, $_rparams, $_rspec, $_item)
Lucio Andrés Illanes Albornoz 14fe23
RTLP_INSTALL_FMAP_PARAMS_LEVEL=0;
e9fa07
rtlp_install_v2_fmap_params() {
e9fa07
	local	_ri2fp_rstatus="${1#\$}" _ri2fp_rparams="${2#\$}" _ri2fp_rspec="${3#\$}" _ri2fp_item="${4}"	\
e9fa07
		_ri2fp_expr="" _ri2fp_expr_="" _ri2fp_expr_sub="" _ri2fp_expr_op="" _ri2fp_lhs="" _ri2fp_rc=0	\
e9fa07
		_ri2fp_rhs="" _ri2fp_subexpr="";
e9fa07
	eval _ri2fp_lhs='${'"${_ri2fp_rspec}"'}'\; ${_ri2fp_rspec}=;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
	while true; do
e9fa07
		if ! rtlp_install_v2_splitl_ref \$_ri2fp_expr \$_ri2fp_lhs \$_ri2fp_rhs '%[' ']'; then
e9fa07
			eval ${_ri2fp_rspec}='${'"${_ri2fp_rspec}"'}${_ri2fp_lhs}'; break;
e9fa07
		else
e9fa07
		case "${_ri2fp_expr}" in
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
		[0-9]*)
e9fa07
			eval _ri2fp_expr='${'"${_ri2fp_rparams}${_ri2fp_expr}"'}'; ;;
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
		@[0-9]*)
Lucio Andrés Illanes Albornoz 14fe23
			: $((RTLP_INSTALL_FMAP_PARAMS_LEVEL+=1));
e9fa07
			eval _ri2fp_expr${RTLP_INSTALL_FMAP_PARAMS_LEVEL}='${'"${_ri2fp_rparams}${_ri2fp_expr#@}"'}';
e9fa07
			rtlp_install_v2_fmap_params "${_ri2fp_rstatus}" "${_ri2fp_rparams}"	\
e9fa07
					\$_ri2fp_expr${RTLP_INSTALL_FMAP_PARAMS_LEVEL}		\
e9fa07
					"${_ri2fp_item}"; _ri2fp_rc="${?}";
e9fa07
			eval _ri2fp_expr='${_ri2fp_expr'"${RTLP_INSTALL_FMAP_PARAMS_LEVEL}"'}';
e9fa07
			unset '_ri2fp_expr'"${RTLP_INSTALL_FMAP_PARAMS_LEVEL}";
Lucio Andrés Illanes Albornoz 14fe23
			: $((RTLP_INSTALL_FMAP_PARAMS_LEVEL-=1));
e9fa07
			[ "${_ri2fp_rc}" -eq 1 ] && break; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		[_0-9a-zA-Z]*)
e9fa07
			case "${_ri2fp_expr}" in
e9fa07
e9fa07
			DNAME*)	_ri2fp_subexpr="${_ri2fp_expr#DNAME}"; _ri2fp_expr="${_ri2fp_item%/*}"; ;;
e9fa07
			FNAME*)	_ri2fp_subexpr="${_ri2fp_expr#FNAME}"; _ri2fp_expr="${_ri2fp_item##*/}"; ;;
e9fa07
			ITEM*)	_ri2fp_subexpr="${_ri2fp_expr#ITEM}"; _ri2fp_expr="${_ri2fp_item}"; ;;
e9fa07
e9fa07
			"")	_ri2fp_rc=1;
e9fa07
				rtl_setrstatus "${_ri2fp_rstatus}" 'zero-length parameter name in expression';
e9fa07
				;;
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
			*)
e9fa07
				_ri2fp_expr_="${_ri2fp_expr%%[!_0-9a-zA-Z]*}";
e9fa07
				_ri2fp_subexpr="${_ri2fp_expr#${_ri2fp_expr_}}";
e9fa07
				_ri2fp_expr="${_ri2fp_expr_}";
e9fa07
				if eval [ '"${'"${_ri2fp_rparams}${_ri2fp_expr}"':+1}"' = 1 ]; then
e9fa07
					eval _ri2fp_expr='${'"${_ri2fp_rparams}${_ri2fp_expr}"'}';
e9fa07
				else	_ri2fp_rc=1;
e9fa07
					rtl_setrstatus "${_ri2fp_rstatus}" 'unknown parameter name \`'"${_ri2fp_expr}"''\'' in expression';
e9fa07
				fi;
e9fa07
				;;
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
			esac;
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
			if [ "${_ri2fp_rc}" -eq 0 ]; then
Lucio Andrés Illanes Albornoz 14fe23
				while true; do
e9fa07
					if ! rtlp_install_v2_splitl_subexpr	\
e9fa07
							\$_ri2fp_subexpr_	\
e9fa07
							\$_ri2fp_subexpr	\
Lucio Andrés Illanes Albornoz 14fe23
							'## # %% %'; then
Lucio Andrés Illanes Albornoz 14fe23
						break;
e9fa07
					else case "${_ri2fp_subexpr_}" in
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
					/*)	;;
e9fa07
					\#\#*)	_ri2fp_expr="${_ri2fp_expr##${_ri2fp_subexpr_#\#\#}}"; ;;
e9fa07
					\#*)	_ri2fp_expr="${_ri2fp_expr#${_ri2fp_subexpr_#\#}}"; ;;
e9fa07
					%%*)	_ri2fp_expr="${_ri2fp_expr%%${_ri2fp_subexpr_#%%}}"; ;;
e9fa07
					%*)	_ri2fp_expr="${_ri2fp_expr%${_ri2fp_subexpr_#%}}"; ;;
e9fa07
e9fa07
					"")	_ri2fp_rc=1;
e9fa07
						rtl_setrstatus "${_ri2fp_rstatus}" 'zero-length subexpression in expression';
e9fa07
						;;
e9fa07
e9fa07
					*)	_ri2fp_rc=1;
e9fa07
						rtl_setrstatus "${_ri2fp_rstatus}" 'invalid subexpression \`'"${_ri2fp_subexpr_}"''\'' in expression';
e9fa07
						;;
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
					esac; fi;
Lucio Andrés Illanes Albornoz 14fe23
				done;
Lucio Andrés Illanes Albornoz 14fe23
			fi; ;;
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
		"")	_ri2fp_rc=1;
e9fa07
			rtl_setrstatus "${_ri2fp_rstatus}" 'zero-length expression';
e9fa07
			break; ;;
e9fa07
e9fa07
		*)	_ri2fp_rc=1;
e9fa07
			rtl_setrstatus "${_ri2fp_rstatus}" 'invalid expression \`'"${_ri2fp_expr}"''\';
e9fa07
			break; ;;
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
		esac; fi;
e9fa07
e9fa07
		eval ${_ri2fp_rspec}='${'"${_ri2fp_rspec}"'}${_ri2fp_lhs}${_ri2fp_expr}'; _ri2fp_lhs="${_ri2fp_rhs}";
e9fa07
	done;
e9fa07
e9fa07
	return "${_ri2fp_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_fmap_patterns($_rstatus, $_rparams, $_prefix, $_spec, $_rspec_list)
e9fa07
rtlp_install_v2_fmap_patterns() {
e9fa07
	local	_ri2fp2_rstatus="${1#\$}" _ri2fp2_rparams="${2#\$}" _ri2fp2_prefix="${3}"	\
e9fa07
		_ri2fp2_spec="${4}" _ri2fp2_rspec_list="${5#\$}"				\
e9fa07
		_ri2fp2_expr="" _ri2fp2_lhs="" _ri2fp2_rc=0 _ri2fp2_rhs=""			\
e9fa07
		IFS="${RTL_NL}";
e9fa07
	_ri2fp2_lhs="${_ri2fp2_spec}";
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
	while true; do
e9fa07
		if rtlp_install_v2_splitl_ref \$_ri2fp2_expr \$_ri2fp2_lhs \$_ri2fp2_rhs '%<' '>'; then
e9fa07
			case "${_ri2fp2_expr}" in
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
			*\**)
e9fa07
				if [ "${_ri2fp2_lhs#/}" = "${_ri2fp2_lhs}" ]; then
e9fa07
					_ri2fp2_lhs_full="${_ri2fp2_prefix:+${_ri2fp2_prefix%}/}${_ri2fp2_lhs:+${_ri2fp2_lhs%/}/}";
Lucio Andrés Illanes Albornoz 4025bd
				else
e9fa07
					_ri2fp2_lhs_full="${_ri2fp2_lhs:+${_ri2fp2_lhs%/}/}";
Lucio Andrés Illanes Albornoz 4025bd
				fi;
e9fa07
				set +o noglob; for _ri2fp2_pname in ${_ri2fp2_lhs_full}${_ri2fp2_expr}; do
e9fa07
					set -o noglob; _ri2fp2_pname="${_ri2fp2_pname%/}${_ri2fp2_rhs:+/${_ri2fp2_rhs}}";
e9fa07
					if [ -e "${_ri2fp2_pname}" ]; then
e9fa07
						eval ${_ri2fp2_rspec_list}='${'"${_ri2fp2_rspec_list}"':+${'"${_ri2fp2_rspec_list}"'}${RTL_NL}}${_ri2fp2_pname}';
Lucio Andrés Illanes Albornoz 14fe23
					fi;
Lucio Andrés Illanes Albornoz 14fe23
				done; set -o noglob; ;;
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
			"")	_ri2fp2_rc=1;
e9fa07
				rtl_setrstatus "${_ri2fp2_rstatus}" 'zero-length pattern';
e9fa07
				break; ;;
e9fa07
e9fa07
			*)	_ri2fp2_rc=1;
e9fa07
				rtl_setrstatus "${_ri2fp2_rstatus}" 'invalid pattern \`'"${_ri2fp2_expr}"''\';
e9fa07
				break; ;;
e9fa07
e9fa07
			esac; _ri2fp2_lhs="${_ri2fp2_rhs}";
Lucio Andrés Illanes Albornoz 14fe23
		else
e9fa07
			eval ${_ri2fp2_rspec_list}='${'"${_ri2fp2_rspec_list}"':+${'"${_ri2fp2_rspec_list}"'}${RTL_NL}}${_ri2fp2_lhs}';
Lucio Andrés Illanes Albornoz 14fe23
			break;
Lucio Andrés Illanes Albornoz 14fe23
		fi;
e9fa07
	done;
e9fa07
e9fa07
	return "${_ri2fp2_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# Install OPeration functions
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
# {{{ rtlp_install_v2_op_chmod($_nflag, $_prefix, $_vflag, $_fname, $_mode)
e9fa07
rtlp_install_v2_op_chmod() {
e9fa07
	local _ri2oc_nflag="${1}" _ri2oc_prefix="${2}" _ri2oc_vflag="${3}" _ri2oc_fname="${4}" _ri2oc_mode="${5}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2oc_fname "${_ri2oc_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2oc_nflag}" "${_ri2oc_vflag}" rtl_fileop chmod "${_ri2oc_mode}" "${_ri2oc_fname}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_chgrp($_nflag, $_prefix, $_vflag, $_fname, $_group)
e9fa07
rtlp_install_v2_op_chgrp() {
e9fa07
	local _ri2oc2_nflag="${1}" _ri2oc2_prefix="${2}" _ri2oc2_vflag="${3}" _ri2oc2_fname="${4}" _ri2oc2_group="${5}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2oc2_fname "${_ri2oc2_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2oc2_nflag}" "${_ri2oc2_vflag}" rtl_fileop chgrp "${_ri2oc2_group}" "${_ri2oc2_fname}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_chown($_nflag, $_prefix, $_vflag, $_fname, $_owner)
e9fa07
rtlp_install_v2_op_chown() {
e9fa07
	local _ri2oc3_nflag="${1}" _ri2oc3_prefix="${2}" _ri2oc3_vflag="${3}" _ri2oc3_fname="${4}" _ri2oc3_owner="${5}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2oc3_fname "${_ri2oc3_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2oc3_nflag}" "${_ri2oc3_vflag}" rtl_fileop chown "${_ri2oc3_owner}" "${_ri2oc3_fname}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_cp($_nflag, $_prefix, $_vflag, $_file_fname_dst, $_file_fname_src)
e9fa07
rtlp_install_v2_op_cp() {
e9fa07
	local _ri2oc4_nflag="${1}" _ri2oc4_prefix="${2}" _ri2oc4_vflag="${3}" _ri2oc4_fname_dst="${4}" _ri2oc4_fname_src="${5}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2oc4_fname_dst "${_ri2oc4_prefix}";
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2oc4_fname_src "${_ri2oc4_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2oc4_nflag}" "${_ri2oc4_vflag}" rtl_fileop cp "${_ri2oc4_fname_src}" "${_ri2oc4_fname_dst}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_cp_follow_if_newer($_nflag, $_prefix, $_vflag, $_file_fname_dst, $_file_fname_src)
e9fa07
rtlp_install_v2_op_cp_follow_if_newer() {
e9fa07
	local _ri2ocfin_nflag="${1}" _ri2ocfin_prefix="${2}" _ri2ocfin_vflag="${3}" _ri2ocfin_fname_dst="${4}" _ri2ocfin_fname_src="${5}";
e9fa07
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2ocfin_fname_dst "${_ri2ocfin_prefix}";
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2ocfin_fname_src "${_ri2ocfin_prefix}";
e9fa07
	if [ -e "${_ri2ocfin_fname_dst}" ]\
e9fa07
	&& rtl_is_newer "${_ri2ocfin_fname_src}" "${_ri2ocfin_fname_dst}"; then
Lucio Andrés Illanes Albornoz 14fe23
		return 0;
Lucio Andrés Illanes Albornoz 14fe23
	else
e9fa07
		rtlp_install_v2_rc "${_ri2ocfin_nflag}" "${_ri2ocfin_vflag}" rtl_fileop cp_follow "${_ri2ocfin_fname_src}" "${_ri2ocfin_fname_dst}";
Lucio Andrés Illanes Albornoz 14fe23
	fi;
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_ln_symbolic($_nflag, $_prefix, $_vflag, $_ln_fname, $_ln_target)
e9fa07
rtlp_install_v2_op_ln_symbolic() {
e9fa07
	local _ri2ols_nflag="${1}" _ri2ols_prefix="${2}" _ri2ols_vflag="${3}" _ri2ols_ln_fname="${4}" _ri2ols_ln_target="${5}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2ols_ln_fname "${_ri2ols_prefix}";
e9fa07
	if [ -e "${_ri2ols_ln_fname}" ]; then
e9fa07
		rtlp_install_v2_rc "${_ri2ols_nflag}" "${_ri2ols_vflag}" rtl_fileop rm "${_ri2ols_ln_fname}";
Lucio Andrés Illanes Albornoz 14fe23
	fi;
e9fa07
	rtlp_install_v2_rc "${_ri2ols_nflag}" "${_ri2ols_vflag}" rtl_fileop ln_symbolic "${_ri2ols_ln_target}" "${_ri2ols_ln_fname}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_mkdir($_nflag, $_prefix, $_vflag, $_dname)
e9fa07
rtlp_install_v2_op_mkdir() {
e9fa07
	local _ri2om_nflag="${1}" _ri2om_prefix="${2}" _ri2om_vflag="${3}" _ri2om_dname="${4}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2om_dname "${_ri2om_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2om_nflag}" "${_ri2om_vflag}" rtl_fileop mkdir "${_ri2om_dname}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_mv($_nflag, $_prefix, $_vflag, $_file_fname_dst, $_file_fname_src)
e9fa07
rtlp_install_v2_op_mv() {
e9fa07
	local _ri2om2_nflag="${1}" _ri2om2_prefix="${2}" _ri2om2_vflag="${3}" _ri2om2_fname_dst="${4}" _ri2om2_fname_src="${5}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2om2_fname_dst "${_ri2om2_prefix}";
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2om2_fname_src "${_ri2om2_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2om2_nflag}" "${_ri2om2_vflag}" rtl_fileop mv "${_ri2om2_fname_src}" "${_ri2om2_fname_dst}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_rm($_nflag, $_prefix, $_vflag, $_pname)
e9fa07
rtlp_install_v2_op_rm() {
e9fa07
	local _ri2or_nflag="${1}" _ri2or_prefix="${2}" _ri2or_vflag="${3}" _ri2or_pname="${4}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2or_pname "${_ri2or_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2or_nflag}" "${_ri2or_vflag}" rtl_fileop rm "${_ri2or_pname}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_op_touch($_nflag, $_prefix, $_vflag, $_fname, $_ts)
e9fa07
rtlp_install_v2_op_touch() {
e9fa07
	local _ri2ot_nflag="${1}" _ri2ot_prefix="${2}" _ri2ot_vflag="${3}" _ri2ot_fname="${4}" _ri2ot_ts="${5:-}";
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	rtlp_install_v2_fixup_fname \$_ri2ot_fname "${_ri2ot_prefix}";
e9fa07
	rtlp_install_v2_rc "${_ri2ot_nflag}" "${_ri2ot_vflag}" rtl_fileop touch "${_ri2ot_fname}" "${_ri2ot_ts}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# Ancillary functions
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
# {{{ rtlp_install_v2_fixup_fname($_rfname, $_prefix)
e9fa07
rtlp_install_v2_fixup_fname() {
e9fa07
	local _ri2ff_rfname="${1#\$}" _ri2ff_prefix="${2}" _ri2ff_fname="";
e9fa07
	eval _ri2ff_fname='${'"${_ri2ff_rfname}"'}';
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	if [ "${_ri2ff_fname#/}" = "${_ri2ff_fname}" ]; then
e9fa07
		eval ${_ri2ff_rfname}='${_ri2ff_prefix:+${_ri2ff_prefix}/}${_ri2ff_fname}';
Lucio Andrés Illanes Albornoz 14fe23
	fi;
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_rc($_nflag, $_vflag, $_fn, [...])
e9fa07
rtlp_install_v2_rc() {
e9fa07
	local _ri2r_nflag="${1}" _ri2r_vflag="${2}" _ri2r_fn="${3}" _ri2r_rc=0; shift 3;
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	if [ "${_ri2r_nflag}" -eq 1 ]\
e9fa07
	|| [ "${_ri2r_vflag}" -gt 0 ]; then
e9fa07
		rtl_log_msg "install" "${MSG_rtl_install_v2_rc}" "${_ri2r_fn}${_ri2r_fn:+ ${*}}";
Lucio Andrés Illanes Albornoz 14fe23
	fi;
e9fa07
	if [ "${_ri2r_nflag}" -eq 0 ]; then
e9fa07
		"${_ri2r_fn}" "${@}"; _ri2r_rc="${?}";
Lucio Andrés Illanes Albornoz 14fe23
	fi;
e9fa07
	return "${_ri2r_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_splitl($_rlhs, $_rrhs, $_sep)
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
# rtlp_install_v2_splitl()
49003e
# Split @_rlhs from left-hand side into left-hand and right-hand side
Lucio Andrés Illanes Albornoz 14fe23
# according to @_sep w/ backslash escaping
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# @_rlhs:		inout reference to string and left-hand side result
Lucio Andrés Illanes Albornoz 14fe23
# @_rrhs:		out reference to right-hand side result
Lucio Andrés Illanes Albornoz 14fe23
# @_sep:		single non-zero, possibly multi-character, separator
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# Calling convention:	inout ref. @_rlhs, out ref. @_rrhs
Lucio Andrés Illanes Albornoz 14fe23
# Notate bene:		@_sep is a shell pattern
Lucio Andrés Illanes Albornoz 14fe23
# Returns:		zero (0) on success, non-zero (>0) on absence of unescaped @_sep in @_rlhs
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
rtlp_install_v2_splitl() {
e9fa07
	local	_ri2s_rlhs="${1#\$}" _ri2s_rrhs="${2#\$}" _ri2s_sep="${3}" _ri2s_lhs=""	\
e9fa07
		_ri2s_lhs_new="" _ri2s_rc=1 _ri2s_rhs="" _ri2s_rhs_new="";
e9fa07
e9fa07
	eval _ri2s_rhs='${'"${_ri2s_rlhs}"'}';
e9fa07
	while [ "${_ri2s_rhs:+1}" = 1 ]; do
e9fa07
		_ri2s_lhs_new="${_ri2s_rhs%%${_ri2s_sep}*}";
e9fa07
		if [ "${_ri2s_lhs_new}" != "${_ri2s_rhs}" ]; then
e9fa07
			_ri2s_rhs_new="${_ri2s_rhs#*${_ri2s_sep}}";
e9fa07
			if [ "${_ri2s_lhs_new%\\}" = "${_ri2s_lhs_new}" ]; then
e9fa07
				eval	${_ri2s_rlhs}='${_ri2s_lhs}${_ri2s_lhs_new}'	\
e9fa07
					${_ri2s_rrhs}='${_ri2s_rhs_new}'; _ri2s_rc=0; break;
Lucio Andrés Illanes Albornoz 14fe23
			else
e9fa07
				_ri2s_lhs="${_ri2s_lhs}${_ri2s_lhs_new%\\}${_ri2s_sep}";
e9fa07
				_ri2s_rhs="${_ri2s_rhs_new}";
Lucio Andrés Illanes Albornoz 14fe23
			fi;
Lucio Andrés Illanes Albornoz 14fe23
		else break; fi;
e9fa07
	done;
e9fa07
	return "${_ri2s_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_splitl_ref($_ritem, $_rlhs, $_rrhs, $_sepl, $_sepr)
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
# rtlp_install_v2_splitl_ref()
Lucio Andrés Illanes Albornoz 14fe23
# Split @_rlhs from left-hand side into left-hand, reference, and
Lucio Andrés Illanes Albornoz 14fe23
# right-hand side according to left-hand (beginning) and right-hand
Lucio Andrés Illanes Albornoz 14fe23
# (ending) side separators w/ backslash escaping
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# @_rref:		out reference to reference
Lucio Andrés Illanes Albornoz 14fe23
# @_rlhs:		inout reference to string and left-hand side result
Lucio Andrés Illanes Albornoz 14fe23
# @_rrhs:		out reference to right-hand side result
Lucio Andrés Illanes Albornoz 14fe23
# @_sepl:		single non-zero, possibly multi-character, left-hand side separator
Lucio Andrés Illanes Albornoz 14fe23
# @_sepr:		single non-zero, possibly multi-character, right-hand side separator
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# Calling convention:	out ref. @_rref, inout ref. @_rlhs, out ref. @_rrhs
Lucio Andrés Illanes Albornoz 14fe23
# Notate bene:		@_sepl and @_sepr are shell patterns
Lucio Andrés Illanes Albornoz 14fe23
# Returns:		zero (0) on success, non-zero (>0) on absence of unescaped references in @_rlhs
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
rtlp_install_v2_splitl_ref() {
e9fa07
	local	_ri2sr_rref="${1#\$}" _ri2sr_rlhs="${2#\$}" _ri2sr_rrhs="${3#\$}" _ri2sr_sepl="${4}"	\
e9fa07
		_ri2sr_sepr="${5}" _ri2sr_item="" _ri2sr_item_lhs="" _ri2sr_item_lhs_new=""		\
e9fa07
		_ri2sr_item_rhs="" _ri2sr_item_rhs_new="" _ri2sr_lhs="" _ri2sr_lhs_new="" _ri2sr_rc=1	\
e9fa07
		_ri2sr_rhs="" _ri2sr_rhs_new="";
e9fa07
e9fa07
	eval _ri2sr_rhs='${'"${_ri2sr_rlhs}"'}';
e9fa07
	while [ "${_ri2sr_rhs:+1}" = 1 ]; do
e9fa07
		_ri2sr_lhs_new="${_ri2sr_rhs%%${_ri2sr_sepl}*}";
e9fa07
		if [ "${_ri2sr_lhs_new}" != "${_ri2sr_rhs}" ]; then
e9fa07
			_ri2sr_rhs_new="${_ri2sr_rhs#*${_ri2sr_sepl}}";
e9fa07
			if [ "${_ri2sr_lhs_new%\\}" = "${_ri2sr_lhs_new}" ]; then
e9fa07
				_ri2sr_item=""; _ri2sr_item_lhs=""; _ri2sr_item_rhs="${_ri2sr_rhs_new}";
e9fa07
				while [ "${_ri2sr_item_rhs:+1}" = 1 ]; do
e9fa07
					_ri2sr_item_lhs_new="${_ri2sr_item_rhs%%${_ri2sr_sepr}*}";
e9fa07
					if [ "${_ri2sr_item_lhs_new}" != "${_ri2sr_item_rhs}" ]; then
e9fa07
						_ri2sr_item_rhs_new="${_ri2sr_item_rhs#*${_ri2sr_sepr}}";
e9fa07
						if [ "${_ri2sr_item_lhs_new%\\}" = "${_ri2sr_item_lhs_new}" ]; then
e9fa07
							_ri2sr_item="${_ri2sr_item_lhs}${_ri2sr_item_lhs_new}";
e9fa07
							_ri2sr_item_rhs="${_ri2sr_item_rhs_new}";
e9fa07
							_ri2sr_rc=0; break;
Lucio Andrés Illanes Albornoz 14fe23
						else
e9fa07
							_ri2sr_item_lhs="${_ri2sr_item_lhs}${_ri2sr_item_lhs_new%\\}${_ri2sr_sepr}";
e9fa07
							_ri2sr_item_rhs="${_ri2sr_item_rhs_new}";
Lucio Andrés Illanes Albornoz 14fe23
						fi;
Lucio Andrés Illanes Albornoz 14fe23
					else break; fi;
Lucio Andrés Illanes Albornoz 14fe23
				done; break;
Lucio Andrés Illanes Albornoz 14fe23
			else
e9fa07
				_ri2sr_lhs="${_ri2sr_lhs}${_ri2sr_lhs_new%\\}${_ri2sr_sepl}"; _ri2sr_rhs="${_ri2sr_rhs_new}";
Lucio Andrés Illanes Albornoz 14fe23
			fi;
Lucio Andrés Illanes Albornoz 14fe23
		else break; fi;
Lucio Andrés Illanes Albornoz 14fe23
	done;
Lucio Andrés Illanes Albornoz 14fe23
e9fa07
	eval	${_ri2sr_rref}='${_ri2sr_item}'			\
e9fa07
		${_ri2sr_rlhs}='${_ri2sr_lhs}${_ri2sr_lhs_new}'	\
e9fa07
		${_ri2sr_rrhs}='${_ri2sr_item_rhs}';
e9fa07
	return "${_ri2sr_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
e9fa07
# {{{ rtlp_install_v2_splitl_subexpr($_rexpr, $_rlhs, $_lsep)
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
# rtlp_install_v2_splitl_subexpr()
Lucio Andrés Illanes Albornoz 14fe23
# Split @_rlhs from left-hand side into left-hand (subexpression) and right-hand
Lucio Andrés Illanes Albornoz 14fe23
# side according to list of expression operator prefixes w/ backslash escaping
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# @_rexpr:		out reference to right-hand (expression) side result
Lucio Andrés Illanes Albornoz 14fe23
# @_rlhs:		inout reference to string and left-hand side result
Lucio Andrés Illanes Albornoz 14fe23
# @_lsep:		non-zero SP-separated list of non-zero, possibly multi-character, expression operator prefixes
Lucio Andrés Illanes Albornoz 14fe23
#
Lucio Andrés Illanes Albornoz 14fe23
# Calling convention:	out ref. @_rexpr, inout ref. @_rlhs
Lucio Andrés Illanes Albornoz 14fe23
# Notate bene:		@_lsep list items are shell patterns
Lucio Andrés Illanes Albornoz 14fe23
# Returns:		zero (0) on success, non-zero (>0) on absence of unescaped expressions in @_rlhs
Lucio Andrés Illanes Albornoz 14fe23
#
e9fa07
rtlp_install_v2_splitl_subexpr() {
e9fa07
	local	_ri2ss_rexpr="${1#\$}" _ri2ss_rlhs="${2#\$}" _ri2ss_lsep="${3}" _ri2ss_lhs=""		\
e9fa07
		_ri2ss_matchfl="" _ri2ss_nsep="" _ri2ss_rc=1 _ri2ss_sep="" _ri2ss_sexpr=""		\
e9fa07
		_ri2ss_sexpr_lhs="" _ri2ss_sexpr_lhs_new="" _ri2ss_sexpr_rhs=""				\
e9fa07
		_ri2ss_sexpr_rhs_new="" _ri2ss_sexpr_rhs_new_min="" _ri2ss_sexpr_rhs_new_min_new=""	\
e9fa07
		_ri2ss_sexpr_sep="" _ri2ss_sexpr_sep_new=""
e9fa07
e9fa07
	eval _ri2ss_lhs='${'"${_ri2ss_rlhs}"'}'; set -- ${_ri2ss_lsep};
e9fa07
e9fa07
	if [ "${_ri2ss_lhs:+1}" = 1 ]; then
e9fa07
		_ri2ss_matchfl=0; _ri2ss_nsep=1; while [ "${_ri2ss_nsep}" -le "${#}" ]; do
e9fa07
			eval _ri2ss_sep='${'"${_ri2ss_nsep}"'}';
e9fa07
			case "${_ri2ss_lhs}" in
e9fa07
			${_ri2ss_sep}*)	_ri2ss_matchfl=1; break; ;;
e9fa07
			*)		: $((_ri2ss_nsep+=1)); ;;
Lucio Andrés Illanes Albornoz 14fe23
			esac;
Lucio Andrés Illanes Albornoz 14fe23
		done;
e9fa07
e9fa07
		if [ "${_ri2ss_matchfl}" -eq 1 ]; then
e9fa07
			_ri2ss_sexpr=""; _ri2ss_sexpr_lhs="${_ri2ss_sep}";
e9fa07
			_ri2ss_sexpr_rhs="${_ri2ss_lhs#${_ri2ss_sep}}";
e9fa07
e9fa07
			while [ "${_ri2ss_sexpr_rhs:+1}" = 1 ]; do
e9fa07
				_ri2ss_sexpr_rhs_new_min=-1; _ri2ss_sexpr_sep=""; _ri2ss_nsep=1;
e9fa07
				while [ "${_ri2ss_nsep}" -le "${#}" ]; do
e9fa07
					eval _ri2ss_sexpr_sep_new='${'"${_ri2ss_nsep}"'}';
e9fa07
					_ri2ss_sexpr_rhs_new="${_ri2ss_sexpr_rhs%%${_ri2ss_sexpr_sep_new}*}";
e9fa07
					if [ "${_ri2ss_sexpr_rhs_new}" != "${_ri2ss_sexpr_rhs}" ]; then
e9fa07
						_ri2ss_sexpr_rhs_new_min_new="${#_ri2ss_sexpr_rhs_new}";
e9fa07
						if [ "${_ri2ss_sexpr_rhs_new_min_new}" -le "${_ri2ss_sexpr_rhs_new_min}" ]\
e9fa07
						|| [ "${_ri2ss_sexpr_rhs_new_min}" -eq -1 ]; then
e9fa07
							_ri2ss_sexpr_rhs_new_min="${_ri2ss_sexpr_rhs_new_min_new}";
e9fa07
							_ri2ss_sexpr_sep="${_ri2ss_sexpr_sep_new}";
Lucio Andrés Illanes Albornoz 14fe23
						fi;
e9fa07
					fi; : $((_ri2ss_nsep+=1));
Lucio Andrés Illanes Albornoz 14fe23
				done;
e9fa07
				if [ "${_ri2ss_sexpr_sep:+1}" = 1 ]; then
e9fa07
					_ri2ss_sexpr_lhs_new="${_ri2ss_sexpr_rhs%%${_ri2ss_sexpr_sep}*}";
e9fa07
					if [ "${_ri2ss_sexpr_lhs_new%\\}" = "${_ri2ss_sexpr_lhs_new}" ]; then
e9fa07
						_ri2ss_sexpr_lhs="${_ri2ss_sexpr_lhs}${_ri2ss_sexpr_lhs_new}";
e9fa07
						_ri2ss_sexpr_rhs="${_ri2ss_sexpr_sep}${_ri2ss_sexpr_rhs#*${_ri2ss_sexpr_sep}}"; break;
Lucio Andrés Illanes Albornoz 14fe23
					else
e9fa07
						_ri2ss_sexpr_lhs="${_ri2ss_sexpr_lhs}${_ri2ss_sexpr_rhs%%\\${_ri2ss_sexpr_sep}*}${_ri2ss_sexpr_sep}";
e9fa07
						_ri2ss_sexpr_rhs="${_ri2ss_sexpr_rhs#*\\${_ri2ss_sexpr_sep}}";
Lucio Andrés Illanes Albornoz 14fe23
					fi;
Lucio Andrés Illanes Albornoz 14fe23
				else
e9fa07
					_ri2ss_sexpr_lhs="${_ri2ss_sexpr_lhs}${_ri2ss_sexpr_rhs}"; _ri2ss_sexpr_rhs=""; break;
Lucio Andrés Illanes Albornoz 14fe23
				fi;
Lucio Andrés Illanes Albornoz 14fe23
			done;
e9fa07
e9fa07
			eval ${_ri2ss_rexpr}='${_ri2ss_sexpr_lhs}' ${_ri2ss_rlhs}='${_ri2ss_sexpr_rhs}'; _ri2ss_rc=0;
Lucio Andrés Illanes Albornoz 14fe23
		fi;
e9fa07
	fi;
e9fa07
e9fa07
	return "${_ri2ss_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
# }}}
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
rtl_install_v2() {
e9fa07
	local	_ri2_rstatus="${1#\$}"										\
e9fa07
		_ri2_prefix="" _ri2_spec_flag="" _ri2_spec_list="" _ri2_iflag=0 _ri2_IFS="${IFS:- 	}"	\
e9fa07
		_ri2_nflag=0 _ri2_paramsc=0 _ri2_vflag=0 _ri2_IFS0 _ri2_nparam=0 _ri2_opt="" _ri2_param=""	\
e9fa07
		_ri2_rc=0 _ri2_spec="" _ri2_spec_dst="" _ri2_spec_src="" IFS OPTARG="" OPTIND=1;
e9fa07
	shift;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
	while true; do
Lucio Andrés Illanes Albornoz 14fe23
		if [ "${1:-}" = "--" ]; then
Lucio Andrés Illanes Albornoz 14fe23
			: $((OPTIND+=1)); break;
e9fa07
		elif ! getopts hiI:np:v _ri2_opt; then
Lucio Andrés Illanes Albornoz 14fe23
			break;
e9fa07
		else case "${_ri2_opt}" in
Lucio Andrés Illanes Albornoz 14fe23
		h)	printf "usage: rtl_install [-i] [-I ifs] [-n] [-p name=val] [-v] prefix spec_list\n" >&2;
Lucio Andrés Illanes Albornoz 14fe23
			printf "       -i...........: continue on soft errors\n" >&2;
Lucio Andrés Illanes Albornoz 14fe23
			printf "       -I ifs.......: process spec_list with ifs instead of NL\n" >&2;
Lucio Andrés Illanes Albornoz 14fe23
			printf "       -n...........: perform dry run\n" >&2;
Lucio Andrés Illanes Albornoz 14fe23
			printf "       -p name=val..: set named parameter\n" >&2;
Lucio Andrés Illanes Albornoz 14fe23
			printf "       -v...........: increase verbosity\n" >&2;
Lucio Andrés Illanes Albornoz 14fe23
			printf "       prefix.......: pathname prefix\n" >&2;
Lucio Andrés Illanes Albornoz 14fe23
			printf "       spec_list....: ifs-separated list of specs\n" >&2; return 1; ;;
e9fa07
		i)	_ri2_iflag=1; ;;
e9fa07
		I)	_ri2_IFS="${OPTARG}"; ;;
e9fa07
		n)	_ri2_nflag=1; ;;
e9fa07
		p)	: $((_ri2_paramsc+=1)); local _ri2_params${OPTARG%%=*}="${OPTARG#*=}"; ;;
e9fa07
		v)	: $((_ri2_vflag+=1)); ;;
Lucio Andrés Illanes Albornoz 14fe23
		*)	return 1; ;;
Lucio Andrés Illanes Albornoz 14fe23
		esac; fi;
Lucio Andrés Illanes Albornoz 14fe23
	done; shift $((${OPTIND}-1));
e9fa07
	_ri2_prefix="${1:-}"; _ri2_spec_list="${2:-}"; shift 2;
e9fa07
	_ri2_IFS0="${IFS:- 	}"; IFS="${_ri2_IFS}"; set -- ${_ri2_spec_list}; IFS="${_ri2_IFS0}";
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
	while [ ${#} -gt 0 ]; do
e9fa07
		_ri2_spec_src="${1}";
e9fa07
		case "${_ri2_spec_src}" in
e9fa07
		\?*)	_ri2_spec_flag="?"; ;;
e9fa07
		*)	_ri2_spec_flag=""; ;;
Lucio Andrés Illanes Albornoz 14fe23
		esac;
e9fa07
		if ! rtlp_install_v2_splitl \$_ri2_spec_src \$_ri2_spec_dst "="; then
e9fa07
			_ri2_rc=1;
e9fa07
			rtl_setrstatus "${_ri2_rstatus}" 'zero-length or invalid specification \`'"${1}"''\';
e9fa07
		else case "${_ri2_spec_src}" in
e9fa07
Lucio Andrés Illanes Albornoz 14fe23
		-)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_rm "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"			\
e9fa07
					""										\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[ITEM]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		/)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_mkdir "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"		\
e9fa07
					""										\
Lucio Andrés Illanes Albornoz 14fe23
				       	-- "%[1]" "%[2]" "%[3]" "%[ITEM]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		t*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_touch "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"		\
e9fa07
					"" "" 										\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[ITEM]" "%[5]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		:*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_src#:}"	\
e9fa07
				rtlp_install_v2_op_cp "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"			\
e9fa07
					"${_ri2_spec_dst}" ""								\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[@4]" "%[ITEM]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		!*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_src#!}"	\
e9fa07
				rtlp_install_v2_op_mv "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"			\
e9fa07
					"${_ri2_spec_dst}" ""								\
Lucio Andrés Illanes Albornoz 14fe23
					--  "%[1]" "%[2]" "%[3]" "%[@4]" "%[ITEM]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		@*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_ln_symbolic "${_ri2_nflag}" "${_ri2_prefix}"				\
e9fa07
					"${_ri2_vflag}" "" "${_ri2_spec_src#@}" ""					\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[ITEM]" "%[@5]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		+*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_src#+}"	\
e9fa07
				rtlp_install_v2_op_cp_follow_if_newer "${_ri2_nflag}" "${_ri2_prefix}"			\
e9fa07
					"${_ri2_vflag}" "${_ri2_spec_dst}" ""						\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[@4]" "%[ITEM]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		g*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_chgrp "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"		\
e9fa07
					"" "${_ri2_spec_src#g}" 							\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[ITEM]" "%[5]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		m[0-7][0-7][0-7][0-7])
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_chmod "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"		\
e9fa07
					"" "${_ri2_spec_src#m}"								\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[ITEM]" "%[5]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		o*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_chown "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"		\
e9fa07
					"" "${_ri2_spec_src#o}" 							\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[ITEM]" "%[5]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		T*)
e9fa07
			rtlp_install_v2_fmap "${_ri2_rstatus}" \$_ri2_params "${_ri2_prefix}" "${_ri2_spec_dst}"	\
e9fa07
				rtlp_install_v2_op_touch "${_ri2_nflag}" "${_ri2_prefix}" "${_ri2_vflag}"		\
e9fa07
					"" "${_ri2_spec_src#T}" 							\
Lucio Andrés Illanes Albornoz 14fe23
					-- "%[1]" "%[2]" "%[3]" "%[ITEM]" "%[5]"; ;;
Lucio Andrés Illanes Albornoz 14fe23
Lucio Andrés Illanes Albornoz 14fe23
		\#*|"")
Lucio Andrés Illanes Albornoz 14fe23
			;;
e9fa07
e9fa07
		esac; _ri2_rc="${?}"; fi;
Lucio Andrés Illanes Albornoz 14fe23
		shift;
e9fa07
e9fa07
		if [ "${_ri2_rc}" -ne 0 ]\
e9fa07
		&& [ "${_ri2_iflag}" -eq 0 ]; then
Lucio Andrés Illanes Albornoz 14fe23
			break;
Lucio Andrés Illanes Albornoz 14fe23
		fi;
Lucio Andrés Illanes Albornoz 14fe23
	done;
e9fa07
e9fa07
	return "${_ri2_rc}";
Lucio Andrés Illanes Albornoz 14fe23
};
Lucio Andrés Illanes Albornoz 14fe23
64844b
# vim:filetype=sh textwidth=0