Blob Blame History Raw
#
# set -o errexit -o noglob are assumed.
#

pkgp_invariants_minipix_is_newer() {
	local _new_fname="${1}" _new_ts="" _old_dname="${2}" _old_ts="";
	_old_ts="$(stat -c %Y "${_old_dname%%/}/${_new_fname##*/}")";
	_new_ts="$(stat -c %Y "${_new_fname}")";
	if [ "${_new_ts}" > "${_old_ts}" ]; then
		return 0;
	else
		return 1;
	fi;
};

pkg_invariants_minipix_all() {
	local _dname="" _fname="" _pname="";
	if ex_rtl_lmatch "${ARG_DIST}" , minipix; then
		for _dname in "${PREFIX_MINIPIX}/bin" "${PREFIX_MINIPIX}/share"; do
			if [ ! -e "${_dname}" ]; then
				ex_rtl_fileop mkdir "${_dname}";
			fi;
		done;
		for _fname in clear reset tset; do
			if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin"; then
				ex_rtl_fileop cp_follow "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin";
			fi;
		done;
		for _pname in $(find "${PREFIX_MINIPIX}/bin"					\
				-maxdepth 1 -perm /a=x -type f -and \( -not -name "lib*" \)); do
			if pkgp_invariants_minipix_is_newer "${_pname}" "${PREFIX_MINIPIX}/bin"; then
				ex_rtl_fileop cp_follow "${_pname}" "${PREFIX_MINIPIX}/bin";
			fi;
		done;
		for _fname in libc.so libcrypto.so.43 liblzma.so.5 libmagic.so.1			\
				libncursesw.so.6 libpcre.so.1 libpsxscl.so libreadline.so.7		\
				libu16ports.so.0 libssl.so.45 libtinfo.so.6 libtinfow.so.6		\
				libunistring.so.2 libuuid.so.1 libz.so.1; do
			if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin"; then
				ex_rtl_fileop cp_follow							\
					"${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin";
			fi;
		done;
		for _fname in nano vim; do
			if pkgp_invariants_minipix_is_newer "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share"; then
				ex_rtl_fileop cp_follow "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share";
			fi;
		done;
		if [ ! -L "${PREFIX_MINIPIX}/share/nanorc" ]; then 
			ex_rtl_fileop ln_symbolic "nano/nanorc.nanorc" "${PREFIX_MINIPIX}/share/nanorc";
		fi;
		if [ ! -L "${PREFIX_MINIPIX}/share/vimrc" ]; then
			ex_rtl_fileop ln_symbolic "vim/vim74/vimrc_example.vim" "${PREFIX_MINIPIX}/share/vimrc";
		fi;
		for _fname in putty putty-256color screen screen-256color xterm xterm-256color; do
			_dname="${PREFIX_MINIPIX}/share/terminfo/${_fname%${_fname#[a-zA-Z]}}";
			if [ ! -e "${_dname}" ]; then
				ex_rtl_fileop mkdir "${_dname}";
			fi;
			if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/share/terminfo/${_term_letter}/${_fname}" "${_dname}"; then
				ex_rtl_fileop cp_follow "${PREFIX_NATIVE}/share/terminfo/${_term_letter}/${_fname}" "${_dname}";
			fi;
		done;
	fi;
};

# vim:filetype=sh