summaryrefslogtreecommitdiffhomepage
path: root/subr.pkg/pkg_fetch_clean.subr
blob: 0ac5c97078cb79fed7bf5dddbb420806220aef9a (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
#
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de>
# set +o errexit -o noglob -o nounset is assumed.
#

pkg_fetch_clean() {
	local	_pfc_group_name="${1}" _pfc_pkg_name="${2}" _pfc_restart_at="${3}"	\
		_pfc_dname="";

	if [ "${PKG_URLS_GIT:+1}" = 1 ]; then
		if [ "${PKG_SUBDIR:+1}" = 1 ]\
		&& [ "${PKG_SUBDIR}" != "${PKG_URLS_GIT%%=*}" ]; then
			rtl_fileop rm "${PKG_SUBDIR}";
		fi;

		for _pfc_dname in ${PKG_URLS_GIT}; do
			_pfc_dname="${_pfc_dname%%=*}"; rtl_fileop rm "${_pfc_dname}";
		done;
	elif [ "${PKG_SUBDIR:+1}" = 1 ]; then
		rtl_fileop rm "${PKG_SUBDIR}";
	fi;

	return 0;
};

# vim:filetype=sh textwidth=0