The Autopackage API

Installation

Install/uninstall script functions.

Subcategories

Functions in this category

NameParameters
copyFiles [--silent] [--nobackup] [--nolog] <SOURCE> [<SOURCE> ...] <DIRECTORY>
copyFile [--silent] [--nobackup] [--nolog] <FILENAME-FROM> <FILENAME-TO>
createBootstrapScript <BINARY> <FILENAME> [ADDITIONAL-COMMANDS]
getIconDirs
getPackagePrefix <SHORTNAME>
installConfig <FILENAMES>
installData <DIRECTORY>
installDesktop [--no-path-adjust] <CATEGORY> <FILENAMES>
installMimeDesktop --no-adjust-path <DESKTOP-FILES...>
installExe <FILENAMES>
installGConfSchema <FILENAMES>
installIcon <SOURCES>
installInfo <FILENAMES>
installLib <LIBRARIES>
installLocale <DIRECTORY>
installMan <SECTION> <FILENAMES>
installMime <FILENAMES>
linkFile [--silent] [--nobackup] [--nolog] <TARGET> <LINK_NAME>
logCommand --session <MESSAGE>
logDir <DIRECTORY>
logFile <FILENAME>
removeGConfSchema <FILENAME>
setVariables <KEY> <VALUE> ...
updateEnv [--append] [--check] <VARIABLE> <PATH>

Details

copyFiles
Syntax: copyFiles [--silent] [--nobackup] [--nolog] <SOURCE> [<SOURCE> ...] <DIRECTORY>
--silent: do not generate UI output.
--nobackup: do not backup files or directory if they exist in DIRECTORY
DIRECTORY: destination directory to copy the source files to.
SOURCE: file or directory to copy.
--nolog: do not log the function call.
Returns: 0 if SOURCE exists and is copied to DIRECTORY; 1 if SOURCE does not exist or copy fails.
Copy one or more files to destination DIRECTORY. The filenames are logged and will be automatically removed at uninstallation. Wildcards can be used when function is called with file or directory arguments - exactly like a ls call.
This function can make a backup if the destination DIRECTORY contains the SOURCE file name. The original file will be moved to the BACKUP environment variable location.
If the --silent flag is passed, no UI output will be generated. This option is primarily meant for internal usage from the other APIs.
If the --nobackup flag is passed, function will not create backups. This option is primarily meant for internal usage from the other APIs.
If the --nolog flag is passed, no logging output will be generated. This option is primarily meant for internal usage from the other APIs.
Example:
copyFiles hello.txt world.txt "$PREFIX/doc"
  copy files to destination --> "$PREFIX/doc"

