[Lxc-users] Subject: [PATCH 1/2] fix for missing EOF and fstab contents
templates/lxc-fedora.in | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index 81f8bc4..c166efb 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -224,10 +224,10 @@ lxc.cgroup.devices.allow = c 254:0 rwm EOF cat EOF $config_path/fstab -+proc$rootfs_path/proc procnodev,noexec,nosuid 0 0 -+devpts $rootfs_path/dev/pts devpts defaults 0 0 -+sysfs $rootfs_path/sys sysfs defaults 0 0 - +proc$rootfs_path/proc procnodev,noexec,nosuid 0 0 +devpts $rootfs_path/dev/pts devpts defaults 0 0 +sysfs $rootfs_path/sys sysfs defaults 0 0 +EOF if [ $? -ne 0 ]; then echo Failed to add configuration return 1 @@ -268,7 +268,7 @@ usage: Mandatory args: -n,--name container name, used to as an identifier for that container from now on Optional args: - -p,--path path to where the container rootfs will be created, defaults to /var/lib/lxc. The container config will go under /var/lib/lxc in and case + -p,--path path to where the container rootfs will be created, defaults to /var/lib/lxc. The container config will go under /var/lib/lxc in that case -c,--cleanclean the cache -R,--release Fedora release for the new container. if the host is Fedora, then it will defaultto the host's release. -A,--arch NOT USED YET. Define what arch the container will be [i686,x86_64] -- 1.7.6 -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
[Lxc-users] [PATCH 2/2] 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 --- templates/lxc-fedora.in | 28 +--- 1 files changed, 21 insertions(+), 7 deletions(-) diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index c166efb..48cb1c0 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -316,8 +316,7 @@ if [ -z $release ]; then if [ $is_fedora ]; then release=$(cat /etc/fedora-release |awk '/^Fedora/ {print $3}') else -echo This is not a fedora host and release missing, use -R|--release to specify release -exit 1 +echo This is not a fedora host and release missing, defaulting to 14. use -R|--release to specify release fi fi @@ -326,6 +325,7 @@ if [ $(id -u) != 0 ]; then exit 1 fi + rootfs_path=$path/$name/rootfs config_path=$default_path/$name cache=$cache_base/$release @@ -335,6 +335,25 @@ if [ -f $config_path/config ]; then exit 1 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 if [ $? -ne 0 ]; then echo failed to install fedora @@ -347,11 +366,6 @@ if [ $? -ne 0 ]; then exit 1 fi -copy_configuration -if [ $? -ne 0 ]; then -echo failed write configuration file -exit 1 -fi if [ ! -z $clean ]; then clean || exit 1 -- 1.7.6 -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users