return 0
fi
- if [ "$ver" = "${ver#2.6.2[4-9]}" ]; then
+ if [ "$ver" = "${ver#2.6.2[4-9]}" ] || reboot_required; then
# kernel too old
notice "
Prije prelaska na Debian Etch potrebno je napraviti nadogradnju na najnoviji grsec kernel.
fi
}
+# check if the latest kernel is booted
+reboot_required () {
+ local default_kernel kernel_package running_release running_version
+
+ default_kernel=$( lilo -t -v 2>/dev/null \
+ | grep -B3 '[*]$' \
+ | sed -n -e '/^Boot image: / { s///p; q; }' )
+
+ if [ -z "$default_kernel" ]; then
+ log "Could not find default kernel"
+ return 1
+ fi
+
+ log "Default kernel image: $default_kernel"
+
+ if [ ! -e "$default_kernel" ]; then
+ log "Default kernel image doesn't exist!?"
+ return 1
+ fi
+
+ kernel_package=$( dpkg -S $default_kernel | cut -d: -f 1 )
+
+ if [ -z "$kernel_package" ]; then
+ log "Default kernel not installed from a package"
+ return 1
+ fi
+
+ log "Default kernel package: $kernel_package"
+
+ if [ "$kernel_package" != "kernel-2.6-cn" ]; then
+ log "Default kernel package is not kernel-2.6-cn"
+ return 1
+ fi
+
+ running_release=$( uname -r )
+ running_version=$( uname -v )
+ log "Running kernel: $running_release $running_version"
+
+ if grep -q "$running_release .* $running_version" $default_kernel; then
+ log "Latest kernel version is running."
+ return 1
+ else
+ log "Reboot to latest version required."
+ return 0
+ fi
+}
+
upgrade () {
local i to_install packages
case "$1" in