]> rtime.felk.cvut.cz Git - jailhouse.git/blobdiff - tools/jailhouse-config-collect.tmpl
jailhouse: inmates: bench: Add -R option -- repeats count.
[jailhouse.git] / tools / jailhouse-config-collect.tmpl
index 9e98f9f7854ab7e77d7449974f7dcd79dde71df2..64a8d9564d306a54b01d5cac07477b0c462d3357 100644 (file)
 
 set -e
 
+if test "x$( id -u )" != "x0"; then
+       echo "Please run as root" 1>&2
+       exit 1
+fi
+
 if test -z "$1"; then
        echo "Usage: $0 mytarget.tar" 1>&2
        exit 1
 fi
 
 filelist="${filelist}"
+filelist_opt="${filelist_opt}"
+filelist_intel="${filelist_intel}"
+filelist_amd="${filelist_amd}"
 
 tmpdir=/tmp/jailhouse-config-collect.$$
 
 rm -rf $tmpdir
 mkdir $tmpdir
 
+copy_file()
+{
+       dstdir=$tmpdir/$(dirname $1)
+       if [ ! -d $dstdir ]; then
+               mkdir -p $dstdir
+       fi
+       cp -p $1 $tmpdir/$1
+}
+
 # copy all the files we need to a temporary directory first
 for f in $filelist; do
+       copy_file $f
+done
+grep GenuineIntel /proc/cpuinfo > /dev/null &&
+       for f in $filelist_intel; do
+               copy_file $f
+       done
+grep AuthenticAMD /proc/cpuinfo > /dev/null &&
+       for f in $filelist_amd; do
+               copy_file $f
+       done
+for f in $filelist_opt; do
        if [ -f $f ]; then
-               dstdir=$tmpdir/$(dirname $f)
-               if [ ! -d $dstdir ]; then
-                       mkdir -p $dstdir
-               fi
-               cp -p $f $tmpdir/$f
-       else
-               echo "Warning: $f does not exist" 1>&2
+               copy_file $f
        fi
 done