[Lunar-commits] CVS: theedge/var/lib/lunar/functions kernel.lunar, 1.12, 1.13 plugins.lunar, 1.4, 1.5

Auke Kok sofar at lunar-linux.org
Sun Mar 27 22:02:32 UTC 2005


Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory espresso.foo-projects.org:/tmp/cvs-serv14505/var/lib/lunar/functions

Modified Files:
	kernel.lunar plugins.lunar 
Log Message:
Moving bootloader code to plugins: we need to move the plugins out to the moonbase-modules later on.


Index: kernel.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/kernel.lunar,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- kernel.lunar	14 Feb 2005 13:01:25 -0000	1.12
+++ kernel.lunar	27 Mar 2005 22:02:29 -0000	1.13
@@ -1,9 +1,4 @@
 #!/bin/bash
-#                                                          #
-# subroutines - Lunar subroutines                          #
-#                                                          #
-# Copyright Kyle Sallee 2000, 2001                         #
-#                                                          #
 ############################################################
 #                                                          #
 # kernel.lunar functions for managing kernel installation  #
@@ -12,199 +7,52 @@
 ############################################################
 #                                                          #
 # Parts Copyright Terry Chan 2002 GPLv2                    #
-# Parts Copyrighted Niki Guldbrand 2003 under GPLv2        #
+# Parts Copyright Niki Guldbrand 2003 GPLv2                #
 # Parts Copyright FW Systems llc 2003 GPLv2                #
+# Parts Copyright Auke Kok 2005 GPLv2                      #
 #                                                          #
 ############################################################
 
-#
-# Description : This function makes backups of the kernels and the kernel
-#               module dirs.
-# Name        : backup_mods_krnl
+
+# Description : This function makes backups of the kernels and modules
 # Arg 1       : Filename of the kernel to backup (With or witout full path)
 #               With the format $VERSION_$EXTRAVERSION
