[Lunar-commits] CVS: moonbase/utils/lilo/plugin.d
bootloader-lilo.plugin, NONE, 1.1
Auke Kok
sofar at lunar-linux.org
Wed Mar 30 10:49:29 UTC 2005
Update of /var/cvs/lunar/moonbase/utils/lilo/plugin.d
In directory espresso.foo-projects.org:/tmp/cvs-serv14680/utils/lilo/plugin.d
Added Files:
bootloader-lilo.plugin
Log Message:
Merging in module-dependent plugins
--- NEW FILE: bootloader-lilo.plugin ---
#!/bin/bash
#############################################################
# #
# bootloader-lilo.plugin - plugin that performs lilo.conf #
# maintenance #
# #
#############################################################
# #
# Copyright 2005 by Auke Kok under GPLv2 #
# #
#############################################################
plugin_kernel_updatebootloader_lilo() {
# preferred? - master switch for experienced users
if [ -n "$BOOTLOADER" -a "$BOOTLOADER" != "lilo" ]; then
return 2
fi
debug_msg "plugin_kernel_updatebootloader_lilo ($@)"
if ! ( grep -q "$1" /etc/lilo.conf && grep -q "$1.old" /etc/lilo.conf ) ; then
IFS_OLD=$IFS
export IFS="
"
rm -rf /etc/lilo.conf.new
cp /etc/lilo.conf /etc/lilo.conf.old
(( IMAGE_COUNT=0 ))
for LINE in $(cat /etc/lilo.conf) ; do
if echo $LINE | grep -q "image" || echo $LINE | grep -q "other" ; then
echo >> /etc/lilo.conf.new
if (( IMAGE_COUNT == 0 )) ; then
if ! grep -q "$1" /etc/lilo.conf ; then
printf "\nimage = %s\n label = %s\n read-only\n\n" "/boot/$1" "$2" >> /etc/lilo.conf.new
fi
if [ -f "/boot/$1.old" ] && ! grep -q "$1.old" /etc/lilo.conf ; then
printf "\nimage = %s\n label = %s\n read-only\n\n" "/boot/$1.old" "$2.old" >> /etc/lilo.conf.new
fi
fi
(( IMAGE_COUNT++ ))
fi
if (( IMAGE_COUNT == 14 )) ; then
break
fi
echo $LINE >> /etc/lilo.conf.new
done
if (( IMAGE_COUNT == 0 )) ; then
echo >> /etc/lilo.conf.new
if ! grep -q "$1" /etc/lilo.conf ; then
printf "\nimage = %s\n label = %s\n read-only\n\n" "/boot/$1" "$2" >> /etc/lilo.conf.new
fi
if [ -f /boot/"$1.old" ] && ! grep -q "$1.old" /etc/lilo.conf ; then
printf "\nimage = %s\n label = %s\n read-only\n\n" "/boot/$1.old" "$2.old" >> /etc/lilo.conf.new
fi
fi
cp /etc/lilo.conf.new /etc/lilo.conf
export IFS=$IFS_OLD
fi
if query "Edit lilo configuration manually ?" n ; then
edit_file /etc/lilo.conf
fi
/sbin/lilo
sleep 4
# right now we want to have it run all bootloaders?
return 2
}
plugin_register KERNEL_UPDATEBOOTLOADER plugin_kernel_updatebootloader_lilo
More information about the Lunar-commits
mailing list