I may think of a mechanism to do a “post-registrationscripts” setup that works similarly to post-download script. However, part of the registration system does not require storage information which is really what’s needed to do this properly.
Your mechanism of updating an init for yourself would work, but it does make keeping up with changes in the init’s a little more difficult, though I don’t imagine much of the changes affecting the way your init would work.
I have a script that allows me to customize init’s on the fly in the case my build system is just taking too long.
#!/bin/bash
# Check for webroot
if [ -n "$1" -a -e "$1" ]; then
webroot="$1";
elif [ -e "/srv/http/fog" ]; then
webroot="/srv/http/fog";
elif [ -e "/var/www/html/fog" ]; then
webroot="/var/www/html/fog";
elif [ -e "/var/www/fog" ]; then
webroot="/var/www/fog";
fi
if [ ! -e "$webroot/service" ]; then
echo "No service directory to work from"
exit 1
fi
if [ ! -e "$webroot/service/ipxe" ]; then
echo "No ipxe directory to work from"
exit 1
fi
ipxeroot="$webroot/service/ipxe"
currDirectory=`pwd`
init64=''
init32=''
if [ ! -f "$ipxeroot/init.xz" -a ! -f "$ipxeroot/init" ]; then
echo "No 64 bit init to process"
init64='no'
fi
if [ ! -f "$ipxeroot/init_32.xz" -a ! -f "$ipxeroot/init_32" ]; then
echo "No 32 bit init to process"
init32='no'
fi
if [ -n "$init64" -a -n "$init32" ]; then
echo "No init files to process"
exit 1
fi
if [ ! -e "$ipxeroot/tmp" ]; then
mkdir $ipxeroot/tmp >/dev/null 2>&1
fi
copyTrunkFiles() {
svn up /root/trunk/ >/dev/null 2>&1
cp -r /root/trunk/src/buildroot/package/fog/scripts/bin/* $ipxeroot/tmp/bin/ >/dev/null 2>&1
cp -r /root/trunk/src/buildroot/package/fog/scripts/usr/* $ipxeroot/tmp/usr/ >/dev/null 2>&1
cp -r /root/trunk/src/buildroot/package/fog/scripts/etc/* $ipxeroot/tmp/etc/ >/dev/null 2>&1
cp -r /root/trunk/src/buildroot/system/skeleton/etc/* $ipxeroot/tmp/etc/ >/dev/null 2>&1
errorStat $?
}
mountTmpFolder() {
mount -o loop $ipxeroot/$1 $ipxeroot/tmp >/dev/null 2>&1
if [ -z "$2" ]; then
errorStat $?
elif [ "$?" != "0" -a -f "$ipxeroot/$1" ]; then
unmountTmpFolder "true"
mountTmpFolder "$1"
fi
}
unmountTmpFolder() {
umount $ipxeroot/tmp >/dev/null 2>&1
if [ -z "$1" ]; then
errorStat $?
fi
}
initFSCheck() {
fsck.ext2 -a $ipxeroot/$1 >/dev/null 2>&1
errorStat $?
}
recompressInit() {
xz -9 -C crc32 >/dev/null 2>&1 < $ipxeroot/$1 > $ipxeroot/${1}.xz
errorStat $?
}
decompressInit() {
xz -d >/dev/null 2>&1 < $ipxeroot/${1}.xz > $ipxeroot/$1
errorStat $?
}
errorStat() {
if [ "$1" != "0" ]; then
echo "Failed"
exit 1
fi
echo "OK"
}
if [ -z "$init64" ]; then
if [ -f "$ipxeroot/init.xz" -a ! -f "$ipxeroot/init" ]; then
echo -n " * Decompressing 64 bit init..."
decompressInit "init"
else
echo " * 64 bit init already extracted"
fi
echo -n " * Mounting 64 bit init..."
mountTmpFolder "init" "yes"
echo -n " * Copying trunk files..."
copyTrunkFiles
echo -n " * Unmounting init..."
unmountTmpFolder
echo -n " * Checking ext2 filesystem..."
initFSCheck "init"
echo -n " * Recompressing 64 bit Init..."
recompressInit "init"
fi
if [ -z "$init_32" ]; then
if [ -f "$ipxeroot/init_32.xz" -a ! -f "$ipxeroot/init_32" ]; then
echo -n " * Decompressing 32 bit init..."
decompressInit "init_32"
else
echo " * 32 bit init already extracted"
fi
echo -n " * Mounting 32 bit init..."
mountTmpFolder "init_32" "yes"
echo -n " * Copying trunk files..."
copyTrunkFiles
echo -n " * Unmounting init..."
unmountTmpFolder
echo -n " * Checking ext2 filesystem..."
initFSCheck "init_32"
echo -n " * Recompressing 32 bit Init..."
recompressInit "init_32"
fi
I realize this is probably not customized for your needs, but it should do what you need in a pinch. Of course you’re more than welcome to editing it.