blob: 5e49e8534a350ee2caa82df6eb0f1318b85ad294 (
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
45
46
47
48
49
50
51
52
53
54
|
#
# set +o errexit -o noglob -o nounset is assumed.
#
rtl_fetch_clean_dlcache() {
local _pfdcd_dlcachedir="${1}" _pfdcd_pkg_name="${2}" \
_pfdcd_pkg_fname="${3}" _pfdcd_pkg_urls_git="${4}" \
_pfdcd_fname="" _pfdcd_skipfl=0 _pfdcd_url_spec="" \
_pfdcd_url_subdir="";
for _pfdcd_fname in \
$(cd "${_pfdcd_dlcachedir}/${_pfdcd_pkg_name}" 2>/dev/null &&
find -maxdepth 1 -mindepth 1 \
${_pfdcd_pkg_fname:+-not -name "${_pfdcd_pkg_fname}"} \
${_pfdcd_pkg_fname:+-not -name "${_pfdcd_pkg_fname}.fetched"});
do
_pfdcd_fname="${_pfdcd_fname#./}"; _pfdcd_skipfl=0;
for _pfdcd_url_spec in ${_pfdcd_pkg_urls_git}; do
_pfdcd_url_subdir="${_pfdcd_url_spec%%=*}"; _pfdcd_url_subdir="${_pfdcd_url_subdir##*/}";
if [ "${_pfdcd_fname%.git}" = "${_pfdcd_url_subdir}" ]; then
_pfdcd_skipfl=1; break;
fi;
done;
if [ "${_pfdcd_skipfl}" -eq 0 ]; then
_pfdcd_fname="${_pfdcd_dlcachedir}/${_pfdcd_pkg_name}/${_pfdcd_fname}";
rtl_log_msg "verbose" "${MSG_rtl_fetch_rm_redundant}" "${_pfdcd_fname}" "${_pfdcd_pkg_name}";
rtl_fileop rm "${_pfdcd_fname}";
fi;
done;
return 0;
};
rtl_fetch_dlcache_subdir() {
local _rfds_dlcache_dir="${1}" _rfds_name="${2}" _rfds_pkg_inherit_from="${3}";
if [ "${_rfds_pkg_inherit_from:+1}" = 1 ]\
&& ! [ -e "${_rfds_dlcache_dir}/${_rfds_name}" ]\
&& ! rtl_fileop ln_symbolic "${_rfds_pkg_inherit_from}" "${_rfds_dlcache_dir}/${_rfds_name}";
then
return 1;
elif [ "${_rfds_pkg_inherit_from:+1}" != 1 ]\
&& ! [ -e "${_rfds_dlcache_dir}/${_rfds_name}" ]\
&& ! rtl_fileop mkdir "${_rfds_dlcache_dir}/${_rfds_name}";
then
return 1;
else
return 0;
fi;
};
# vim:filetype=sh textwidth=0
|