also - i was playing today and came up with two new (better?) methods of building patched initscripts (i was mainly doing it for bootsplash but it should work for all patching). assuming patches are compatible you should be able to apply several and have a pkg that you can use in a local repo and easily update when new versions of initscripts are released.
i think the one that downloads the latest pkg first is more secure than the abs version - as there is no checksumming for abs?
anyway - the first gets the pkg from current, explodes it, patches it and rebuilds it - the second grabs the files that make the package from ABS (allows compile of minilogd)
# Contributor: dibblethewrecker <dibblethewrecker@jiwe.org>
# This package is only a modified version of the arch initscripts package
# It allows you to easily checkout the latest initscripts and patch them
# (based on a pkg by Brice Carpentier <brice@daknet.org>)
# (incorporated a patch by Truls Becken <becken@stud.ntnu.no>)
pkgname=initscripts-custom
pkgver=0.1
pkgrel=1
pkgdesc="System initialization/bootup scripts with bootsplash support"
backup=(etc/inittab etc/rc.conf etc/rc.local)
depends=('bash' 'mawk' 'grep' 'coreutils' 'sed' 'bootsplash')
provides=('initscripts')
conflicts=('initscripts')
source=(initscripts-bootsplash.diff)
md5sums=('53a00c6e85aa520673f5ce9a99eb0655')
build() {
# check the latest version of initscripts, grab it, copy and extract it to src
latestver=`pacman -Ss initscripts | grep current | sed "s|current/initscripts ||g"`
echo
echo " : Latest version in current repo is initscripts-$latestver"
echo -n " : Press any key to continue "
read anykey
pacman -Sw --noconfirm initscripts
cp /var/cache/pacman/pkg/initscripts-$latestver.pkg.tar.gz $startdir/src
cd $startdir/src
gunzip -cd initscripts-$latestver.pkg.tar.gz | tar xf -
# create the pkg - no compile required
mkdir -p $startdir/pkg/etc/{rc.d,conf.d}
cd $startdir/src/etc
install -D -m644 inittab $startdir/pkg/etc/inittab
install -D -m644 rc.conf $startdir/pkg/etc/rc.conf
for i in rc.local rc.multi rc.shutdown rc.single rc.sysinit; do
install -D -m755 $i $startdir/pkg/etc/$i
done
cd $startdir/src/etc/rc.d
install -D -m755 network $startdir/pkg/etc/rc.d/network
install -D -m755 netfs $startdir/pkg/etc/rc.d/netfs
install -D -m644 functions $startdir/pkg/etc/rc.d/functions
cd $startdir/src/sbin
install -D -m755 minilogd $startdir/pkg/sbin/minilogd
# apply your patches
cd $startdir/pkg/etc
patch -Np1 -i $startdir/src/initscripts-bootsplash.diff
}
# Maintainer: Brice Carpentier <brice@daknet.org>
# Contributor: Brice Carpentier <brice@daknet.org>
# This package is only a modified version of the arch initscripts package
# (incorporated a patch by Truls Becken <becken@stud.ntnu.no>)
pkgname=initscripts-custom
pkgver=0.1
pkgrel=1
pkgdesc="System initialization/bootup scripts with bootsplash support"
backup=(etc/inittab etc/rc.conf etc/rc.local)
depends=('bash' 'mawk' 'grep' 'coreutils' 'sed' 'bootsplash')
#makedepends=('cvs' 'openssh')
provides=('initscripts')
conflicts=('initscripts')
source=(initscripts-bootsplash.diff)
md5sums=('53a00c6e85aa520673f5ce9a99eb0655')
build() {
# alternative method - grab and build the source files from abs
#abs
cp /var/abs/base/initscripts/{inittab,netfs,rc.conf,rc.multi,rc.single,functions,minilogd.c,network,rc.local,rc.shutdown,rc.sysinit} $startdir/src
# use the normal build
cd $startdir/src
mkdir -p $startdir/pkg/etc/{rc.d,conf.d}
install -D -m644 functions $startdir/pkg/etc/rc.d/functions
install -D -m644 inittab $startdir/pkg/etc/inittab
install -D -m644 rc.conf $startdir/pkg/etc/rc.conf
for i in rc.local rc.multi rc.shutdown rc.single rc.sysinit; do
install -D -m755 $i $startdir/pkg/etc/$i
done
install -D -m755 network $startdir/pkg/etc/rc.d/network
install -D -m755 netfs $startdir/pkg/etc/rc.d/netfs
gcc -o minilogd minilogd.c || return 1
install -D -m755 minilogd $startdir/pkg/sbin/minilogd
# apply your patches
cd $startdir/pkg/etc
patch -Np1 -i $startdir/src/initscripts-bootsplash.diff
}
[EDIT]
ps.
it seems they dont like doing it either :
# I hate this hack. -- Md
can u please add the contents of "/etc/udev/links.conf" ?
no problem...
# This file does not exist. Please do not ask the debian maintainer about it.
# You may use it to do strange and wonderful things, at your risk.
L fd /proc/self/fd
L stdin /proc/self/fd/0
L stdout /proc/self/fd/1
L stderr /proc/self/fd/2
L core /proc/kcore
L sndstat /proc/asound/oss/sndstat
L MAKEDEV /sbin/MAKEDEV
D pts
D shm
# Hic sunt leones.
M ppp c 108 0
D loop
M loop/0 b 7 0
D net
M net/tun c 10 200
#!/bin/sh -e
PATH="/sbin:/bin"
# defaults
tmpfs_size="5M"
udev_root="/dev/"
[ -x /sbin/udevstart ] || exit 0
. /etc/udev/udev.conf
. /lib/lsb/init-functions
case "$(uname -r)" in
2.[012345].*|2.6.[0-7]|2.6.[0-7][!0-9]*)
log_failure_msg "udev requires a kernel >= 2.6.8, not started."
exit 0
;;
esac
if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then
log_failure_msg "udev requires tmpfs support, not started."
exit 0
fi
if [ ! -e /proc/sys/kernel/hotplug ]; then
log_failure_msg "udev requires hotplug support, not started."
exit 0
fi
##############################################################################
# we need to unmount /dev/pts/ and remount it later over the tmpfs
unmount_devpts() {
if mountpoint -q /dev/pts/; then
umount -l /dev/pts/
fi
if mountpoint -q /dev/shm/; then
umount -l /dev/shm/
fi
}
# mount a tmpfs over /dev, if somebody did not already do it
mount_tmpfs() {
if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then
return 0
fi
# /.dev is used by /sbin/MAKEDEV to access the real /dev directory.
# if you don't like this, remove /.dev/.
[ -d /.dev ] && mount -n --bind /dev /.dev
log_begin_msg "Mounting a tmpfs over /dev..."
mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs none /dev
log_end_msg $?
}
# I hate this hack. -- Md
make_extra_nodes() {
grep '^[^#]' /etc/udev/links.conf |
while read type name arg1; do
[ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
case "$type" in
L) ln -s $arg1 /dev/$name ;;
D) mkdir -p /dev/$name ;;
M) mknod --mode=600 /dev/$name $arg1 ;;
*) log_warning_msg "links.conf: unparseable line ($type $name $arg1)" ;;
esac
done
}
##############################################################################
if [ "$udev_root" != "/dev/" ]; then
log_warning_msg "WARNING: udev_root != /dev/"
case "$1" in
start)
if [ -e "$udev_root/.udevdb" ]; then
if mountpoint -q /dev/; then
log_failure_msg "FATAL: udev is already active on $udev_root."
exit 1
else
log_warning_msg "WARNING: .udevdb already exists on the old $udev_root!"
fi
fi
mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs none $udev_root
log_begin_msg "Creating initial device nodes..."
udevstart
log_end_msg $?
;;
stop)
start-stop-daemon --stop --exec /sbin/udevd --oknodo --quiet
log_begin_msg "Unmounting $udev_root..."
# unmounting with -l should never fail
if umount -l $udev_root; then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
log_success_msg "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
fi # udev_root != /dev/
##############################################################################
# When modifying this script, do not forget that between the time that
# the new /dev has been mounted and udevstart has been run there will be
# no /dev/null. This also means that you cannot use the "&" shell command.
case "$1" in
start)
if [ -e "$udev_root/.udevdb" ]; then
if mountpoint -q /dev/; then
log_failure_msg "FATAL: udev is already active on $udev_root."
exit 1
else
log_warning_msg "WARNING: .udevdb already exists on the old $udev_root!"
fi
fi
unmount_devpts
mount_tmpfs
[ -d /proc/1 ] || mount -n /proc
log_begin_msg "Creating initial device nodes..."
udevstart
log_end_msg $?
make_extra_nodes
# some other packages depend on the presence of this file
: > /dev/.udev.tdb
;;
stop)
start-stop-daemon --stop --exec /sbin/udevd --oknodo --quiet
unmount_devpts
log_begin_msg "Unmounting /dev..."
# unmounting with -l should never fail
if umount -l /dev; then
log_end_msg 0
umount -l /.dev || true
/etc/init.d/mountvirtfs start
else
log_end_msg 1
fi
;;
restart|force-reload)
start-stop-daemon --stop --exec /sbin/udevd --oknodo --quiet
log_begin_msg "Recreating device nodes..."
udevstart
make_extra_nodes
log_end_msg $?
;;
*)
echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
I hope that will shed some light on the subject!
]]>would it also just be possible for the script to check for the existence of the particular /dev/device and sleep if it cannot find it before trying again?
Yeah, that seems to work fine, as long as you background the daemon in question (otherwise you'll get annoyed waiting for the devices to be created).
I'm sure there must be some way to tell udev to create the specific devices on startup, instead of waiting for the modules to load and creating them dynamically. I don't have much knowledge of udev though, so I'm not sure. I may be wrong, because the devices are theoretically not much use unless they have kernel modules attached anyway, right???
I wonder if compiling the sound devices into the kernel instead of using a module would make a difference.
Anyway, I'm just sleeping in my alsamixer script for now. It works for me, I just don't like how ugly it is as a general purpose fix.
Dusty
]]>sorry dusty, you might also like to check the syntax of the splash.d script - it maybe flawed...
would it also just be possible for the script to check for the existence of the particular /dev/device and sleep if it cannot find it before trying again?
i know that is essentially just what you suggested dusty i was just making my understanding explicit
]]>my theory is the /dev has not been fully populated when alsamixer and splash run, which means it can't find the devs, a few seconds later they are there and the daemons work fine - the reason why the ldconfig maybe affecting it is because ldconfig gives /dev longer to be populated before the other daemons run. possibly udev takes longer to populate /dev also?
how does that sounds guru? how can we fix it?
I'm having the same problem, and support your theory. I tried adding a sleep call to the alsamixer script and it fixes the problem. This indicates that there is indeed a race condition here.
I thought that perhaps running hotplug before alsamixer would solve it, but it doesn't. Not running hotplug at all, and allowing udev to take care of it internally also does not solve the problem.
I don't know much about udev; it may be possible to force it to load the sound devices statically, instead of waiting for the module to load (but this is kind of dumb), or the alsamixer script may need to be modified to wait until the dev tree is populated... a simple loop that repeats the action if there is an error might suffice, or you could just use a sleep call and background the alsamixer daemon...
but these are all very ugly hacks. I'm certain there must be a better way to do it; alsamixer musn't be the only daemon that requires udev to have devices set up...
Dusty
my theory is the /dev has not been fully populated when alsamixer and splash run, which means it can't find the devs, a few seconds later they are there and the daemons work fine - the reason why the ldconfig maybe affecting it is because ldconfig gives /dev longer to be populated before the other daemons run. possibly udev takes longer to populate /dev also?
how does that sounds guru? how can we fix it?
]]>actually, ldconfig is already running after each pacman package install... im guessing they'd put ldconfig in the rc.sysinit to avoid the initial ldconfig execution delay on pacman execution... this makes pacman looks faster
i myself removed it toally from rc.sysinit, since pacman will execute it anyway once its needed... who needs the 20 second delay at each startup.. Cool
I tried to comment out ldconfig from rc.sysinit, but whenever I do so, the alsamixer script from /etc/rc.d claims to not find any soundcards during boot and fails to restore my soundcard volumes.
I can manually alsamixer the volumes up when I log in.
This problem only happens when I comment out "Updating Shared Library Links" from rc.sysinit. Anyone know why this happens?
Btw, it's an sblive and modules are loaded via rc.conf
]]>In /etc/rc.sysinit can I comment out or delete these lines?
if [ "$FASTBOOT" != "yes" -a "$FASTBOOT" != "YES" ]; then
status "Updating Shared Library Links" /sbin/ldconfig
fi
I assume this is all that needs to be played with, but I wanted to make sure that I wasn't touching anything else.
And if this is done it is enough to just allow pacman to do it after updates correct? I should I be running it using cron more often?
]]>