Skip to content
linux-seblu.install 2.19 KiB
Newer Older
Seblu's avatar
Seblu committed
# vim:set ts=2 sw=2 ft=sh et:

# arg 1:  the new package version
post_install () {
  if type -P kernel-install >/dev/null; then
    version=${1%-*}
    version=${version/_/-}-seblu
    echo "==> Calling kernel-install add $version ..."
    kernel-install add "$version" "/usr/lib/kernel/vmlinuz-$version" || echo "kernel-install not exits zero!"
  fi
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
  pre_remove "$2"
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
  post_install "$1"
  # advertise if you update the current running kernel
  version=${1%-*}
  version=${version/_/-}-seblu
  if [[ "$version" == "$(uname -r)" ]]; then
    echo '********************************************************************************'
    echo '********************************************************************************'
    echo '****** YOU HAVE UPDATED THE CURRENTLY RUNNING KERNEL ** REBOOT IMMEDIATLY ******'
    echo '********************************************************************************'
    echo '********************************************************************************'
  fi
}

# arg 1:  the old package version
pre_remove() {
  if type -P kernel-install >/dev/null; then
    version=${1%-*}
    version=${version/_/-}-seblu
    echo "==> kernel-install remove $version"
    kernel-install remove "$version" || echo "kernel-install not exits zero!"
  fi
}

# arg 1:  the old package version
post_remove() {
  version=${1%-*}
  version=${version/_/-}-seblu
  echo "==> Cleaning remaining kernel $version modules"
  [[ -n $version ]] && rm -rvf /usr/lib/modules/"$version"
  # advertise if you remove the current running kernel
  if [[ "$version" == "$(uname -r)" ]]; then
    echo '********************************************************************************'
    echo '********************************************************************************'
    echo '****** YOU HAVE REMOVED THE CURRENTLY RUNNING KERNEL ** REBOOT IMMEDIATLY ******'
    echo '********************************************************************************'
    echo '********************************************************************************'
  fi
}