Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
kgraft
kgraft-rpm-helper
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kgraft-rpm-helper of Package kgraft
#!/bin/bash USAGE="$0 <check|install|remove> <package-version-release>" if test "$1" = "-h" -o "$1" = "--help"; then echo "$USAGE" exit 0 fi if test "$#" -ne 2; then echo "$USAGE" >&2 exit 1 fi cmd=$1 package=$2 shopt -s nullglob do_check() { local dir pid pids=() status local proc_mounted=false kgr_supported=false read_ok=true if test -e /.buildenv; then echo "Skipping kGraft patches in buildroot" return 0 fi for dir in /proc/*; do proc_mounted=true pid=${dir##*/} case "$pid" in *[^0-9]*) continue esac if test ! -f "$dir/kgr_in_progress"; then continue fi kgr_supported=true status=$(< "$dir/kgr_in_progress") if test $? -ne 0; then read_ok=false continue fi if test "$status" -ne 0; then pids[${#pids[@]}]=$pid fi done if ! $proc_mounted; then echo "Warning: /proc is not mounted" >&2 return 0 fi if ! $kgr_supported; then echo "Warning: the running kernel does not have kGraft support" >&2 return 0 fi if ! $read_ok; then echo "Warning: could not read some files in /proc" fi if test ${#pids[@]} -ne 0; then echo "Error: following processes have not finished a previous kGraft patch yet:" >&2 echo "${pids[@]}" >&2 return 1 fi } package_krel() { local package=$1 nv krel flavor nv=${package%-*} flavor=${nv%-*} flavor=${flavor##*-} krel=${nv##*-} krel=${krel/_/-}-$flavor echo "$krel" } refresh_initrd() { local krel=$1 image /sbin/depmod -F "/boot/System.map-$krel" -e "$krel" || return # copied from weak-modules2 for image in vmlinuz image vmlinux linux bzImage uImage Image; do if test -f "/boot/$image-$krel"; then mkdir -p /var/run/regenerate-initrd touch "/var/run/regenerate-initrd/$image-$krel" break fi done } do_install() { local krel mod modules err if test -e /.buildenv; then return 0 fi krel=$(package_krel "$package") refresh_initrd "$krel" if test "$(uname -r)" != "$krel"; then return 0 fi err=0 modules=($(rpm -ql "$package" | sed -rn 's:.*/(kgraft-patch[^/]*)\.ko$:\1:p')) for mod in "${modules[@]}"; do echo "[kGraft] Loading $mod" modprobe "$mod" || err=$? done return $err } do_remove() { local krel if test -e /.buildenv; then return 0 fi krel=$(package_krel "$package") refresh_initrd "$krel" } case "$cmd" in check|install|remove) do_$cmd "$package" exit ;; *) echo "$USAGE" >&2 exit 1 esac
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor