# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# ROCK Linux: rock-src/package/hannes/minit/minit.conf
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
# 
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
# 
# --- ROCK-COPYRIGHT-NOTE-END ---


minit_pm() {
	mkdir -p $root/etc/minit/default
	
	mkdir -p $root/etc/minit/ctrlaltdel
	ln -sf /sbin/halt $root/etc/minit/ctrlaltdel/run
	echo "-fp" > $root/etc/minit/ctrlaltdel/params
	
	mkdir -p $root/etc/minit/cleanup
	cat <<EOT >$root/etc/minit/cleanup/run
#!/bin/sh
cp -f /dev/null /etc/mtab
rm -rf /var/run/*
touch /var/run/utmp
EOT
	chmod +x $root/etc/minit/cleanup/run
	touch $root/etc/minit/cleanup/sync
	echo remount > $root/etc/minit/cleanup/depends
	echo cleanup >> $root/etc/minit/default/depends
	
	mkdir -p $root/etc/minit/remount
	ln -sf /bin/mount $root/etc/minit/remount/run
	cat <<EOT > $root/etc/minit/remount/params
-o
remount,rw
/
EOT
	touch $root/etc/minit/remount/sync
	
	mkdir -p $root/etc/minit/mountproc
	ln -sf /bin/mount $root/etc/minit/mountproc/run
	echo /proc > $root/etc/minit/mountproc/params
	touch $root/etc/minit/mountproc/sync
	echo mountproc >> $root/etc/minit/default/depends
	
	mkdir -p $root/etc/minit/mountall
	ln -sf /bin/mount $root/etc/minit/mountall/run
	echo "-a" >> $root/etc/minit/mountall/params
	touch $root/etc/minit/mountall/sync
	echo mountall >> $root/etc/minit/default/depends
	
	mkdir -p $root/etc/minit/ifconfiglo
	ln -sf /sbin/ifconfig $root/etc/minit/ifconfiglo/run
	cat <<EOT > $root/etc/minit/ifconfiglo/params
lo
127.0.0.1
EOT
	echo ifconfiglo >> $root/etc/minit/default/depends
	
	mkdir -p $root/etc/minit/hostname
	ln -sf /bin/hostname $root/etc/minit/hostname/run
	ln -sf /etc/HOSTNAME $root/etc/minit/hostname/params
	echo hostname >> $root/etc/minit/default/depends
	
	mkdir -p $root/etc/minit/hwclock
	ln -sf /sbin/hwclock $root/etc/minit/hwclock/run
	echo "--hctosys" > $root/etc/minit/hwclock/params
	
	mkdir -p $root/etc/minit/kbd
	ln -sf /bin/loadkeys $root/etc/minit/kbd/run
	echo us > $root/etc/minit/kbd/params
	touch $root/etc/minit/kbd/sync

	mkdir -p $root/etc/minit/devfsd
	ln -sf /sbin/devfsd $root/etc/minit/devfsd/run
	echo /dev > $root/etc/minit/devfsd/params
	echo devfsd >> $root/etc/minit/default/depends
	
	
	mkdir -p $root/etc/minit/getty
	echo kbd >> $root/etc/minit/getty/depends
	echo hwclock >> $root/etc/minit/getty/depends
	declare -i i=1
	while [ $i -le 6 ];
	do
		mkdir -p $root/etc/minit/getty/$i
		touch $root/etc/minit/getty/$i/respawn
		ln -sf /sbin/fgetty $root/etc/minit/getty/$i/run
		echo "vc/$i" > $root/etc/minit/getty/$i/params
		echo getty/$i >> $root/etc/minit/getty/depends
		i=i+1
	done
	echo getty >> $root/etc/minit/default/depends
}

var_append makeinstopt ' ' "DESTDIR=$root/"
hook_add postmake 5 "minit_pm"