Lucio Andrés Illanes Albornoz 36c4a8
#
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz 36c4a8
#
Lucio Andrés Illanes Albornoz 36c4a8
Lucio Andrés Illanes Albornoz efeeb0
pkg_dist_zipdist_all() {
Lucio Andrés Illanes Albornoz d37735
	local _dist_fname="" _pkg_name="" _pkglist_fname="${PREFIX}/pkglist.native";
Lucio Andrés Illanes Albornoz c6d6e0
	if rtl_lmatch "${ARG_DIST}" "zipdist" ","; then
Lucio Andrés Illanes Albornoz e493dc
		echo "msg_pkg dist dist_zipdist ${MSG_zipdist_begin}" >&3;
Lucio Andrés Illanes Albornoz e493dc
		rtl_log_msg "zipdist" "${MSG_zipdist_begin}";
Lucio Andrés Illanes Albornoz d37735
		for _pkg_name in $(cat "${_pkglist_fname}"); do
Lucio Andrés Illanes Albornoz 0d1c4f
			if [ ! -e "${BUILD_WORKDIR}/${_pkg_name}-native-${DEFAULT_TARGET}" ]; then
Lucio Andrés Illanes Albornoz e493dc
				rtl_log_msg "fatalexit" "${MSG_zipdist_missing_pkg_build_dir}" "${_pkg_name}";
Lucio Andrés Illanes Albornoz d37735
			fi;
Lucio Andrés Illanes Albornoz d37735
		done;
Lucio Andrés Illanes Albornoz 36c4a8
		_dist_fname="${DEFAULT_ZIPDIST_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.zip";
Lucio Andrés Illanes Albornoz bf9edf
		if [ -e "${BUILD_WORKDIR}/zipdist" ]\
Lucio Andrés Illanes Albornoz bf9edf
		&& ! rtl_fileop rm "${BUILD_WORKDIR}/zipdist"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		elif ! rtl_fileop mkdir "${BUILD_WORKDIR}/zipdist"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		elif ! "${BUILD_WORKDIR}/mpackage/mpackage.sh"				\
Lucio Andrés Illanes Albornoz bf9edf
				--defroot="${DEFAULT_ZIPDIST_DEFROOT}"			\
Lucio Andrés Illanes Albornoz bf9edf
				--flysyms						\
Lucio Andrés Illanes Albornoz bf9edf
				--minroot="${PREFIX_MINIPIX}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--objroot="${BUILD_WORKDIR}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--pkgroot="${BUILD_WORKDIR}/zipdist/pkgroot"		\
Lucio Andrés Illanes Albornoz bf9edf
				--product=Midipix					\
Lucio Andrés Illanes Albornoz bf9edf
				--subset="${_pkglist_fname}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--symbols						\
Lucio Andrés Illanes Albornoz bf9edf
				--sysroot="${BUILD_WORKDIR}/zipdist/sysroot"		\
Lucio Andrés Illanes Albornoz bf9edf
				--target="${DEFAULT_TARGET}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--tmproot="${BUILD_WORKDIR}/zipdist/tmproot"		\
Lucio Andrés Illanes Albornoz bf9edf
				--zipfile="${PREFIX}/${_dist_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		else
Lucio Andrés Illanes Albornoz e493dc
			echo "msg_pkg dist dist_zipdist ${MSG_zipdist_finished}" >&3;
Lucio Andrés Illanes Albornoz e493dc
			rtl_log_msg "zipdist" "${MSG_zipdist_finished}";
Lucio Andrés Illanes Albornoz 35a2fa
			if [ -n "${DEFAULT_ZIPDIST_SIGN_GPG_KEY:-}" ]\
Lucio Andrés Illanes Albornoz bf9edf
			&& [ -x "$(which gpg 2>/dev/null)" ]\
Lucio Andrés Illanes Albornoz bf9edf
			&& gpg --list-keys "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz e493dc
				echo "msg_pkg dist dist_zipdist ${MSG_zipdist_signing}" >&3;
Lucio Andrés Illanes Albornoz e493dc
				rtl_log_msg "zipdist" "${MSG_zipdist_signing}";
Lucio Andrés Illanes Albornoz bf9edf
				if ! gpg --armor --passphrase-file /dev/null		\
Lucio Andrés Illanes Albornoz bf9edf
					--local-user "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}"	\
Lucio Andrés Illanes Albornoz bf9edf
					--sign "${PREFIX}/${_dist_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
					return 1;
Lucio Andrés Illanes Albornoz bf9edf
				fi;
Lucio Andrés Illanes Albornoz e493dc
				echo "msg_pkg dist dist_zipdist ${MSG_zipdist_signed}" >&3;
Lucio Andrés Illanes Albornoz e493dc
				rtl_log_msg "zipdist" "${MSG_zipdist_signed}";
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz 86373a
		fi;
Lucio Andrés Illanes Albornoz 36c4a8
	fi;
Lucio Andrés Illanes Albornoz 36c4a8
};
Lucio Andrés Illanes Albornoz 36c4a8
Lucio Andrés Illanes Albornoz 36c4a8
# vim:filetype=sh