Commit 29ec8f84 by Ramez Hanna Committed by Daniel Lezcano

lxc-fedora.in

* if not running on fedora host amd -R is not set, use fedora 14 as default * trap SIGHUP SIGINT SIGTERM, and cleanup before exiting Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent a30ce0ac
...@@ -316,8 +316,7 @@ if [ -z "$release" ]; then ...@@ -316,8 +316,7 @@ if [ -z "$release" ]; then
if [ "$is_fedora" ]; then if [ "$is_fedora" ]; then
release=$(cat /etc/fedora-release |awk '/^Fedora/ {print $3}') release=$(cat /etc/fedora-release |awk '/^Fedora/ {print $3}')
else else
echo "This is not a fedora host and release missing, use -R|--release to specify release" echo "This is not a fedora host and release missing, defaulting to 14. use -R|--release to specify release"
exit 1
fi fi
fi fi
...@@ -326,6 +325,7 @@ if [ "$(id -u)" != "0" ]; then ...@@ -326,6 +325,7 @@ if [ "$(id -u)" != "0" ]; then
exit 1 exit 1
fi fi
rootfs_path=$path/$name/rootfs rootfs_path=$path/$name/rootfs
config_path=$default_path/$name config_path=$default_path/$name
cache=$cache_base/$release cache=$cache_base/$release
...@@ -335,6 +335,25 @@ if [ -f $config_path/config ]; then ...@@ -335,6 +335,25 @@ if [ -f $config_path/config ]; then
exit 1 exit 1
fi fi
revert()
{
echo "Interrupted, so cleaning up"
lxc-destroy -n $name
# maybe was interrupted before copy config
rm -rf $path/$name
rm -rf $default_path/$name
echo "exiting..."
exit 1
}
trap revert SIGHUP SIGINT SIGTERM
copy_configuration
if [ $? -ne 0 ]; then
echo "failed write configuration file"
exit 1
fi
install_fedora install_fedora
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "failed to install fedora" echo "failed to install fedora"
...@@ -347,11 +366,6 @@ if [ $? -ne 0 ]; then ...@@ -347,11 +366,6 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
copy_configuration
if [ $? -ne 0 ]; then
echo "failed write configuration file"
exit 1
fi
if [ ! -z $clean ]; then if [ ! -z $clean ]; then
clean || exit 1 clean || exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment