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