Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 2b6d57de11205d1e4ec8b18312057c35 > files > 233

initng-ifiles-0.1.5-4.fc12.i686.rpm

#!/sbin/itype
# This is a i file, used by initng parsed by install_service

# NAME:
# DESCRIPTION:
# WWW:

service system/modules/depmod {
	need = system/initial system/mountroot;
	script start = {
		# Should not fail if kernel do not have module
		# support compiled in ...
		[ -f /proc/modules ] || exit 0

		# Here we should fail, as a modular kernel do need
		# depmod command ...
		if [ ! -e /lib/modules/`/bin/uname -r`/modules.dep ]
		then
			if [ ! -x /sbin/depmod ]
			then
				echo "ERROR:  system is missing /sbin/depmod !"
				exit 1
			fi
			/sbin/depmod
			exit 0
		else
			echo "Found modules.dep, skipping depmod ..."
		fi

		# if /etc/modules.d is newer then /etc/modules.conf
		if [ /etc/modules.d -nt /etc/modules.conf ]
		then
			echo "Calculating module dependencies ..."
			if [ ! -x /sbin/depmod ]
			then
				echo "ERROR:  system is missing /sbin/depmod !"
				exit 1
			fi
			/sbin/depmod
			exit 0
		else
			echo "Module dependencies up to date ..."
		fi

		wait
		exit 0
	};
}

service system/modules/dm-mod {
	need = system/initial;
	stdall = /dev/null;
	script start = {
		/sbin/modprobe -q dm-mod
		exit 0
	};
	script stop = {
		/sbin/modprobe -q -r dm-mod
		exit 0
	};
}

service system/modules/* {
	need = system/initial;
	use = system/modules/depmod;
	stdall = /dev/null;
	script start = {
		/sbin/modprobe -q ${NAME}
		exit 0
	};
	script stop = {
		/sbin/modprobe -q -r ${NAME}
		exit 0
	};
}

service system/modules {
	need = system/initial system/mountroot system/modules/loop;
	use = system/modules/depmod;
	script start = {
		load_modules() {
			[ -r "${1}" ] || return 1
			/bin/grep -v "^#" "${1}" | /bin/grep -v "^$" | while read MODULE MODARGS
			do
				{
					echo "Loading module \"${MODULE}\" ..."
					/sbin/modprobe -q ${MODULE} ${MODARGS}
				} &
			done
		}
		# GENTOO: Don't probe kernel version, initng, requires 2.6 anyway
		load_modules /etc/modules
		wait
		exit 0  # Bad things happen if we fail
	};
}