Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/pkg_install.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz 2b85d0
# set +o errexit -o noglob is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
pkg_install() {
Lucio Andrés Illanes Albornoz bf9edf
	local _fname="" _ifs_old="${IFS}" _pkglist_name="" IFS;
Lucio Andrés Illanes Albornoz bf9edf
	if ! rtl_fileop mkdir "${PKG_PREFIX}"; then
Lucio Andrés Illanes Albornoz bf9edf
		return 1;
Lucio Andrés Illanes Albornoz bf9edf
	else	IFS="
Lucio Andrés Illanes Albornoz bf9edf
";		for _fname in $(find "${PKG_DESTDIR}" -type d); do
Lucio Andrés Illanes Albornoz bf9edf
			if ! rtl_fileop chmod 0755 "${_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz bf9edf
		done;
Lucio Andrés Illanes Albornoz bf9edf
		for _fname in $(find "${PKG_DESTDIR}" \( -not -perm /0111 \) -type f); do
Lucio Andrés Illanes Albornoz bf9edf
			if ! rtl_fileop chmod 0644 "${_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz bf9edf
		done;
Lucio Andrés Illanes Albornoz bf9edf
		for _fname in $(find "${PKG_DESTDIR}" -perm /0111 -type f); do
Lucio Andrés Illanes Albornoz bf9edf
			if ! rtl_fileop chmod 0755 "${_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz bf9edf
		done; IFS="${_ifs_old}";
Lucio Andrés Illanes Albornoz d426a0
		(set +o errexit -o noglob; trap "rm -f \"${BUILD_WORKDIR}/install.lock\"" EXIT;
Lucio Andrés Illanes Albornoz 6054d4
		date; echo trying to grab lock
Lucio Andrés Illanes Albornoz 6054d4
		while true; do
Lucio Andrés Illanes Albornoz 6054d4
			if flock -E 622 -w 600 4; then
Lucio Andrés Illanes Albornoz 6054d4
				break;
Lucio Andrés Illanes Albornoz 6054d4
			elif [ "${?}" -eq 622 ]; then
Lucio Andrés Illanes Albornoz 6054d4
				continue;
Lucio Andrés Illanes Albornoz 6054d4
			else
Lucio Andrés Illanes Albornoz 6054d4
				exit "${?}";
Lucio Andrés Illanes Albornoz 6054d4
			fi;
Lucio Andrés Illanes Albornoz 6054d4
		done;
Lucio Andrés Illanes Albornoz bf9edf
		if ! tar -C "${PKG_DESTDIR}" -cpf - . | tar -C "${PKG_PREFIX}" --overwrite -xpf -; then
Lucio Andrés Illanes Albornoz 6054d4
			exit 1;
Lucio Andrés Illanes Albornoz 6054d4
		fi) 4<>"${BUILD_WORKDIR}/install.lock";
Lucio Andrés Illanes Albornoz 6054d4
		if [ "${?}" -ne 0 ]; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		elif [ "${PKG_PKGLIST_DISABLE:-0}" -eq 0 ]; then
Lucio Andrés Illanes Albornoz bf9edf
			if [ ! -e "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" ]\
Lucio Andrés Illanes Albornoz bf9edf
			&& ! touch "${PREFIX}/pkglist.${PKG_BUILD_TYPE}"; then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			else
Lucio Andrés Illanes Albornoz bf9edf
				_pkglist_name="${PKG_BASE_DIR##*/}"; _pkglist_name="${_pkglist_name%%-*}";
Lucio Andrés Illanes Albornoz bf9edf
				if ! echo "${_pkglist_name}" >> "${PREFIX}/pkglist.${PKG_BUILD_TYPE}"; then
Lucio Andrés Illanes Albornoz bf9edf
					return 1;
Lucio Andrés Illanes Albornoz bf9edf
				fi;
Lucio Andrés Illanes Albornoz 2b85d0
			fi;
Lucio Andrés Illanes Albornoz d02931
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 435d7a
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# vim:filetype=sh