|
|
e53285e |
#!/bin/bash -
|
|
|
e53285e |
#
|
|
|
e53285e |
# 95-akmodposttrans.install - Calls akmods for newly installed kernels
|
|
|
e53285e |
#
|
|
|
e53285e |
# Copyright (c) 2019 Nicolas ViƩville <nicolas.vieville@uphf.fr>
|
|
|
e53285e |
#
|
|
|
e53285e |
# Permission is hereby granted, free of charge, to any person obtaining
|
|
|
e53285e |
# a copy of this software and associated documentation files (the
|
|
|
e53285e |
# "Software"), to deal in the Software without restriction, including
|
|
|
e53285e |
# without limitation the rights to use, copy, modify, merge, publish,
|
|
|
e53285e |
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
e53285e |
# permit persons to whom the Software is furnished to do so, subject to
|
|
|
e53285e |
# the following conditions:
|
|
|
e53285e |
#
|
|
|
e53285e |
# The above copyright notice and this permission notice shall be
|
|
|
e53285e |
# included in all copies or substantial portions of the Software.
|
|
|
e53285e |
#
|
|
|
e53285e |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
e53285e |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
e53285e |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
e53285e |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
e53285e |
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
e53285e |
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
e53285e |
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
e53285e |
#
|
|
|
e53285e |
|
|
|
e53285e |
COMMAND="$1"
|
|
|
e53285e |
KERNEL_VERSION="$2"
|
|
|
e53285e |
BOOT_DIR_ABS="$3"
|
|
|
e53285e |
KERNEL_IMAGE="$4"
|
|
|
e53285e |
|
|
|
e53285e |
# just check in case a user calls this directly
|
|
|
e53285e |
if [[ ! -w /var ]] ; then
|
|
|
e53285e |
echo "Needs to run as root to be able to install rpms." >&2
|
|
|
e53285e |
exit 4
|
|
|
e53285e |
fi
|
|
|
e53285e |
|
|
|
e53285e |
if [[ ! -n "${KERNEL_VERSION}" ]] ; then
|
|
|
e53285e |
exit 1
|
|
|
e53285e |
fi
|
|
|
e53285e |
|
|
|
e53285e |
case "${COMMAND}" in
|
|
|
e53285e |
add)
|
|
|
e53285e |
# needs to run in background as rpmdb might be locked otherwise
|
|
|
e53285e |
if [ -e /bin/systemctl ] ; then
|
|
|
e53285e |
# Exit early if system-update.target is active - rhbz#1518401
|
|
|
e53285e |
/bin/systemctl is-active system-update.target &>/dev/null
|
|
|
e53285e |
RET=$?
|
|
|
e53285e |
|
|
|
e53285e |
[ $RET == 0 ] && exit 0
|
|
|
e53285e |
|
|
|
e53285e |
/bin/systemctl restart akmods@${KERNEL_VERSION}.service --no-block >/dev/null 2>&1
|
|
|
e53285e |
else
|
|
|
e53285e |
nohup /usr/sbin/akmods --from-kernel-posttrans --kernels ${KERNEL_VERSION} > /dev/null 2>&1 &
|
|
|
e53285e |
fi
|
|
|
e53285e |
exit 0
|
|
|
e53285e |
;;
|
|
|
e53285e |
remove)
|
|
|
e53285e |
# Nothing to do
|
|
|
e53285e |
;;
|
|
|
e53285e |
*)
|
|
|
e53285e |
;;
|
|
|
e53285e |
esac
|
|
|
e53285e |
|
|
|
e53285e |
exit 0
|