Blame vars/invariants_minipix.vars

Lucio Andrés Illanes Albornoz 0eaee4
#
Lucio Andrés Illanes Albornoz 0eaee4
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz 0eaee4
#
Lucio Andrés Illanes Albornoz 0eaee4
Lucio Andrés Illanes Albornoz 0eaee4
pkgp_invariants_minipix_is_newer() {
Lucio Andrés Illanes Albornoz 0eaee4
	local _new_fname="${1}" _new_ts="" _old_dname="${2}" _old_ts="";
Lucio Andrés Illanes Albornoz e402f6
	if ! _old_ts="$(stat -c %Y "${_old_dname%%/}/${_new_fname##*/}" 2>/dev/null)"	\
Lucio Andrés Illanes Albornoz e402f6
	|| !  _new_ts="$(stat -c %Y "${_new_fname}" 2>/dev/null)"; then
Lucio Andrés Illanes Albornoz e402f6
		return 0;
Lucio Andrés Illanes Albornoz e402f6
	elif [ "${_new_ts}" -gt "${_old_ts}" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
		return 0;
Lucio Andrés Illanes Albornoz 0eaee4
	else
Lucio Andrés Illanes Albornoz 0eaee4
		return 1;
Lucio Andrés Illanes Albornoz 0eaee4
	fi;
Lucio Andrés Illanes Albornoz 0eaee4
};
Lucio Andrés Illanes Albornoz 0eaee4
Lucio Andrés Illanes Albornoz 0eaee4
pkg_invariants_minipix_all() {
Lucio Andrés Illanes Albornoz 0eaee4
	local _dname="" _fname="" _pname="";
Lucio Andrés Illanes Albornoz 0eaee4
	if ex_rtl_lmatch "${ARG_DIST}" , minipix; then
Lucio Andrés Illanes Albornoz 0eaee4
		for _dname in "${PREFIX_MINIPIX}/bin" "${PREFIX_MINIPIX}/share"; do
Lucio Andrés Illanes Albornoz 0eaee4
			if [ ! -e "${_dname}" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
				ex_rtl_fileop mkdir "${_dname}";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz 0eaee4
		done;
Lucio Andrés Illanes Albornoz 0eaee4
		for _fname in clear reset tset; do
Lucio Andrés Illanes Albornoz 0eaee4
			if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin"; then
Lucio Andrés Illanes Albornoz 0eaee4
				ex_rtl_fileop cp_follow "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz 0eaee4
		done;
Lucio Andrés Illanes Albornoz e402f6
		for _pname in $(find "${PREFIX}/minipix_dist/bin"					\
Lucio Andrés Illanes Albornoz 0eaee4
				-maxdepth 1 -perm /a=x -type f -and \( -not -name "lib*" \)); do
Lucio Andrés Illanes Albornoz 0eaee4
			if pkgp_invariants_minipix_is_newer "${_pname}" "${PREFIX_MINIPIX}/bin"; then
Lucio Andrés Illanes Albornoz 0eaee4
				ex_rtl_fileop cp_follow "${_pname}" "${PREFIX_MINIPIX}/bin";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz 0eaee4
		done;
Lucio Andrés Illanes Albornoz cfec25
		for _fname in libc.so libcrypto.so.45 liblzma.so.5 libmagic.so.1			\
Lucio Andrés Illanes Albornoz 0eaee4
				libncursesw.so.6 libpcre.so.1 libpsxscl.so libreadline.so.7		\
Lucio Andrés Illanes Albornoz cfec25
				libu16ports.so.0 libssl.so.47 libtinfo.so.6 libtinfow.so.6		\
Lucio Andrés Illanes Albornoz 0eaee4
				libunistring.so.2 libuuid.so.1 libz.so.1; do
Lucio Andrés Illanes Albornoz 0eaee4
			if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin"; then
Lucio Andrés Illanes Albornoz 0eaee4
				ex_rtl_fileop cp_follow							\
Lucio Andrés Illanes Albornoz 0eaee4
					"${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz 0eaee4
		done;
Lucio Andrés Illanes Albornoz 0eaee4
		for _fname in nano vim; do
Lucio Andrés Illanes Albornoz 0eaee4
			if pkgp_invariants_minipix_is_newer "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share"; then
Lucio Andrés Illanes Albornoz 0eaee4
				ex_rtl_fileop cp_follow "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz 0eaee4
		done;
Lucio Andrés Illanes Albornoz 0eaee4
		if [ ! -L "${PREFIX_MINIPIX}/share/nanorc" ]; then 
Lucio Andrés Illanes Albornoz 0eaee4
			ex_rtl_fileop ln_symbolic "nano/nanorc.nanorc" "${PREFIX_MINIPIX}/share/nanorc";
Lucio Andrés Illanes Albornoz 0eaee4
		fi;
Lucio Andrés Illanes Albornoz 0eaee4
		if [ ! -L "${PREFIX_MINIPIX}/share/vimrc" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
			ex_rtl_fileop ln_symbolic "vim/vim74/vimrc_example.vim" "${PREFIX_MINIPIX}/share/vimrc";
Lucio Andrés Illanes Albornoz 0eaee4
		fi;
Lucio Andrés Illanes Albornoz 0eaee4
		for _fname in putty putty-256color screen screen-256color xterm xterm-256color; do
Lucio Andrés Illanes Albornoz e402f6
			_dname="share/terminfo/${_fname%${_fname#[a-zA-Z]}}";
Lucio Andrés Illanes Albornoz e402f6
			if [ ! -e "${PREFIX_MINIPIX}/${_dname}" ]; then
Lucio Andrés Illanes Albornoz e402f6
				ex_rtl_fileop mkdir "${PREFIX_MINIPIX}/${_dname}";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz e402f6
			if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/${_dname}/${_fname}" "${PREFIX_MINIPIX}/${_dname}"; then
Lucio Andrés Illanes Albornoz e402f6
				ex_rtl_fileop cp_follow "${PREFIX_NATIVE}/${_dname}/${_fname}" "${PREFIX_MINIPIX}/${_dname}";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz 0eaee4
		done;
Lucio Andrés Illanes Albornoz 0eaee4
	fi;
Lucio Andrés Illanes Albornoz 0eaee4
};
Lucio Andrés Illanes Albornoz 0eaee4
Lucio Andrés Illanes Albornoz 0eaee4
# vim:filetype=sh