Sophie

Sophie

distrib > Mandriva > 10.1 > i586 > by-pkgid > 77d4f3b28bbd05e3cd801bca9225262f > files > 3

slbd-0.25-1mdk.src.rpm

#!/bin/sh
# script to make a new chroot for slbd
CHROOT_PATH=${1}
MEDIA=${2}

# sanity checks

if [ -z ${CHROOT_PATH} ] ; then
	echo "No path supplied, aborting."
	exit 1
else
	echo "I'm about to REMOVE the contents of the following directory: ${CHROOT_PATH}."
	HMF=`ls -lR ${CHROOT_PATH} | wc -l`
	echo "There are approximately ${HMF} files in that directory."
	read -p "Would you like to proceed? (Yes/No)" INPUT
	if [ ${INPUT} = "No" ] ; then
		echo "Excellent choice. Aborting."
		exit 0
	else
		if [ ${INPUT} = "Yes" ] ; then
			rm -rf ${CHROOT_PATH}
			mkdir -p ${CHROOT_PATH}/var/lib/rpm
			
			if [ -z ${MEDIA} ] ; then
				urpmi \
				basesystem \
				rpm-build \
				--auto-select \
				--root ${CHROOT_PATH}
			else
				urpmi \
				basesystem \
				rpm-build \
				--auto-select \
				--media ${MEDIA} \
				--root ${CHROOT_PATH}
			fi

			cp /etc/resolv.conf	${CHROOT_PATH}/etc/resolv.conf

# This step may require some manual attention as it
# depends on how you setup your chroots, see RPM_MACROS
# option in ~/.slbd configuration file

			cp -av /etc/skel/		${CHROOT_PATH}/home/
			mv ${CHROOT_PATH}/home/skel	${CHROOT_PATH}/home/slbd
			mkdir -p ${CHROOT_PATH}/home/slbd/RPM/{BUILD,RPMS/{alpha,amd64,i386,i486,i586,i686,noarch,ppc,ppc64,sparc,sparc64},SOURCES,SRPMS,SPECS,tmp}
			cp -av ~slbd/.rpmrc		${CHROOT_PATH}/home/slbd
			cp -av ~slbd/.rpmmacros.*	${CHROOT_PATH}/home/slbd
			chown -R slbd:slbd		${CHROOT_PATH}/home/slbd
			getent passwd | grep ^slbd >>	${CHROOT_PATH}/etc/passwd
			getent group  | grep ^slbd >>	${CHROOT_PATH}/etc/group
		else
			echo "You need to say either \"Yes\" or \"No\". Aborting"
	                exit 1
		fi
	fi
fi