summaryrefslogtreecommitdiffstats
path: root/init.d/localinit
blob: 030a0fc6b01e461c87efef6bef55b814bae871df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/sbin/runscript

mount_once() {
	if mount | grep $1 >/dev/null 2>&1 ; then
		NOUMOUNT=$1
	else
		mount $1 >/dev/null 2>&1
	fi		
}

umount_once() {
	[ "$NOUMOUNT" != "$1" ] && umount "$1" 2>/dev/null
}

start() {
	for media in $MOUNTS ; do
		m="/media/$media"
		mount_once $m
		if [ -e $m/localinit ] ; then
			ebegin "Running localinit from $media"
			$m/localinit
			retcode=$?
			umount_once $m
			eend $retcode
			exit
		fi
		sleep 1
		umount_once $m
	done
}