midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame etc/midipix_check.sh

Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
#!/bin/sh
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
set -o errexit -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
if [ "${1}" = "-m" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	MIDIPIX_DNAME_DIST=minipix; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
if [ -n "${1}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	MIDIPIX_PATH=$(cygpath -am "${1}");
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
else
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	MIDIPIX_PATH=$(cygpath -am .);
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
: ${MIDIPIX_DNAME_DIST:=native};
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
echo "Absolute Midipix pathname: ${MIDIPIX_PATH}";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
echo "Distribution name        : ${MIDIPIX_DNAME_DIST}";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
printf "%-85s" "Checking if all binaries are present...";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
for __ in chroot env ntctty.exe; do
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	if [ ! -e ${MIDIPIX_PATH}/${MIDIPIX_DNAME_DIST}/bin/${__} ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		printf "\nerror: missing file ${MIDIPIX_PATH}/${MIDIPIX_DNAME_DIST}/bin/${__}\n";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		exit 2;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
done;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
printf "\033[97m[  \033[92mOK  \033[97m]\033[0m\n";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
printf "%-85s" "Checking ${MIDIPIX_PATH}/${MIDIPIX_DNAME_DIST}/lib for symbolic links...";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
if [ -n "$(find ${MIDIPIX_DNAME_DIST}/lib					\
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		-maxdepth 1 -name \*.so -type l -print -quit)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	echo;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	echo "Warning: ${MIDIPIX_PATH}/${MIDIPIX_DNAME_DIST}/lib contains shared objects (library"
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	echo "images) that are symbolic links. This is not supported by Midipix at"
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	echo "present and commonly occurs if the binary distribution tarball was"
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	echo "extracted by an application that does not support symbolic links"
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	echo "correctly. This also occurs when a binary distribution was built locally."
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	printf "Convert all shared object symbolic links to hard links? (y|N) ";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	read __;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	case "${__}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		[yY])	break; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		*)	echo "Exiting."; exit 3; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	for LINK_NAME in $(find ${MIDIPIX_PATH}/${MIDIPIX_DNAME_DIST}/lib	\
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
			-maxdepth 1 -name \*.so -type l); do
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		LINK_TARGET="$(readlink -- "${LINK_NAME}")";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		if [ -f "${MIDIPIX_PATH}/native/lib/${LINK_TARGET}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
			echo rm -f -- "${LINK_NAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
			rm -f -- "${LINK_NAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
			echo ln -f -- "${LINK_TARGET}" "${LINK_NAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
			ln -f -- "${LINK_TARGET}" "${LINK_NAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
printf "\033[97m[  \033[92mOK  \033[97m]\033[0m\n";
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
Lucio Andrés Illanes Albornoz (arab, vxp) 222d37
# vim:filetype=sh