summaryrefslogtreecommitdiffstats
path: root/src/appliance.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a 'fixed' style of appliance.Richard W.M. Jones2012-03-031-3/+33
| | | | | | | | | | This is just the 'kernel', 'initrd' and 'root' files, copied from one machine to another, along with a 'README.fixed' file which is also used for identification. This allows the appliance to be copied from one machine to another, making it easier for us to distribute a starter appliance for people who cannot get febootstrap or appliance-building working.
* Rebrand 'ordinary appliance' as 'old-style appliance'.Richard W.M. Jones2012-03-031-7/+7
| | | | This is just code motion.
* Tempus fugit.Richard W.M. Jones2012-01-181-1/+1
| | | | Update all copyright dates to 2012.
* lib: Try harder to remove temporary directory along error paths (RHBZ#769680).Richard W.M. Jones2011-12-231-1/+11
|
* lib: Add guestfs___remove_tmpdir helper function.Richard W.M. Jones2011-12-231-1/+1
| | | | | | | This function does 'rm -rf <dir>' for temporary directories, safely working if '<dir>' contains shell meta-characters. Replace existing code for removing directories with this.
* Coverity: fix memory leak along error path.Richard W.M. Jones2011-08-231-0/+12
|
* pclose: Fix other places where we only tested pclose == -1.Richard W.M. Jones2011-08-231-1/+1
| | | | pclose can return > 0 when the status of the command was non-zero.
* Remove guestfs___print_timestamped_argv.Richard W.M. Jones2011-08-181-3/+52
| | | | | | | | | | | | | | | | | | | | | | | This function was used to print the qemu and febootstrap-supermin-helper command lines. Unfortunately in the qemu case it was used incorrectly: it called the internal debug function (ie. event API callback) from the forked qemu subprocess, which meant that higher level event callbacks might have been invoked from the child process. To fix this, convert the qemu case into a new function called print_qemu_command line which just prints the command line directly to stderr. This is called after stderr has been redirected into the pipe to the main process. Thus the qemu command line will be marshalled into the event API along with other qemu and appliance output. After fixing this, only one use of guestfs___print_timestamped_argv remained, for printing the febootstrap-supermin-helper command line. This is converted to a local function print_febootstrap_command_line. Also print_febootstrap_command_line is now called before we fork febootstrap-supermin-helper, so that messages no longer overlap.
* New event API (RHBZ#664558).Richard W.M. Jones2011-03-151-3/+3
| | | | | | | | | | | | | This API allows more than one callback to be registered for each event, makes it possible to call the API from other languages, and allows [nearly all] log, debug and trace messages to be rerouted from stderr. An older version of this API was discussed on the mailing list here: https://www.redhat.com/archives/libguestfs/2010-December/msg00081.html https://www.redhat.com/archives/libguestfs/2011-January/msg00012.html This also updates guestfish to use the new API for its progress bars.
* RHEL5: Make use of 'futimens' function optional.Richard W.M. Jones2011-03-111-0/+4
|
* Use /var/tmp for the cached appliance (for FHS compliance).Richard W.M. Jones2011-01-191-2/+2
| | | | | | | | | | | | | | | | The FHS advises large files not to be stored in the root filesystem[1], and that /var/tmp is persistent across reboots[2] (whereas /tmp is possibly not[3]). Therefore we should store the large cached supermin appliance in /var/tmp instead of /tmp. /tmp is still used for all other temporary files and directories. In either case you can override this by setting $TMPDIR. [1] http://www.pathname.com/fhs/pub/fhs-2.3.html#THEROOTFILESYSTEM [2] http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE [3] http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
* appliance: Don't set utime on cachedir until we know it is safe.Richard W.M. Jones2010-12-111-1/+2
| | | | | This could be used to touch an arbitrary file (albeit one which must already exist), and this could have been a security problem.
* appliance: Touch cached appliance files so they don't get tmp cleaned.Richard W.M. Jones2010-12-111-0/+5
|
* Remove extra \n character from end of error messages.Richard W.M. Jones2010-12-111-3/+3
|
* appliance: Be careful about cleaning up old appliances.Richard W.M. Jones2010-12-111-165/+296
| | | | | | | | | | | This change resolves several issues with current appliance building: (1) Old appliances are cleaned up. (2) Race conditions between appliance building is handled better. (3) Several bugs fixed.
* appliance: Change to using febootstrap 3.x supermin appliance.Richard W.M. Jones2010-12-051-6/+1
| | | | | | | | | This removes all support for building the ordinary / old style appliance using febootstrap 2.x, debootstrap, debirf, fakeroot and fakechroot. Instead this uses febootstrap 3.x to build the supermin appliance in a simpler cross-distro manner.
* appliance: Don't look for kmod.whitelist.Richard W.M. Jones2010-12-041-1/+1
| | | | This file is not used for building the supermin appliance.
* supermin: If disabled, don't compile in supermin code or check for supermin.Richard W.M. Jones2010-11-081-5/+11
| | | | | | | | | | | | If supermin is disabled at compile time and the user just wants to use the ordinary appliance, there is no need to compile in all the supermin code, and in particular there is no need to check for the supermin appliance (which involves running febootstrap-supermin-helper that probably doesn't exist). This fixes a warning message observed under Debian w/o supermin: sh: febootstrap-supermin-helper: command not found
* Ensure atomic creation of a cached applianceMatthew Booth2010-10-281-13/+92
| | | | | | | | | | | | | | | | | | | | Cached appliances are discovered by their predictable path. Previously we were creating a cached appliance directly in this predictable path. This had at least 2 undesirable effects: * Interrupting appliance creation would leave a corrupt appliance * 2 processes could simultaneously attempt to create the same appliance, causing corruption. This patch causes the cached appliance to be created in a temporary directory, and then renamed to the predictable path. As rename is an atomic operation, this makes the whole creation atomic. This patch also changes the predictable path to have a prefix of 'guestfs.'. This will make it simpler for system administrators to clean up old cached appliances. This patch resolves RHBZ#639405
* Call febootstrap-supermin-helper using the new -u and -g optionsMatthew Booth2010-10-281-37/+34
| | | | | | | | | | | | | | Use febootstrap-supermin-helper's new -u and -g command line options to setuid, rather than doing it in libguestfs. This resolves an issue with the generation of the cached appliance checksum. The checksum was being generated by a call to febootstrap-supermin-helper through popen(). Unfortunately, a bash misfeature meant that euid would be reset to uid, and the checksum was generated for uid, not euid. When virt-v2v is writing to a RHEV target, uid == 0 and euid == 36, which resulted in a cached appliance being created for root with permissions for uid 36. Note this requires febootstrap 2.10.
* Log the febootstrap-supermin-helper command lineMatthew Booth2010-10-281-26/+29
| | | | | | A side-effect of change 17e7cb9937a63ed8f9bb0fb6ac7302758be76846 was the the febootstrap-supermin-helper was no longer logged. This change adds it back using the new guestfs___print_timestamped_argv internal function.
* appliance: Remove repo from appliance filename (RHBZ#638901).Richard W.M. Jones2010-10-271-2/+2
| | | | | | | There's no need to have the appliance filename contain the repository name it was built from, and this change gives downstream users more freedom to mix and match libraries and appliances if they want to.
* Don't use kernel module whitelist with ext2-based appliance.Richard W.M. Jones2010-10-271-6/+0
| | | | | | | | | Since the ext2-based appliance is cached, and since it is not all loaded into memory (as with the initrd), we might as well put all the kernel modules in there. Note the kmod.whitelist.in file is still used for building the ordinary appliance.
* Allow $TMPDIR to override most temporary directory uses.Richard W.M. Jones2010-09-241-2/+2
| | | | | | | Be more consistent in allowing the user to override use of the temporary directory by specifying $TMPDIR. Also prefer P_tmpdir macro (defined in <stdio.h>) if that is defined, rather than hard-coding "/tmp" for the fallback location.
* Fix error launching libguestfs when euid != uid.Richard W.M. Jones2010-09-201-25/+108
| | | | | | | | | | | | | | | | | When writing to a RHEV target, virt-v2v launches the libguestfs appliance with euid:egid = 36:36, which is required to write to an NFS target using root_squash. Since we changed to using a cached appliance, this causes an error on start up, as the cached files are owned by root, but the cache directory is owned by 36:36. The reason is that bash resets euid to uid and egid to gid so when febootstrap-supermin-helper is executed, it runs as root:root. The cache directory was created by libguestfs directly so it has the correct ownership. This patch fixes the issue by using explicit fork/exec instead of system (ie. not going via a shell) and by setting the real UID and GID to the effective UID and GID before execing.
* Change to using ext2-based, cached supermin appliance.Richard Jones2010-08-231-0/+465
This changes the method used to build the supermin appliance to use the new ext2-based appliance supported by latest febootstrap. The appliance can also be cached, so we avoid rebuilding it each time it is used. Mailing list discussion goes into the rationale and details: https://www.redhat.com/archives/libguestfs/2010-August/msg00028.html Requires febootstrap >= 2.8.