�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�#!/bin/sh # # Copyright © 2007, 2011-2015 Guillem Jover # Copyright © 2010 Raphaël Hertzog # Copyright © 2008 Joey Hess # Copyright © 2005 Scott James Remnant (original implementation on www.dpkg.org) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The conffile related functions are inspired by # https://wiki.debian.org/DpkgConffileHandling # This script is documented in dpkg-maintscript-helper(1) ## ## Functions to remove an obsolete conffile during upgrade ## rm_conffile() { local CONFFILE="$1" local LASTVERSION="$2" local PACKAGE="$3" if [ "$LASTVERSION" = "--" ]; then LASTVERSION="" PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi if [ "$PACKAGE" = "--" -o -z "$PACKAGE" ]; then PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi # Skip remaining parameters up to -- while [ "$1" != "--" -a $# -gt 0 ]; do shift; done [ $# -gt 0 ] || badusage "missing arguments after --" shift [ -n "$PACKAGE" ] || error "couldn't identify the package" [ -n "$1" ] || error "maintainer script parameters are missing" [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ "${CONFFILE}" != "${CONFFILE#/}" ] || \ error "conffile '$CONFFILE' is not an absolute path" validate_optional_version "$LASTVERSION" debug "Executing $0 rm_conffile in $DPKG_MAINTSCRIPT_NAME" \ "of $DPKG_MAINTSCRIPT_PACKAGE" debug "CONFFILE=$CONFFILE PACKAGE=$PACKAGE" \ "LASTVERSION=$LASTVERSION ACTION=$1 PARAM=$2" case "$DPKG_MAINTSCRIPT_NAME" in preinst) if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then prepare_rm_conffile "$CONFFILE" "$PACKAGE" fi ;; postinst) if [ "$1" = "configure" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then finish_rm_conffile "$CONFFILE" fi ;; postrm) if [ "$1" = "purge" ]; then rm -f "$CONFFILE.dpkg-bak" "$CONFFILE.dpkg-remove" \ "$CONFFILE.dpkg-backup" fi if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then abort_rm_conffile "$CONFFILE" "$PACKAGE" fi ;; *) debug "$0 rm_conffile not required in $DPKG_MAINTSCRIPT_NAME" ;; esac } prepare_rm_conffile() { local CONFFILE="$1" local PACKAGE="$2" [ -e "$CONFFILE" ] || return 0 ensure_package_owns_file "$PACKAGE" "$CONFFILE" || return 0 local md5sum old_md5sum md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')" old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \ sed -n -e "\\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" if [ "$md5sum" != "$old_md5sum" ]; then mv -f "$CONFFILE" "$CONFFILE.dpkg-backup" else mv -f "$CONFFILE" "$CONFFILE.dpkg-remove" fi } finish_rm_conffile() { local CONFFILE="$1" if [ -e "$CONFFILE.dpkg-backup" ]; then echo "Obsolete conffile $CONFFILE has been modified by you." echo "Saving as $CONFFILE.dpkg-bak ..." mv -f "$CONFFILE.dpkg-backup" "$CONFFILE.dpkg-bak" fi if [ -e "$CONFFILE.dpkg-remove" ]; then echo "Removing obsolete conffile $CONFFILE ..." rm -f "$CONFFILE.dpkg-remove" fi } abort_rm_conffile() { local CONFFILE="$1" local PACKAGE="$2" ensure_package_owns_file "$PACKAGE" "$CONFFILE" || return 0 if [ -e "$CONFFILE.dpkg-remove" ]; then echo "Reinstalling $CONFFILE that was moved away" mv "$CONFFILE.dpkg-remove" "$CONFFILE" fi if [ -e "$CONFFILE.dpkg-backup" ]; then echo "Reinstalling $CONFFILE that was backed-up" mv "$CONFFILE.dpkg-backup" "$CONFFILE" fi } ## ## Functions to rename a conffile during upgrade ## mv_conffile() { local OLDCONFFILE="$1" local NEWCONFFILE="$2" local LASTVERSION="$3" local PACKAGE="$4" if [ "$LASTVERSION" = "--" ]; then LASTVERSION="" PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi if [ "$PACKAGE" = "--" -o -z "$PACKAGE" ]; then PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi # Skip remaining parameters up to -- while [ "$1" != "--" -a $# -gt 0 ]; do shift; done [ $# -gt 0 ] || badusage "missing arguments after --" shift [ -n "$PACKAGE" ] || error "couldn't identify the package" [ -n "$1" ] || error "maintainer script parameters are missing" [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ "${OLDCONFFILE}" != "${OLDCONFFILE#/}" ] || \ error "old-conffile '$OLDCONFFILE' is not an absolute path" [ "${NEWCONFFILE}" != "${NEWCONFFILE#/}" ] || \ error "new-conffile '$NEWCONFFILE' is not an absolute path" validate_optional_version "$LASTVERSION" debug "Executing $0 mv_conffile in $DPKG_MAINTSCRIPT_NAME" \ "of $DPKG_MAINTSCRIPT_PACKAGE" debug "CONFFILE=$OLDCONFFILE -> $NEWCONFFILE PACKAGE=$PACKAGE" \ "LASTVERSION=$LASTVERSION ACTION=$1 PARAM=$2" case "$DPKG_MAINTSCRIPT_NAME" in preinst) if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then prepare_mv_conffile "$OLDCONFFILE" "$PACKAGE" fi ;; postinst) if [ "$1" = "configure" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then finish_mv_conffile "$OLDCONFFILE" "$NEWCONFFILE" "$PACKAGE" fi ;; postrm) if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then abort_mv_conffile "$OLDCONFFILE" "$PACKAGE" fi ;; *) debug "$0 mv_conffile not required in $DPKG_MAINTSCRIPT_NAME" ;; esac } prepare_mv_conffile() { local CONFFILE="$1" local PACKAGE="$2" [ -e "$CONFFILE" ] || return 0 ensure_package_owns_file "$PACKAGE" "$CONFFILE" || return 0 local md5sum old_md5sum md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')" old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \ sed -n -e "\\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" if [ "$md5sum" = "$old_md5sum" ]; then mv -f "$CONFFILE" "$CONFFILE.dpkg-remove" fi } finish_mv_conffile() { local OLDCONFFILE="$1" local NEWCONFFILE="$2" local PACKAGE="$3" rm -f "$OLDCONFFILE.dpkg-remove" [ -e "$OLDCONFFILE" ] || return 0 ensure_package_owns_file "$PACKAGE" "$OLDCONFFILE" || return 0 echo "Preserving user changes to $NEWCONFFILE (renamed from $OLDCONFFILE)..." if [ -e "$NEWCONFFILE" ]; then mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new" fi mv -f "$OLDCONFFILE" "$NEWCONFFILE" } abort_mv_conffile() { local CONFFILE="$1" local PACKAGE="$2" ensure_package_owns_file "$PACKAGE" "$CONFFILE" || return 0 if [ -e "$CONFFILE.dpkg-remove" ]; then echo "Reinstalling $CONFFILE that was moved away" mv "$CONFFILE.dpkg-remove" "$CONFFILE" fi } ## ## Functions to replace a symlink with a directory ## symlink_to_dir() { local SYMLINK="$1" local SYMLINK_TARGET="$2" local LASTVERSION="$3" local PACKAGE="$4" if [ "$LASTVERSION" = "--" ]; then LASTVERSION="" PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi if [ "$PACKAGE" = "--" -o -z "$PACKAGE" ]; then PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi # Skip remaining parameters up to -- while [ "$1" != "--" -a $# -gt 0 ]; do shift; done [ $# -gt 0 ] || badusage "missing arguments after --" shift [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ -n "$PACKAGE" ] || error "cannot identify the package" [ -n "$SYMLINK" ] || error "symlink parameter is missing" [ "${SYMLINK#/}" = "$SYMLINK" ] && \ error "symlink pathname is not an absolute path" [ "${SYMLINK%/}" = "$SYMLINK" ] || \ error "symlink pathname ends with a slash" [ -n "$SYMLINK_TARGET" ] || error "original symlink target is missing" [ -n "$1" ] || error "maintainer script parameters are missing" validate_optional_version "$LASTVERSION" debug "Executing $0 symlink_to_dir in $DPKG_MAINTSCRIPT_NAME" \ "of $DPKG_MAINTSCRIPT_PACKAGE" debug "SYMLINK=$SYMLINK -> $SYMLINK_TARGET PACKAGE=$PACKAGE" \ "LASTVERSION=$LASTVERSION ACTION=$1 PARAM=$2" case "$DPKG_MAINTSCRIPT_NAME" in preinst) if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] && [ -h "$SYMLINK" ] && symlink_match "$SYMLINK" "$SYMLINK_TARGET" && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then mv -f "$SYMLINK" "${SYMLINK}.dpkg-backup" fi ;; postinst) # We cannot bail depending on the version, as here we only # know what was the last configured version, and we might # have been unpacked, then upgraded with an unpack and thus # never been configured before. if [ "$1" = "configure" ] && [ -h "${SYMLINK}.dpkg-backup" ] && symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET" then rm -f "${SYMLINK}.dpkg-backup" fi ;; postrm) if [ "$1" = "purge" ] && [ -h "${SYMLINK}.dpkg-backup" ]; then rm -f "${SYMLINK}.dpkg-backup" fi if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] && [ -n "$2" ] && [ ! -e "$SYMLINK" ] && [ -h "${SYMLINK}.dpkg-backup" ] && symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET" && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then echo "Restoring backup of $SYMLINK ..." mv "${SYMLINK}.dpkg-backup" "$SYMLINK" fi ;; *) debug "$0 symlink_to_dir not required in $DPKG_MAINTSCRIPT_NAME" ;; esac } ## ## Functions to replace a directory with a symlink ## dir_to_symlink() { local PATHNAME="${1%/}" local SYMLINK_TARGET="$2" local LASTVERSION="$3" local PACKAGE="$4" if [ "$LASTVERSION" = "--" ]; then LASTVERSION="" PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi if [ "$PACKAGE" = "--" -o -z "$PACKAGE" ]; then PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}" fi # Skip remaining parameters up to -- while [ "$1" != "--" -a $# -gt 0 ]; do shift; done [ $# -gt 0 ] || badusage "missing arguments after --" shift [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ -n "$PACKAGE" ] || error "cannot identify the package" [ -n "$PATHNAME" ] || error "directory parameter is missing" [ "${PATHNAME#/}" = "$PATHNAME" ] && \ error "directory parameter is not an absolute path" [ -n "$SYMLINK_TARGET" ] || error "new symlink target is missing" [ -n "$1" ] || error "maintainer script parameters are missing" validate_optional_version "$LASTVERSION" debug "Executing $0 dir_to_symlink in $DPKG_MAINTSCRIPT_NAME" \ "of $DPKG_MAINTSCRIPT_PACKAGE" debug "PATHNAME=$PATHNAME SYMLINK_TARGET=$SYMLINK_TARGET" \ "PACKAGE=$PACKAGE LASTVERSION=$LASTVERSION ACTION=$1 PARAM=$2" case "$DPKG_MAINTSCRIPT_NAME" in preinst) if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] && [ ! -h "$PATHNAME" ] && [ -d "$PATHNAME" ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then prepare_dir_to_symlink "$PACKAGE" "$PATHNAME" fi ;; postinst) # We cannot bail depending on the version, as here we only # know what was the last configured version, and we might # have been unpacked, then upgraded with an unpack and thus # never been configured before. if [ "$1" = "configure" ] && [ -d "${PATHNAME}.dpkg-backup" ] && [ ! -h "$PATHNAME" ] && [ -d "$PATHNAME" ] && [ -f "$PATHNAME/.dpkg-staging-dir" ]; then finish_dir_to_symlink "$PATHNAME" "$SYMLINK_TARGET" fi ;; postrm) if [ "$1" = "purge" ] && [ -d "${PATHNAME}.dpkg-backup" ]; then rm -rf "${PATHNAME}.dpkg-backup" fi if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] && [ -n "$2" ] && [ -d "${PATHNAME}.dpkg-backup" ] && [ \( ! -h "$PATHNAME" -a -d "$PATHNAME" -a \ -f "$PATHNAME/.dpkg-staging-dir" \) -o \ \( -h "$PATHNAME" -a \ \( "$(readlink "$PATHNAME")" = "$SYMLINK_TARGET" -o \ "$(readlink -f "$PATHNAME")" = "$SYMLINK_TARGET" \) \) ] && dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then abort_dir_to_symlink "$PATHNAME" fi ;; *) debug "$0 dir_to_symlink not required in $DPKG_MAINTSCRIPT_NAME" ;; esac } prepare_dir_to_symlink() { local PACKAGE="$1" local PATHNAME="$2" local LINE # If there are conffiles we should not perform the switch. dpkg-query -W -f='${Conffiles}\n' "$PACKAGE" | while read -r LINE; do case "$LINE" in "$PATHNAME"/*) error "directory '$PATHNAME' contains conffiles," \ "cannot switch to symlink" ;; esac done # If there are locally created files or files owned by another package # we should not perform the switch. export DPKG_MAINTSCRIPT_HELPER_INTERNAL_API="$version" find "$PATHNAME" -print0 | \ xargs -0 -n1 "$0" _internal_pkg_must_own_file "$PACKAGE" || \ error "directory '$PATHNAME' contains files not owned by" \ "package $PACKAGE, cannot switch to symlink" unset DPKG_MAINTSCRIPT_HELPER_INTERNAL_API # At this point, we know that the directory either contains no files, # or only non-conffiles owned by the package. # # To do the switch we cannot simply replace it with the final symlink # just yet, because dpkg needs to remove any file present in the old # package that have disappeared in the new one, and we do not want to # lose files resolving to the same pathname in the symlink target. # # We cannot replace the directory with a staging symlink either, # because dpkg will update symlinks to their new target. # # So we need to create a staging directory, to avoid removing files # from other packages, and to trap any new files in the directory # to move them to their correct place later on. mv -f "$PATHNAME" "${PATHNAME}.dpkg-backup" mkdir "$PATHNAME" # Mark it as a staging directory, so that we can track things. touch "$PATHNAME/.dpkg-staging-dir" } finish_dir_to_symlink() { local PATHNAME="$1" local SYMLINK_TARGET="$2" # Move the contents of the staging directory to the symlink target, # as those are all new files installed between this package being # unpacked and configured. local ABS_SYMLINK_TARGET if [ "${SYMLINK_TARGET#/}" = "$SYMLINK_TARGET" ]; then ABS_SYMLINK_TARGET="$(dirname "$PATHNAME")/$SYMLINK_TARGET" else ABS_SYMLINK_TARGET="$SYMLINK_TARGET" fi rm "$PATHNAME/.dpkg-staging-dir" find "$PATHNAME" -mindepth 1 -maxdepth 1 -print0 | \ xargs -0 -i% mv -f "%" "$ABS_SYMLINK_TARGET/" # Remove the staging directory. rmdir "$PATHNAME" # Do the actual switch. ln -s "$SYMLINK_TARGET" "$PATHNAME" # We are left behind the old files owned by this package in the backup # directory, just remove it. rm -rf "${PATHNAME}.dpkg-backup" } abort_dir_to_symlink() { local PATHNAME="$1" echo "Restoring backup of $PATHNAME ..." if [ -h "$PATHNAME" ]; then rm -f "$PATHNAME" else # The staging directory must be empty, as no other package # should have been unpacked in between. rm -f "$PATHNAME/.dpkg-staging-dir" rmdir "$PATHNAME" fi mv "${PATHNAME}.dpkg-backup" "$PATHNAME" } # Common functions validate_optional_version() { local VERSION="$1" if [ -z "$VERSION" ]; then return fi if ! VERSIONCHECK=$(dpkg --validate-version -- "$VERSION" 2>&1); then error "$VERSIONCHECK" fi } ensure_package_owns_file() { local PACKAGE="$1" local FILE="$2" if ! dpkg-query -L "$PACKAGE" | grep -F -q -x "$FILE"; then debug "File '$FILE' not owned by package " \ "'$PACKAGE', skipping $command" return 1 fi return 0 } internal_pkg_must_own_file() { local PACKAGE="$1" local FILE="$2" if [ "$DPKG_MAINTSCRIPT_HELPER_INTERNAL_API" != "$version" ]; then error "internal API used by external command" fi if ! ensure_package_owns_file "$PACKAGE" "$FILE"; then error "file '$FILE' not owned by package '$PACKAGE'" fi return 0 } symlink_match() { local SYMLINK="$1" local SYMLINK_TARGET="$2" [ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \ [ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ] } # Standard ANSI colors and attributes. COLOR_NORMAL='' COLOR_RESET='' COLOR_BOLD='' COLOR_BLACK='' COLOR_RED='' COLOR_GREEN='' COLOR_YELLOW='' COLOR_BLUE='' COLOR_MAGENTA='' COLOR_CYAN='' COLOR_WHITE='' COLOR_BOLD_BLACK='' COLOR_BOLD_RED='' COLOR_BOLD_GREEN='' COLOR_BOLD_YELLOW='' COLOR_BOLD_BLUE='' COLOR_BOLD_MAGENTA='' COLOR_BOLD_CYAN='' COLOR_BOLD_WHITE='' setup_colors() { : "${DPKG_COLORS=auto}" case "$DPKG_COLORS" in auto) if [ -t 1 ]; then USE_COLORS=yes else USE_COLORS=no fi ;; always) USE_COLORS=yes ;; *) USE_COLORS=no ;; esac if [ $USE_COLORS = yes ]; then COLOR_PROG="$COLOR_BOLD" COLOR_INFO="$COLOR_GREEN" COLOR_NOTICE="$COLOR_YELLOW" COLOR_WARN="$COLOR_BOLD_YELLOW" COLOR_ERROR="$COLOR_BOLD_RED" else COLOR_RESET="" fi FMT_PROG="$COLOR_PROG$PROGNAME$COLOR_RESET" } debug() { if [ -n "$DPKG_DEBUG" ]; then echo "DEBUG: $FMT_PROG: $*" >&2 fi } error() { echo "$FMT_PROG: ${COLOR_ERROR}error${COLOR_RESET}: $*" >&2 exit 1 } warning() { echo "$FMT_PROG: ${COLOR_WARN}warning${COLOR_RESET}: $*" >&2 } usage() { cat < ... -- ... Commands: supports Returns 0 (success) if the given command is supported, 1 otherwise. rm_conffile [ []] Remove obsolete conffile. Must be called in preinst, postinst and postrm. mv_conffile [ []] Rename a conffile. Must be called in preinst, postinst and postrm. symlink_to_dir [ []] Replace a symlink with a directory. Must be called in preinst, postinst and postrm. dir_to_symlink [ []] Replace a directory with a symlink. Must be called in preinst, postinst and postrm. help Display this usage information. END } badusage() { echo "$FMT_PROG: ${COLOR_ERROR}error${COLOR_RESET}: $1" >&2 echo >&2 echo "Use '$PROGNAME help' for program usage information." >&2 exit 1 } # Main code set -e PROGNAME=$(basename "$0") version="1.19.7" setup_colors command="$1" [ $# -gt 0 ] || badusage "missing command" shift case "$command" in supports) case "$1" in rm_conffile|mv_conffile|symlink_to_dir|dir_to_symlink) code=0 ;; *) code=1 ;; esac if [ -z "$DPKG_MAINTSCRIPT_NAME" ]; then warning "environment variable DPKG_MAINTSCRIPT_NAME missing" code=1 fi if [ -z "$DPKG_MAINTSCRIPT_PACKAGE" ]; then warning "environment variable DPKG_MAINTSCRIPT_PACKAGE missing" code=1 fi exit $code ;; rm_conffile) rm_conffile "$@" ;; mv_conffile) mv_conffile "$@" ;; symlink_to_dir) symlink_to_dir "$@" ;; dir_to_symlink) dir_to_symlink "$@" ;; _internal_pkg_must_own_file) # This is an internal command, must not be used outside this program. internal_pkg_must_own_file "$@" ;; --help|help|-?) usage ;; --version) cat <<-END Debian $PROGNAME version $version. This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. END ;; *) badusage "command $command is unknown Hint: upgrading dpkg to a newer version might help." esac exit 0