|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
#
|
|
Lucio Andrés Illanes Albornoz |
e1d469 |
# set +o errexit -o noglob -o nounset is assumed.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
|
|
Lucio Andrés Illanes Albornoz |
c6d6e0 |
rtl_install() {
|
|
Lucio Andrés Illanes Albornoz |
907bd3 |
local _verbose="" _prefix="" _ln_target="" _ln_fname="" \
|
|
Lucio Andrés Illanes Albornoz |
907bd3 |
_mkdir_fname="" _file_fname_src="" _file_fname_dst="";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ "${1}" = "-v" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_verbose=1; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
fi; _prefix="${1}"; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
case "${1}" in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
@*=*)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_ln_target="${1%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_ln_target="${_ln_target#@}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_ln_fname="${1#*=}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ "${_ln_fname#/}" = "${_ln_fname}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_ln_fname="${_prefix:+${_prefix}/}${_ln_fname}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ -e "${_ln_fname}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c6d6e0 |
rtl_fileop rm "${_ln_fname}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
if ! rtl_fileop ln_symbolic "${_ln_target}" "${_ln_fname}"; then
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
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 |
_mkdir_fname="${1#/=}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ "${_mkdir_fname#/}" = "${_mkdir_fname}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_mkdir_fname="${_prefix:+${_prefix}/}${_mkdir_fname}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
if ! rtl_fileop mkdir "${_mkdir_fname}"; then
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
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 |
_file_fname_src="${1%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_file_fname_dst="${1#*=}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
9f270b |
if [ "${_file_fname_src#/}" = "${_file_fname_src}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
9f270b |
_file_fname_src="${_prefix:+${_prefix}/}${_file_fname_src}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
9f270b |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ "${_file_fname_dst#/}" = "${_file_fname_dst}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
_file_fname_dst="${_prefix:+${_prefix}/}${_file_fname_dst}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
if ! rtl_fileop cp "${_file_fname_src}" "${_file_fname_dst}"; then
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
7bfc1e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
esac; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
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 |
# vim:filetype=sh
|