mountall 1.68 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#/bin/sh -e
#event-driven initramfs hook for mountall

PREREQ=""

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

Surbhi Palande's avatar
Surbhi Palande committed
12
if [ -z "$INITRAMFS_EVENT_DRIVEN" ]; then
13
14
15
16
17
18
19
20
21
22
23
24
	exit 0;
fi

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

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

25
26
copy_exec /sbin/mountall
copy_exec /sbin/mntctl
27
28
29
30
31
32
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/
Surbhi Palande's avatar
Surbhi Palande committed
33
34
35
36
37
38
39
40
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
41

Surbhi Palande's avatar
Surbhi Palande committed
42
libnss_compat=`dpkg -L libc6 | grep libnss_compat.so.2`
43
if [ -f $libnss_compat ]; then
Surbhi Palande's avatar
Surbhi Palande committed
44
45
46
47
48
49
50
51
52
53
	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
54
else
Surbhi Palande's avatar
Surbhi Palande committed
55
	echo "libnss_files.so.2 not found"
56
57
58
59
	echo "warning: mountall would not be able to connect to upstart"
	exit 1
fi

Surbhi Palande's avatar
Surbhi Palande committed
60
61
62
63
64
65
66
67
68
69
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/