logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

dpkg-maintscript-helper - works around known dpkg limitations in maintainer scripts

Commands And Parameters

supportscommandrm_conffileconffile [prior-version [package]]
       mv_conffileold-conffilenew-conffile [prior-version [package]]
       symlink_to_dirpathnameold-target [prior-version [package]]
       dir_to_symlinkpathnamenew-target [prior-version [package]]

Common Parameters

prior-version
           Defines  the  latest  version  of  the  package  whose  upgrade  should trigger the operation.  It is
           important to calculate prior-version correctly so that the operations are correctly performed even if
           the user rebuilt the package with a local version.  If prior-version is empty or  omitted,  then  the
           operation  is  tried  on  every  upgrade (note: it's safer to give the version and have the operation
           tried only once).

           If the conffile has not been shipped for several versions, and you are now modifying  the  maintainer
           scripts  to  clean  up the obsolete file, prior-version should be based on the version of the package
           that you are now preparing, not the first version of the package  that  lacked  the  conffile.   This
           applies to all other actions in the same way.

           For  example,  for  a  conffile removed in version 2.0-1 of a package, prior-version should be set to
           2.0-1~.  This will cause the conffile to be removed even if the user  rebuilt  the  previous  version
           1.0-1  as  1.0-1local1.  Or a package switching a path from a symlink (shipped in version 1.0-1) to a
           directory (shipped in version 2.0-1), but only performing the actual switch in the maintainer scripts
           in version 3.0-1, should set prior-version to 3.0-1~.

       package
           The package name owning the pathname(s).  When the package is “Multi-Arch: same” this parameter  must
           include  the  architecture  qualifier,  otherwise  it  should  not  usually  include the architecture
           qualifier (as it would disallow cross-grades,  or  switching  from  being  architecture  specific  to
           architecture  all or vice versa).  If the parameter is empty or omitted, the DPKG_MAINTSCRIPT_PACKAGE
           and DPKG_MAINTSCRIPT_ARCH environment variables (as set by dpkg when running the maintainer  scripts)
           will be used to generate an arch-qualified package name.

       --  All the parameters of the maintainer scripts have to be forwarded to the program after --.

Description

       This  program is designed to be run within maintainer scripts to achieve some tasks that dpkg can't (yet)
       handle natively either because of design decisions or due to current limitations.

       Many of those tasks require coordinated actions  from  several  maintainer  scripts  (preinst,  postinst,
       prerm,  postrm).   To  avoid mistakes the same call simply needs to be put in all scripts and the program
       will automatically adapt its behavior based on the environment variable DPKG_MAINTSCRIPT_NAME and on  the
       maintainer scripts arguments that you have to forward after a double hyphen.

       This program was introduced in dpkg 1.15.7.

Environment

DPKG_ROOT
           If set, it will be used as the filesystem root directory.

       DPKG_ADMINDIR
           If set, it will be used as the dpkg data directory.

       DPKG_COLORS
           Sets  the  color mode (since dpkg 1.19.1).  The currently accepted values are: auto (default), always
           and never.

Integration In Packages

       When using a packaging helper, please check if it has native dpkg-maintscript-helper  integration,  which
       might make your life easier.  See for example dh_installdeb(1).

       Given  that  dpkg-maintscript-helper  is  used  in  the preinst, using it unconditionally requires a pre-
       dependency to ensure that the required version of dpkg has been unpacked before.   The  required  version
       depends  on  the  command  used,  for  rm_conffile and mv_conffile it is 1.15.7.2, for symlink_to_dir and
       dir_to_symlink it is 1.17.14:

        Pre-Depends: dpkg (>= 1.17.14)

       But in many cases the operation done by the program is not critical for the package, and instead of using
       a pre-dependency we can call the program only if we know that the required command is  supported  by  the
       currently installed dpkg:

            if dpkg-maintscript-helper supports command; then
               dpkg-maintscript-helper command ...
            fi

       The  command  supports  will  return  0  on success, 1 otherwise.  The supports command will check if the
       environment variables as set by dpkg and required by the script are  present,  and  will  consider  it  a
       failure in case the environment is not sufficient.

Name

       dpkg-maintscript-helper - works around known dpkg limitations in maintainer scripts

See Also

dh_installdeb(1).

1.22.18                                            2025-03-20                         dpkg-maintscript-helper(1)

Synopsis

dpkg-maintscript-helpercommand [parameter...] --maint-script-parameter...

See Also