Your IP : 172.28.240.42


Current Path : /usr/share/initramfs-tools/hooks/
Upload File :
Current File : //usr/share/initramfs-tools/hooks/mountall

#!/bin/sh -e
#event-driven initramfs hook for mountall

PREREQ=""

#Output prequisites
prereqs()
{
	echo "$PREREQ"
}

if [ -z "$INITRAMFS_EVENT_DRIVEN" ]; then
	exit 0;
fi

case $1 in
    prereqs)
	prereqs
	exit 0
	;;
esac

. /usr/share/initramfs-tools/hook-functions

copy_exec /sbin/mountall
copy_exec /sbin/mntctl
mkdir -p ${DESTDIR}/lib/init/
mkdir -p ${DESTDIR}/etc/dbus-1/system.d/
cp /etc/dbus-1/system.d/Mountall.Server.conf ${DESTDIR}/etc/dbus-1/system.d/

# Following is needed for mountall authentication with dbus
cp	  /etc/passwd		${DESTDIR}/etc/
if ! grep -q '^root:' ${DESTDIR}/etc/passwd 2>/dev/null; then
	echo 'root:x:0:0:root:/root:/bin/sh' >> ${DESTDIR}/etc/passwd
fi
# we use our own nsswitch - used for mountall authentication with dbus
# this is our dummy nss stack - uses libnss_files.so

echo 'passwd:	files' >${DESTDIR}/etc/nsswitch.conf
echo 'group:	files' >>${DESTDIR}/etc/nsswitch.conf

libnss_compat=`dpkg -L libc6 | grep libnss_compat.so.2`
if [ -f $libnss_compat ]; then
	cp -uv $libnss_compat ${DESTDIR}/lib/libnss_compat.so.2
else
	echo "libnss_compat.so.2 not found"
	echo "warning: mountall would not be able to connect to upstart"
	exit 1
fi

libnss_files=`dpkg -L libc6 | grep libnss_files.so.2`
if [ -f $libnss_files ]; then
	cp -uv $libnss_files ${DESTDIR}/lib/libnss_files.so.2
else
	echo "libnss_files.so.2 not found"
	echo "warning: mountall would not be able to connect to upstart"
	exit 1
fi

libuuid=`dpkg -L libuuid1 | grep "libuuid.so.1$"`
if [ -f $libuuid ]; then
	cp -uv $libuuid ${DESTDIR}/lib/libuuid.so.1
else
	echo "libuuid.so.1 not found"
	echo "warning: root device may not be discovered if uuid is used in fstab"
	exit 1
fi

cp /etc/blkid.conf ${DESTDIR}/etc/