[BACK]Return to fix_ldconfig CVS log [TXT][DIR] Up to [local] / openbsd / fill_chroot

File: [local] / openbsd / fill_chroot / fix_ldconfig (download)

Revision 1.11, Mon Nov 4 01:13:18 2019 UTC (4 years, 6 months ago) by afresh1
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +2 -2 lines

Deal with removal of . from $PATH

Because I shouldn't have expected it to be there, so glad to have this
security improvement.

#!/bin/sh
# $AFresh1: fix_ldconfig,v 1.11 2019/11/04 01:13:18 afresh1 Exp $

if [ X"${CHROOT}" == X"" ]; then
  echo No CHROOT Specified!
  exit 255
fi

mkdir -p ${CHROOT}/var/run

for p in `ldconfig -r | awk '/search directories:/ { gsub(":", " ", $3); print $3 }'` ; do
	if [ -d ${CHROOT}${p} ]; then
		LD_PATH="${LD_PATH} ${p}"
	fi
done

if [ ! X"${LD_PATH}" == X"" ]; then
	cp /sbin/ldconfig ${CHROOT}
	echo running: ldconfig ${LD_PATH}
	chroot ${CHROOT} ./ldconfig ${LD_PATH}
	#chroot ${CHROOT} ldconfig -r
	rm -f ${CHROOT}/ldconfig
fi