-backup_mods_krnl()
-{
-  debug_msg "backup_mods_krnl ($@)"
-
-  devoke_installwatch  
-
-  BKUP_KRNL=$1
-
-  if [ -f /boot/${BKUP_KRNL}.old ]; then
-    verbose_msg "moving old kernel backup"
-    mv -f /boot/${BKUP_KRNL}.old /boot/${BKUP_KRNL}.old_2
-  fi
-
-  if [ -f /boot/${BKUP_KRNL} ]; then
-    verbose_msg "copying ${BKUP_KRNL}"
-    cp -p /boot/${BKUP_KRNL} /boot/${BKUP_KRNL}.old
-  fi
+backup_mods_krnl() {
+	debug_msg "backup_mods_krnl ($@)"
 
-  if [ -d /lib/modules/${BKUP_KRNL} ]; then
-    rm -rf /lib/modules/${BKUP_KRNL}.old
-    cp -a /lib/modules/${BKUP_KRNL} /lib/modules/${BKUP_KRNL}.old
-  fi
+	devoke_installwatch
 
-  invoke_installwatch 
+	if [ -f /boot/$1.old ]; then
+		verbose_msg "moving old kernel backup"
+		mv -f /boot/$1.old /boot/$1.old_2
+	fi
+	if [ -f /boot/$1 ]; then
+		verbose_msg "copying $1"
+		cp -p /boot/$1 /boot/$1.old
+	fi
+	if [ -d /lib/modules/$1 ]; then
+		rm -rf /lib/modules/$1.old
+		cp -a /lib/modules/$1 /lib/modules/$1.old
+	fi
 
+	invoke_installwatch 
 }
 
 
-# function update_lilo
-# Description: creates /etc/lilo.conf stanzas
-# usage: update_lilo bootimagename menuname
-update_lilo()  {
-  debug_msg "update_lilo ($@)"
-
-  IMAGE_NAME=$1
-  BOOT_LABEL=$2
-
-  if ! ( grep -q "$IMAGE_NAME" /etc/lilo.conf && grep -q "$IMAGE_NAME.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 "$IMAGE_NAME" /etc/lilo.conf ; then
-            printf "\nimage = %s\n    label = %s\n    read-only\n\n" "/boot/$IMAGE_NAME" "$BOOT_LABEL" >> /etc/lilo.conf.new
-          fi
-          if [ -f "/boot/$IMAGE_NAME.old" ] && ! grep -q "$IMAGE_NAME.old" /etc/lilo.conf ; then
-            printf "\nimage = %s\n    label = %s\n    read-only\n\n"  "/boot/$IMAGE_NAME.old" "$BOOT_LABEL.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 "$IMAGE_NAME" /etc/lilo.conf ; then
-        printf "\nimage = %s\n    label = %s\n    read-only\n\n" "/boot/$IMAGE_NAME" "$BOOT_LABEL" >> /etc/lilo.conf.new
-      fi
-      if [ -f /boot/"$IMAGE_NAME.old" ] && ! grep -q "$IMAGE_NAME.old" /etc/lilo.conf ; then
-        printf "\nimage = %s\n    label = %s\n    read-only\n\n"  "/boot/$IMAGE_NAME.old" "$BOOT_LABEL.old" >> /etc/lilo.conf.new
-      fi
-    fi
-
-    cp /etc/lilo.conf.new /etc/lilo.conf
-    export IFS=$IFS_OLD
-  fi
-
-  case $CONFIG_LILO in
-    y|Y|j|J) edit_file /etc/lilo.conf  ;;
-  esac
-
-  /sbin/lilo
-  sleep 4
-
+update_bootloader() {
+	plugin_call KERNEL_UPDATEBOOTLOADER $1 $2
 }
 
-# function update_grub
-# Description: creates /etc/lilo.conf stanzas
-# usage: update_grub bootimagename menuname
-#
-
-update_grub()  {
-  debug_msg "update_grub ($@)"
-
-  IMAGE_NAME=$1
-  BOOT_LABEL=$2
-
-  . $DEPENDS_CONFIG/grub
-
-  GRUB_IMAGE_ENTRY="
-title   $BOOT_LABEL
-kernel  $GRUB_BOOT/$IMAGE_NAME
-root    $GRUB_ROOT
-"
-
-  GRUB_OLD_IMAGE_ENTRY="
-title   $BOOT_LABEL.old
-kernel  $GRUB_BOOT/$IMAGE_NAME.old
-root    $GRUB_ROOT
-"
-
-  if ! ( grep -q "$IMAGE_NAME" /boot/grub/menu.lst && grep -q "$IMAGE_NAME.old" /boot/grub/menu.lst ) ; then
-    IFS_OLD=$IFS
-    export IFS="
-"
-
-    rm -rf /boot/grub/menu.lst.new
-    cp /boot/grub/menu.lst /boot/grub/menu.lst.old
-
-    (( IMAGE_COUNT=0 ))
-    for LINE in $(cat /boot/grub/menu.lst) ; do
-      if echo $LINE | grep -q "title" ; then
-        # To create a separating line between entries
-        echo "" >> /boot/grub/menu.lst.new
-
-        if (( IMAGE_COUNT == 0 )) ; then
-          if ! grep -q "$IMAGE_NAME" /boot/grub/menu.lst ; then
-            echo -e "$GRUB_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
-          fi
-          if [ -f /boot/"$IMAGE_NAME.old" ] && ! grep -q "$IMAGE_NAME.old" /boot/grub/menu.lst ; then
-            echo -e "$GRUB_OLD_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
-          fi
-        fi
-        (( IMAGE_COUNT++ ))
-      fi
-      if (( IMAGE_COUNT == 14 )) ; then
-        break
-      fi
-    echo $LINE >> /boot/grub/menu.lst.new
-    done
-
-    if (( IMAGE_COUNT == 0 )) ; then
-      if ! grep -q "$IMAGE_NAME" /boot/grub/menu.lst ; then
-        echo -e "$GRUB_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
-      fi
-      if [ -f /boot/"$IMAGE_NAME.old" ] && ! grep -q "$IMAGE_NAME.old" /boot/grub/menu.lst ; then
-        echo -e "$GRUB_OLD_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
-      fi
-    fi
-
-    cp /boot/grub/menu.lst.new /boot/grub/menu.lst
-    export IFS=$IFS_OLD
-  fi
-
-  case $CONFIG_GRUB in
-    y|Y) edit_file /boot/grub/menu.lst ;;
-  esac
-
-cat << EOF
-* * * * * * * * * * * * * * * * * * * * * * * *
-*                                             *
-*              W A R N I N G                  *                            
-*                                             *
-*  Do not forget to install grub to your MBR  *
-*  if you haven't done so before rebooting    *
-*                                             *
-* * * * * * * * * * * * * * * * * * * * * * * *
-EOF
 
+# dummy caller:
+update_lilo() {
+	update_bootloader $1 $2
 }
 
-# function update_aboot
-# Description: creates /boot/aboot.conf lines
-# usage: update_aboot bootimagename menuname
-#
-
-# This function is a work in progress. Please treat it as such.
-# -Aaron Watry 1/6/2004
+# dummy stub:
+update_grub() {
+	:
+}
 
-update_aboot()  {
 
-  echo "Updating aboot"
 
-}

Index: plugins.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/plugins.lunar,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- plugins.lunar	25 Mar 2005 17:56:14 -0000	1.4
+++ plugins.lunar	27 Mar 2005 22:02:29 -0000	1.5
@@ -28,6 +28,7 @@
     # 3 - SOURCE_VERIFY - perform intergity verification on a file
 	# 4 - SOURCE_UNPACK - unpack a certain file to $(PWD)
 	# 5 - MODULE_CHECK - perform integrity checking on installed modules
+	# 6 - KERNEL_UPDATEBOOTLOADER - automate bootloader maintenance
 	LUNAR_PLUGINS=(${LUNAR_PLUGINS[@]} "$1:$2")
 	((LUNAR_PLUGIN_COUNT++))
 }



More information about the Lunar-commits mailing list