Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Apply changes to files that users may have already added to.

Featured Replies

As part of my USB plugin I need to add the following lines to /etc/libvirt/hooks/qemu

 

if ($argv[2] == 'prepare' || $argv[2] == 'stopped'){
    shell_exec("/usr/local/emhttp/plugins/unraid.usbip-gui/scripts/rc.unraid.usbip-gui vm_action {$argv[1]} {$argv[2]} {$argv[3]} {$argv[4]}  >/dev/null 2>&1 & disown") ;
}

 

I looked at using diff and patch which does want I need, but I have seen some posts where users have modified the file for there own needs and the diff patch removes their changes.

 

Any suggestions for the best approach?

 

Not sure if there is much need but maybe stock should include something similar to this script to allow user defined ones? This currently runs VM Specific ones. https://github.com/PassthroughPOST/VFIO-Tools

 

#!/bin/bash
#
# Author: Sebastiaan Meijer ([email protected])
#
# Copy this file to /etc/libvirt/hooks, make sure it's called "qemu".
# After this file is installed, restart libvirt.
# From now on, you can easily add per-guest qemu hooks.
# Add your hooks in /etc/libvirt/hooks/qemu.d/vm_name/hook_name/state_name.
# For a list of available hooks, please refer to https://www.libvirt.org/hooks.html
#

GUEST_NAME="$1"
HOOK_NAME="$2"
STATE_NAME="$3"
MISC="${@:4}"

BASEDIR="$(dirname $0)"

HOOKPATH="$BASEDIR/qemu.d/$GUEST_NAME/$HOOK_NAME/$STATE_NAME"

set -e # If a script exits with an error, we should as well.

# check if it's a non-empty executable file
if [ -f "$HOOKPATH" ] && [ -s "$HOOKPATH"] && [ -x "$HOOKPATH" ]; then
    eval \"$HOOKPATH\" "$@"
elif [ -d "$HOOKPATH" ]; then
    while read file; do
        # check for null string
        if [ ! -z "$file" ]; then
          eval \"$file\" "$@"
        fi
    done <<< "$(find -L "$HOOKPATH" -maxdepth 1 -type f -executable -print;)"
fi

 

  • Author

Anyone have any thoughts as to how to make changes to /etc/libvirtd/hooks/qemu safely and removals aswell.

@limetech would be really nice if this would be included, would make life alot easier when working with hooks

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.