copyFiles libexec/bin/*.exe "$PREFIX/libexec"
  copy *.exe files in directory to destination   --> "$PREFIX/libexec"

copyFiles libexec/bin/* "$PREFIX/libexec"
  copy files in directory to destination         --> "$PREFIX/libexec"

copyFiles libexec/bin "$PREFIX/libexec"
  recursive copy of directory bin to destination --> "$PREFIX/libexec/bin"


copyFile
Syntax: copyFile [--silent] [--nobackup] [--nolog] <FILENAME-FROM> <FILENAME-TO>
--silent: do not generate UI output.
FILENAME-FROM: path to the file name
FILENAME-TO: path to the file name
--nobackup: do not backup files if files exist in FILENAME-TO directory.
--nolog: do not log the function call.
Returns: 0 if SOURCE exists and is copied; 1 if SOURCE does not exist or copy fails.
The copyFile function allows you to copy a single file to a given destination filename. It can be used when you want to rename a file while also copying it. This function creates a backup file if the destination already exists.
This function can make a backup if the destination directory contains the FILENAME-TO file name. The original file will be moved to the BACKUP environment variable location.
If the --silent flag is passed, no UI output will be generated. This option is primarily meant for internal usage from the other APIs.
If the --nobackup flag is passed, function will not create backups. This option is primarily meant for internal usage from the other APIs.
If the --nolog flag is passed, no logging output will be generated. This option is primarily meant for internal usage from the other APIs.
Example:
copyFile share/welcome-en.png "$PREFIX/share/welcome.png"


createBootstrapScript
Syntax: createBootstrapScript <BINARY> <FILENAME> [ADDITIONAL-COMMANDS]
FILENAME: the filename to which the bootstrap script is written.
BINARY: the filename of an application.
Returns: 0 on success, 1 on error.
Create a bootstrap script for BINARY. A bootstrap script is a script which sets up various environment variables (such as $PATH, $LD_LIBRARY_PATH, etc.), then run BINARY. That way it ensures BINARY can actually be run.
If ADDITIONAL-COMMANDS is given, it will be included in the bootstrap script. The commands in this option will be run just before BINARY is started.
FILENAME will be added to the uninstall log.


getIconDirs
Syntax: getIconDirs
Outputs: a list of path, seperated by newlines.
Get the paths in which icons are installed to.
See also: installIcon()


getPackagePrefix
Syntax: getPackagePrefix <SHORTNAME>
SHORTNAME: package or executable to find a prefix for.
Returns: 0 for all cases.
Returns the prefix of a previously installed package or executable. It returns the prefix from these scenarios:
a. package is in autopackage database
b. executable is located and give grandparent directory
c. package is assumed to be installing at the sametime then give $PREFIX
Function is useful when trying to install something relative to another package or executable like plugins.


installConfig
Syntax: installConfig <FILENAMES>
FILENAMES: configuration file(s) to install.
Install configuration files into appropriate directory.


installData
Syntax: installData <DIRECTORY>
DIRECTORY: data directory to install.
Returns: 1 for failure and 0 for pass.
Install application data into standard data directory location.
Example:
installData share/foobar
   --> $PREFIX/share/foobar


installDesktop
Syntax: installDesktop [--no-path-adjust] <CATEGORY> <FILENAMES>
CATEGORY: The category the desktop entries belong to.
--no-path-adjust: Do not change paths in the .desktop file to absolute paths.
FILENAMES: The desktop entries to install.
Install a menu entry (.desktop file). This function will automatically detect GNOME and KDE and will copy the desktop entires to the proper locations.

By default, this function will change the paths in the TryExec, Exec fields to absolute filenames by prepending "$PREFIX/bin". For instance, "Exec=gimp" will be changed to "Exec=/home/myuser/.local/bin/gimp".

If you do not want installDesktop to change the paths, pass the --no-path-adjust argument.
The CATEGORY parameter is used for non-vFolder/menu spec desktops such as KDE 3.1 and below, and possibly in future window managers like fluxbox/icewm as well. You should probably specify a string that would fit with the pre-KDE 3.2 menus here, such as "Graphics/Vector Graphics"
Example:
installDesktop "Network/Instant Messaging" gaim.desktop


installMimeDesktop
Syntax: installMimeDesktop --no-adjust-path <DESKTOP-FILES...>
DESKTOP-FILES: a list of .desktop files.
--no-path-adjust: Do not change paths in the .desktop file to absolute paths.
Sometimes you want to associate a program with a particular file type, but you don't want that program to appear in the menus. This function installs a MIME type association .desktop file such that it won't appear in the menus but will still be used for file assocations. Remember to use installMime to register your MIME type.
By default, this function will change the paths in the TryExec, Exec fields to absolute filenames by prepending "$PREFIX/bin". For instance, "Exec=gimp" will be changed to "Exec=/home/myuser/.local/bin/gimp".

If you do not want installMimeDesktop to change the paths, pass the --no-path-adjust argument.


installExe
Syntax: installExe <FILENAMES>
FILENAMES: The binaries or scripts to install.
Installs an executable file to $PREFIX/bin. $PATH will be automatically updated if $PREFIX/bin is not currently in it. The file will be given execution permissions. If there is already an executable with the same name in the PATH, then this function will build a bootstrap script so the program is guaranteed that when it does execute, PATH, LD_LIBRARY_PATH and MANPATH will be set correctly for that PREFIX. This function operates in terms of copyFiles(), so the notes for that function apply here also.


installGConfSchema
Syntax: installGConfSchema <FILENAMES>
FILENAMES: Location of GCONF schema files.
Installs given schema FILENAMES to the GConf database.
Example:
installGConfSchema "foobar.schemas"


installIcon
Syntax: installIcon <SOURCES>
SOURCES: Icon files or directories to install.
Returns: 0 on success, 1 on error.
Install an icon to appropriate places. This function can be used in combination with installDesktop().
See also: getIconDirs(), freedesktop.org Base Directory Specification and freedesktop.org Icon Theme Specification.
Example:
The application FooBar installs foobar.desktop, which contains this line for the icon:
  Icon=foobar
The application ships foobar.png and wants it to be used as a default icon for foobar.desktop, except if the current
icon theme provides it's own icon for foobar. The following two commands will take care of everything:

installIcon foobar.png
installDesktop foobar.desktop

Install a theme by defining a source directory:
installIcon ./share/theme/hicolor


installInfo
Syntax: installInfo <FILENAMES>
FILENAMES: The .info file(s) to install.
Install GNU TeXinfo files. The info dirfile will be updated as necessary.


installLib
Syntax: installLib <LIBRARIES>
LIBRARIES: The file names of the libraries to install.
Install shared libraries (.so files) to $PREFIX/lib. If the path to install to is not in the linker configuration, then it will be updated. If installing as root, /etc/ld.so.conf will be altered and ldconfig rerun. If installing as user, updateEnv will be called to ensure that the destination appears in LD_LIBRARY_PATH.


installLocale
Syntax: installLocale <DIRECTORY>
DIRECTORY: locale directory to install.
Returns: 1 for failure and 0 for pass.
Install locale directory into standard locale directory location.
Example:
installLocale share/locale
   --> $PREFIX/share/locale


installMan
Syntax: installMan <SECTION> <FILENAMES>
SECTION: The section these manpages belong to.
FILENAMES: The manpages to install.
Install Unix manual pages. The manpage search path will be automatically updated if necessary.


installMime
Syntax: installMime <FILENAMES>
FILENAMES: xml Mime file(s) to install.
Install mime-info xml files into appropriate directory and runs update-mime-database.
Implementation is for the XDG Shared MIME Database Specification http://freedesktop.org/wiki/Standards_2fshared_2dmime_2dinfo_2dspec
Example:
installMime share/mime/packages/foobar.xml


linkFile
Syntax: linkFile [--silent] [--nobackup] [--nolog] <TARGET> <LINK_NAME>
--silent: do not generate UI output.
LINK_NAME: name of the link to the TARGET.
TARGET: filename on which to link to.
--nobackup: do not backup files if files exist in DIRECTORY
--nolog: do not log the copyFiles function call.
Returns: 0 on success, 1 on error.
Create the symbolic link LINK_NAME which points to TARGET. This link will be recorded in the uninstall log.
This function is exactly like 'ls -s', except that it also adds a record to the uninstall log.
If the --silent flag is passed, no UI output will be generated. This option is primarily meant for internal usage from the other APIs.
If the --nobackup flag is passed, function will not create backups. This option is primarily meant for internal usage from the other APIs.
If the --nolog flag is passed, no logging output will be generated. This option is primarily meant for internal usage from the other APIs.


logCommand
Syntax: logCommand --session <MESSAGE>
MESSAGE: string that will be logged.
--session: log only to session file.
Add MESSAGE to the log. MESSAGE will be executed during uninstallation.


logDir
Syntax: logDir <DIRECTORY>
DIRECTORY: directory that will be logged.
Add DIRECTORY to the uninstall directory log. This directory will be automatically removed during uninstallation, if it's empty.


logFile
Syntax: logFile <FILENAME>
FILENAME: filename that will be logged.
Add FILENAME to the uninstall file log. This file will be automatically removed during uninstallation.


removeGConfSchema
Syntax: removeGConfSchema <FILENAME>
FILENAME: Absolute location of GCONF schema file.
Removes given schema FILENAME from the GConf database.
Example:
removeGConfSchema /home/user/.gconf/schemas/foobar.schema


setVariables
Syntax: setVariables <KEY> <VALUE> ...
Save package variables into the environment files which will make the variables available for prep, install, and uninstall functions.


updateEnv
Syntax: updateEnv [--append] [--check] <VARIABLE> <PATH>
--check: If the current value of the given variable contains PATH, do nothing
--append: Append the value to the variable instead of prepending it.
VARIABLE: The environment variable to set.
PATH: The path to add to it.
Prepends a path to an environment variable and add a command in the logfile to remove it if needed at uninstall. The modifications to the environment variables will be saved in various shell startup scripts.
If the environment variable already contains the given path, nothing is done.
Example:
updateEnv --append --check PATH "/path/to/my/program/bin"