saveconfig.c revision bb9702b539188bcc0c37f351633b087d1c22d2a6
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * Copyright © 2012 Serge Hallyn <serge.hallyn@ubuntu.com>.
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * Copyright © 2012 Canonical Ltd.
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * This program is free software; you can redistribute it and/or modify
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * it under the terms of the GNU General Public License version 2, as
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * published by the Free Software Foundation.
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * This program is distributed in the hope that it will be useful,
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * but WITHOUT ANY WARRANTY; without even the implied warranty of
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * GNU General Public License for more details.
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * You should have received a copy of the GNU General Public License along
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * with this program; if not, write to the Free Software Foundation, Inc.,
45d862b9c655542aa44c02958011065f6994f512Trond Norbye * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
45d862b9c655542aa44c02958011065f6994f512Trond Norbyestatic int create_ubuntu(void)
45d862b9c655542aa44c02958011065f6994f512Trond Norbye ret = execlp("lxc-create", "lxc-create", "-t", "ubuntu", "-f", "/etc/lxc/default.conf", "-n", MYNAME, NULL);
45d862b9c655542aa44c02958011065f6994f512Trond Norbye // Should not return
45d862b9c655542aa44c02958011065f6994f512Trond Norbye if (!WIFEXITED(status)) { // did not exit normally
45d862b9c655542aa44c02958011065f6994f512Trond Norbye fprintf(stderr, "%d: lxc-create exited abnormally\n", __LINE__);
45d862b9c655542aa44c02958011065f6994f512Trond Norbye fprintf(stderr, "%d: error opening lxc_container %s\n", __LINE__, MYNAME);
45d862b9c655542aa44c02958011065f6994f512Trond Norbye fprintf(stderr, "%d: %s thought it was defined\n", __LINE__, MYNAME);
45d862b9c655542aa44c02958011065f6994f512Trond Norbye fprintf(stderr, "%d: failed to create a ubuntu container\n", __LINE__);
45d862b9c655542aa44c02958011065f6994f512Trond Norbye fprintf(stderr, "%d: %s thought it was not defined\n", __LINE__, MYNAME);
goto out;
goto out;
ret = 0;
out: