256 Logo

Diskheap
Dmalloc
Other Packages

Install Utility Sources

Download Version 4.0.0

The install program is a replacement for the standard install program or shell script that should be provided by your Unix system. The normal install allows you to move or copy files from a source directory (i.e. a build repository) into place while at the same time setting permissions, ownership, and group-id.

My install program does all this but it also provides a number of very powerful features including the following abilities:

  1. comparing the files before installing (which is great if you don't want the modification times of include files to change even when there are no differences)
  2. installation via hard and soft links
  3. making all of the directories to the destination path
  4. handling sparse files correctly

My apologies for the minimal documentation.

Arguments

To list all of the available options, use 'install --usage'. There are two basic forms of the install command:

  1. install -d [options] directory

    This creates a destination directory directory with modes and ownership that you specify in the options. [options] can be some or all of the following.

    -D (--mkdir-all)
    This will create all of the directories necessary. If you execute 'install -d x/y/z' and only the x/ directory currently exists, the x/y directory will be created before the x/y/z directory is.
    -g group (-group-id)
    This specifies the group-id to set to the directory using chgrp syscall. The default is the bin group.
    -m octal-mode (--file-mode)
    This is the mode to set the directory to using the chmod syscall. It should be specified as an octal number.
    -o owner (--owner-id)
    This specifies the owner to set to the directory using the chown syscall. The default is the bin uid. You can specify the owner AND the group here as owner.group (i.e. root.wheel).
  2. install [options] file1 [file2 ...] directory

    This installs one or a number of files into a destination directory. The options that control these functions are detailed below.

    -c (--copy-files)
    The default action when files are being installed into a directory is to move them (or copy them and unlink them afterwards). This will not remove the source copy of the file after it is installed.
    -l (--link-files)
    Instead of moving the files, this will create a hard link in the destination directory to the source files.
    -p (--symlink-relative)
    Instead of moving the files, this will create a relative symbolic link in the destination directory to the source files. If you execute 'install -p x /a/b/c' (where /a/b/c is the destination directory) and the x file is in the /a directory, it will create a symlink from /a/b/c/x -> ../../x
    -P (--symlink-absolute)
    Instead of moving the files, this will create an absolute symbolic link in the destination directory to the source files. If you execute 'install -p x /a/b/c' (where /a/b/c is the destination directory) and the x file is in the /a directory, it will create a symlink from /a/b/c/x -> /a/x
    -b (--backup)
    If the destination file already exists, instead of unlinking it before we install a new copy, it will add a .bak extension to the filename and move the existing file to this backup name.
    -C (--compare)
    This will compare the source file with the destination after it has been installed to make sure that the install worked.
    -D (--mkdir-all)
    This will create all of the directories necessary. If you execute 'install -d x/y/z' and only the x/ directory currently exists, the x/y directory will be created before the x/y/z directory is.
    -e (--examine)
    This will compare the source file with the destination (if it exists) and will not install the file if they are the same.
    -E (--error-code)
    Generate an error code (with an exit(1)) if no files were installed.
    -g group (--group-id)
    This specifies the group-id to set to the directory using chgrp syscall. The default is the bin group.
    -G (--gentle)
    Do not unlink the destination file if they already exist.
    -i (--interactive)
    If the destination files exist, prompt the user for a y or Y before removing them.
    -m octal-mode (--file-mode)
    This is the mode to set the directory to using the chmod syscall. It should be specified as an octal number.
    -M octal-mode (--dir-mode)
    The modes of the directories that are created with the -D --mkdir-all option.
    -n (--no-execute)
    This will cause the install program to make no changes to the files. This allows you to use the -v or -V verbose options to see what it would do before doing it.
    -o owner (--owner-id)
    This specifies the owner to set to the directory using the chown syscall. The default is the bin uid. You can specify the owner AND the group here as owner.group (i.e. root.wheel).
    -r (--ranlib)
    If you are installing a library (or libraries), you can specify this option to run the ranlib utility on the libraries after they have been installed.
    -R (--remove-ext)
    The allows you to have a number of source scripts such as 'foo.sh' and 'bar.pl' however have them installed as 'foo' and 'bar' in the destination directory.
    -q (--quiet)
    This option restricts most output.
    -s (--strip)
    If you are installing a binary (or binaries), you can specify this option to run the strip utility on the binaries after they have been installed.
    -S (--sparse)
    This will copy sparse files correctly. It does this my automatically lseek-ing across all blocks that contain all zeros.
    -u octal-mode (--umask-mode)
    This is the octal mode to set your umask to. By default, your umask filters any file or directory creation masks.
    -v (--verbose)
    Enables the printing of various information messages.
    -V (--very-verbose)
    Enables the printing of a number of detailed information messages.

Repository

The newest versions of program library are available via the web:

http://256.com/sources/install/

Copyright 2006 Gray Watson.
This page is W3C Valid XHTML.
http://256.com/sources/install/