cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

fsfreeze-hook (1274B)


      1#!/bin/sh
      2
      3# This script is executed when a guest agent receives fsfreeze-freeze and
      4# fsfreeze-thaw command, if it is specified in --fsfreeze-hook (-F)
      5# option of qemu-ga or placed in default path (/etc/qemu/fsfreeze-hook).
      6# When the agent receives fsfreeze-freeze request, this script is issued with
      7# "freeze" argument before the filesystem is frozen. And for fsfreeze-thaw
      8# request, it is issued with "thaw" argument after filesystem is thawed.
      9
     10LOGFILE=/var/log/qga-fsfreeze-hook.log
     11FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d
     12
     13# Check whether file $1 is a backup or rpm-generated file and should be ignored
     14is_ignored_file() {
     15    case "$1" in
     16        *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave | *.sample | *.dpkg-old | *.dpkg-new | *.dpkg-tmp | *.dpkg-dist | *.dpkg-bak | *.dpkg-backup | *.dpkg-remove)
     17            return 0 ;;
     18    esac
     19    return 1
     20}
     21
     22# Iterate executables in directory "fsfreeze-hook.d" with the specified args
     23[ ! -d "$FSFREEZE_D" ] && exit 0
     24for file in "$FSFREEZE_D"/* ; do
     25    is_ignored_file "$file" && continue
     26    [ -x "$file" ] || continue
     27    printf "$(date): execute $file $@\n" >>$LOGFILE
     28    "$file" "$@" >>$LOGFILE 2>&1
     29    STATUS=$?
     30    printf "$(date): $file finished with status=$STATUS\n" >>$LOGFILE
     31done
     32
     33exit 0