blob: 19504a85858e2d730b37b7ead45c859e159fc357 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#
# set -o noglob is assumed.
#
ex_rtl_install() {
local _verbose _prefix _ln_target _ln_fname _mkdir_fname \
_file_fname_src _file_fname_dst;
if [ "${1}" = "-v" ]; then
_verbose=1; shift;
fi; _prefix="${1}"; shift;
while [ ${#} -gt 0 ]; do
case "${1}" in
@*=*)
_ln_target="${1%=*}";
_ln_target="${_ln_target#@}";
_ln_fname="${1#*=}";
if [ "${_ln_fname#/}" = "${_ln_fname}" ]; then
_ln_fname="${_prefix:+${_prefix}/}${_ln_fname}";
fi;
if [ -e "${_ln_fname}" ]; then
ex_rtl_fileop rm "${_ln_fname}";
fi;
ex_rtl_fileop ln_symbolic "${_ln_target}" "${_ln_fname}";
;;
/=*)
_mkdir_fname="${1#/=}";
if [ "${_mkdir_fname#/}" = "${_mkdir_fname}" ]; then
_mkdir_fname="${_prefix:+${_prefix}/}${_mkdir_fname}";
fi;
ex_rtl_fileop mkdir "${_mkdir_fname}";
;;
*)
_file_fname_src="${1%=*}";
_file_fname_dst="${1#*=}";
if [ "${_file_fname_dst#/}" = "${_file_fname_dst}" ]; then
_file_fname_dst="${_prefix:+${_prefix}/}${_file_fname_dst}";
fi;
ex_rtl_fileop cp "${_file_fname_src}" "${_file_fname_dst}";
;;
esac; shift;
done;
};
# vim:filetype=sh
|