fe586b1cbe
Fixes bug 1037516 This patch creates a directory os-guest-kernels inside the local SR, and sets up /boot/guest to be a symlink to that directory. This way OpenStack won't pollute Dom0's filesystem. Change-Id: If8dfe24355bd782a401fed0f2c4b423efd9c11ba
86 lines
1.6 KiB
Bash
86 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
test ! -e "$LIST_OF_ACTIONS" && {
|
|
echo "Mocking is not set up properly."
|
|
echo "LIST_OF_ACTIONS should point to an existing file."
|
|
exit 1
|
|
}
|
|
|
|
test ! -e "$LIST_OF_DIRECTORIES" && {
|
|
echo "Mocking is not set up properly."
|
|
echo "LIST_OF_DIRECTORIES should point to an existing file."
|
|
exit 1
|
|
}
|
|
|
|
test ! -e "$XE_RESPONSE" && {
|
|
echo "Mocking is not set up properly."
|
|
echo "XE_RESPONSE should point to an existing file."
|
|
exit 1
|
|
}
|
|
|
|
test ! -e "$XE_CALLS" && {
|
|
echo "Mocking is not set up properly."
|
|
echo "XE_CALLS should point to an existing file."
|
|
exit 1
|
|
}
|
|
|
|
function mktemp {
|
|
if test "${1:-}" = "-d";
|
|
then
|
|
echo "tempdir"
|
|
else
|
|
echo "tempfile"
|
|
fi
|
|
}
|
|
|
|
function wget {
|
|
echo "wget $@" >> $LIST_OF_ACTIONS
|
|
}
|
|
|
|
function mkdir {
|
|
if test "${1:-}" = "-p";
|
|
then
|
|
echo "$2" >> $LIST_OF_DIRECTORIES
|
|
fi
|
|
}
|
|
|
|
function unzip {
|
|
echo "Random rubbish from unzip"
|
|
echo "unzip $@" >> $LIST_OF_ACTIONS
|
|
}
|
|
|
|
function rm {
|
|
echo "rm $@" >> $LIST_OF_ACTIONS
|
|
}
|
|
|
|
function ln {
|
|
echo "ln $@" >> $LIST_OF_ACTIONS
|
|
}
|
|
|
|
function [ {
|
|
if test "${1:-}" = "-d";
|
|
then
|
|
echo "[ $@" >> $LIST_OF_ACTIONS
|
|
for directory in $(cat $LIST_OF_DIRECTORIES)
|
|
do
|
|
if test "$directory" = "$2"
|
|
then
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
fi
|
|
echo "Mock test does not implement the requested function"
|
|
exit 1
|
|
}
|
|
|
|
function xe {
|
|
cat $XE_RESPONSE
|
|
{
|
|
for i in $(seq "$#")
|
|
do
|
|
eval "echo \"\$$i\""
|
|
done
|
|
} >> $XE_CALLS
|
|
}
|