From 0cf8f92caff7df7876e3350dcab5b17615734519 Mon Sep 17 00:00:00 2001 From: Semyon Bezrukov Date: Thu, 1 Aug 2024 19:38:58 +0300 Subject: [PATCH] Fix lintian errors: prerm-calls-updatemenus, postinst-has-useless-call-to-update-menus --- win-linux/package/linux/Makefile | 38 ++++---- .../common/icons/{128.png => 128x128.png} | Bin .../linux/common/icons/{16.png => 16x16.png} | Bin .../linux/common/icons/{24.png => 24x24.png} | Bin .../common/icons/{256.png => 256x256.png} | Bin .../linux/common/icons/{32.png => 32x32.png} | Bin .../linux/common/icons/{48.png => 48x48.png} | Bin .../linux/common/icons/{64.png => 64x64.png} | Bin .../package/linux/deb/template/postinst.m4 | 34 ------- .../package/linux/deb/template/postrm.m4 | 43 +++------ win-linux/package/linux/deb/template/prerm.m4 | 34 ------- win-linux/package/linux/rpm/common.spec | 90 +----------------- 12 files changed, 38 insertions(+), 201 deletions(-) rename win-linux/package/linux/common/icons/{128.png => 128x128.png} (100%) rename win-linux/package/linux/common/icons/{16.png => 16x16.png} (100%) rename win-linux/package/linux/common/icons/{24.png => 24x24.png} (100%) rename win-linux/package/linux/common/icons/{256.png => 256x256.png} (100%) rename win-linux/package/linux/common/icons/{32.png => 32x32.png} (100%) rename win-linux/package/linux/common/icons/{48.png => 48x48.png} (100%) rename win-linux/package/linux/common/icons/{64.png => 64x64.png} (100%) delete mode 100644 win-linux/package/linux/deb/template/postinst.m4 delete mode 100644 win-linux/package/linux/deb/template/prerm.m4 diff --git a/win-linux/package/linux/Makefile b/win-linux/package/linux/Makefile index 5c995b84c..8e2cb52de 100644 --- a/win-linux/package/linux/Makefile +++ b/win-linux/package/linux/Makefile @@ -60,13 +60,21 @@ DESKTOP_FILES += build/main/usr/share/applications/$(DESKTOPEDITORS_EXEC).deskto LINUX_DEPS += $(BIN_FILES) LINUX_DEPS += $(DESKTOP_FILES) LINUX_DEPS += $(CHANGELOG_RPM) +LINUX_DEPS += $(patsubst $(BRANDING_DIR)/common/icons/%.png, \ + build/main/usr/share/icons/hicolor/%/apps/$(DESKTOPEDITORS_EXEC).png, \ + $(wildcard $(BRANDING_DIR)/common/icons/*.png)) +LINUX_DEPS += build/main/usr/share/licenses/$(PACKAGE_NAME)/LICENSE +LINUX_DEPS += build/main/usr/share/licenses/$(PACKAGE_NAME)/3DPARTYLICENSE +ifneq ($(wildcard $(BRANDING_DIR)/../../../common/package/mimetypes/*.xml),) +LINUX_DEPS += $(patsubst $(BRANDING_DIR)/../../../common/package/mimetypes/%.xml, \ + build/main/usr/share/mime/packages/%.xml, \ + $(wildcard $(BRANDING_DIR)/../../../common/package/mimetypes/*.xml)) +endif DEB_DEPS += $(CHANGELOG_DEB) DEB_DEPS += deb/build/debian/compat DEB_DEPS += deb/build/debian/control -DEB_DEPS += deb/build/debian/postinst DEB_DEPS += deb/build/debian/postrm -DEB_DEPS += deb/build/debian/prerm DEB_DEPS += deb/build/debian/rules DEB_DEPS += deb/build/debian/source/format DEB_DEPS += deb/build/debian/$(PACKAGE_NAME).dirs @@ -141,16 +149,6 @@ build : $(LINUX_DEPS) cp -rft $@/main/opt/$(DESKTOPEDITORS_PREFIX) $(SOURCE_DIR)/desktopeditors/* chmod 755 $@/main/opt/$(DESKTOPEDITORS_PREFIX)/DesktopEditors - cp -rf $(BRANDING_DIR)/../../../common/package/license/*.htm \ - $@/main/opt/$(DESKTOPEDITORS_PREFIX)/LICENSE.htm - cp -rf $(BRANDING_DIR)/../../../common/package/license/3dparty/3DPARTYLICENSE \ - $@/main/opt/$(DESKTOPEDITORS_PREFIX)/ - -ifneq ($(wildcard $(BRANDING_DIR)/../../../common/package/mimetypes),) - cp -rf $(BRANDING_DIR)/../../../common/package/mimetypes \ - $@/main/opt/$(DESKTOPEDITORS_PREFIX) -endif - cd $@; \ for path in main/$(HELP_GLOB); do \ path_new=$$(echo $$path | sed 's|^main/|help/|'); \ @@ -158,10 +156,6 @@ endif mv -fT $$path $$path_new; \ done - for path in $(BRANDING_DIR)/common/icons/*.png; do \ - cp -f $$path $@/main/opt/$(DESKTOPEDITORS_PREFIX)/asc-de-$${path##*/}; \ - done - ifdef MEDIAVIEWER_PREFIX mkdir -p $@/main/opt/$(MEDIAVIEWER_PREFIX) cp -rft $@/main/opt/$(MEDIAVIEWER_PREFIX) $(SOURCE_DIR)/mediaviewer/* @@ -178,6 +172,18 @@ $(RPM) : build rpm/$(PACKAGE_NAME).spec $(RPM_PARAMS) \ $(PACKAGE_NAME).spec +build/main/usr/share/icons/hicolor/%/apps/$(DESKTOPEDITORS_EXEC).png : $(BRANDING_DIR)/common/icons/%.png + install -D $< $@ + +build/main/usr/share/licenses/$(PACKAGE_NAME)/LICENSE : $(BRANDING_DIR)/../../../LICENSE.txt +build/main/usr/share/licenses/$(PACKAGE_NAME)/3DPARTYLICENSE : $(BRANDING_DIR)/../../../common/package/license/3dparty/3DPARTYLICENSE + +build/main/usr/share/licenses/% : + install -D $< $@ + +build/main/usr/share/mime/packages/% : $(BRANDING_DIR)/../../../common/package/mimetypes/% + install -D $< $@ + deb/build/debian/% : deb/template/% mkdir -pv $(@D) && cp -fv $< $@ diff --git a/win-linux/package/linux/common/icons/128.png b/win-linux/package/linux/common/icons/128x128.png similarity index 100% rename from win-linux/package/linux/common/icons/128.png rename to win-linux/package/linux/common/icons/128x128.png diff --git a/win-linux/package/linux/common/icons/16.png b/win-linux/package/linux/common/icons/16x16.png similarity index 100% rename from win-linux/package/linux/common/icons/16.png rename to win-linux/package/linux/common/icons/16x16.png diff --git a/win-linux/package/linux/common/icons/24.png b/win-linux/package/linux/common/icons/24x24.png similarity index 100% rename from win-linux/package/linux/common/icons/24.png rename to win-linux/package/linux/common/icons/24x24.png diff --git a/win-linux/package/linux/common/icons/256.png b/win-linux/package/linux/common/icons/256x256.png similarity index 100% rename from win-linux/package/linux/common/icons/256.png rename to win-linux/package/linux/common/icons/256x256.png diff --git a/win-linux/package/linux/common/icons/32.png b/win-linux/package/linux/common/icons/32x32.png similarity index 100% rename from win-linux/package/linux/common/icons/32.png rename to win-linux/package/linux/common/icons/32x32.png diff --git a/win-linux/package/linux/common/icons/48.png b/win-linux/package/linux/common/icons/48x48.png similarity index 100% rename from win-linux/package/linux/common/icons/48.png rename to win-linux/package/linux/common/icons/48x48.png diff --git a/win-linux/package/linux/common/icons/64.png b/win-linux/package/linux/common/icons/64x64.png similarity index 100% rename from win-linux/package/linux/common/icons/64.png rename to win-linux/package/linux/common/icons/64x64.png diff --git a/win-linux/package/linux/deb/template/postinst.m4 b/win-linux/package/linux/deb/template/postinst.m4 deleted file mode 100644 index 34306e083..000000000 --- a/win-linux/package/linux/deb/template/postinst.m4 +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# - -set -e # fail on any error -set -u # treat unset variable as errors - -# Add icons to the system icons -XDG_ICON_RESOURCE="$(which xdg-icon-resource 2> /dev/null || true)" -if [ ! -x "$XDG_ICON_RESOURCE" ]; then - echo "Error: Could not find xdg-icon-resource" >&2 - exit 1 -fi -for icon in "/opt/M4_DESKTOPEDITORS_PREFIX/asc-de-"*.png; do - size="${icon##*/asc-de-}" - "$XDG_ICON_RESOURCE" install --size "${size%.png}" "$icon" "M4_PACKAGE_NAME" -done - -UPDATE_MENUS="$(which update-menus 2> /dev/null || true)" -if [ -x "$UPDATE_MENUS" ]; then - update-menus -fi - -ifelse(M4_COMPANY_NAME, ONLYOFFICE, -xdg-mime install --mode system /opt/M4_DESKTOPEDITORS_PREFIX/mimetypes/onlyoffice-docxf.xml -xdg-mime install --mode system /opt/M4_DESKTOPEDITORS_PREFIX/mimetypes/onlyoffice-oform.xml -update-mime-database /usr/share/mime -update-desktop-database /usr/share/applications, -if [ -f /etc/astra_version ] && [ -f /etc/X11/trusted ]; then - sed -i '\|/opt/M4_DESKTOPEDITORS_PREFIX/DesktopEditors|d' /etc/X11/trusted - echo '/opt/M4_DESKTOPEDITORS_PREFIX/DesktopEditors(KBD_R)' >> /etc/X11/trusted -fi) - -# Update cache of .desktop file MIME types. Non-fatal since it's just a cache. -#update-desktop-database > /dev/null 2>&1 || true diff --git a/win-linux/package/linux/deb/template/postrm.m4 b/win-linux/package/linux/deb/template/postrm.m4 index 8601bfc95..1d3e829c2 100644 --- a/win-linux/package/linux/deb/template/postrm.m4 +++ b/win-linux/package/linux/deb/template/postrm.m4 @@ -1,39 +1,22 @@ #!/bin/sh -# -set -e # fail on any error +set -e case "$1" in - purge) - ifelse(M4_COMPANY_NAME, ONLYOFFICE, - rm -fr /home/*/.local/share/M4_DESKTOPEDITORS_PREFIX - rm -fr /home/*/.config/onlyoffice/DesktopEditors.conf, - rm -fr /home/*/.local/share/M4_PACKAGE_NAME - if [ -f /etc/astra_version ] && [ -f /etc/X11/trusted ]; then - sed -i '\|/opt/M4_DESKTOPEDITORS_PREFIX/DesktopEditors|d' /etc/X11/trusted - fi) - ;; - - remove) - ifelse(M4_COMPANY_NAME, ONLYOFFICE,:, - if [ -f /etc/astra_version ] && [ -f /etc/X11/trusted ]; then - sed -i '\|/opt/M4_DESKTOPEDITORS_PREFIX/DesktopEditors|d' /etc/X11/trusted - fi) - ;; - - upgrade|failed-upgrade|disappear|abort-install|abort-upgrade) - : - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; + purge) + rm -fr /home/*/.local/share/M4_DESKTOPEDITORS_PREFIX + rm -fr /home/*/.config/M4_COMPANY_NAME/DesktopEditors.conf + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; esac -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - #DEBHELPER# exit 0 diff --git a/win-linux/package/linux/deb/template/prerm.m4 b/win-linux/package/linux/deb/template/prerm.m4 deleted file mode 100644 index 77707e35c..000000000 --- a/win-linux/package/linux/deb/template/prerm.m4 +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# - -set -e - -action="$1" -if [ "$2" = "in-favour" ]; then - # Treat conflict remove as an upgrade. - action="upgrade" -fi -# Don't clean-up just for an upgrade.` -if [ "$action" = "upgrade" ] ; then - exit 0 -fi - -# Remove icons from the system icons -XDG_ICON_RESOURCE="$(which xdg-icon-resource 2> /dev/null || true)" -if [ ! -x "$XDG_ICON_RESOURCE" ]; then - echo "Error: Could not find xdg-icon-resource" >&2 - exit 1 -fi -for icon in "/opt/M4_DESKTOPEDITORS_PREFIX/asc-de-"*.png; do - size="${icon##*/asc-de-}" - "$XDG_ICON_RESOURCE" uninstall --size "${size%.png}" "M4_PACKAGE_NAME" -done - -UPDATE_MENUS="$(which update-menus 2> /dev/null || true)" -if [ -x "$UPDATE_MENUS" ]; then - update-menus -fi - -# Update cache of .desktop file MIME types. Non-fatal since it's just a cache. -#update-desktop-database > /dev/null 2>&1 || true - diff --git a/win-linux/package/linux/rpm/common.spec b/win-linux/package/linux/rpm/common.spec index e08db1935..86063efb6 100644 --- a/win-linux/package/linux/rpm/common.spec +++ b/win-linux/package/linux/rpm/common.spec @@ -56,6 +56,9 @@ rm -rf "%{buildroot}" %attr(-, root, root) /opt/* %attr(-, root, root) %{_datadir}/applications/* %attr(-, root, root) %{_datadir}/doc/* +%attr(-, root, root) %{_datadir}/icons/* +%attr(-, root, root) %{_datadir}/licenses/* +%attr(-, root, root) %{_datadir}/mime/* %attr(755, root, root) %{_bindir}/%{_desktopeditors_exec} %if "%{_company_name}" == "ONLYOFFICE" %attr(-, root, root) %{_bindir}/desktopeditors @@ -73,93 +76,6 @@ rm -rf "%{buildroot}" /opt/%{_desktopeditors_prefix}/editors/web-apps/apps/*/main/resources/help %endif -%pre - -%post - -set -e # fail on any error -set -u # treat unset variable as errors - -# Add icons to the system icons -XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`" -if [ ! -x "$XDG_ICON_RESOURCE" ]; then - echo "Error: Could not find xdg-icon-resource" >&2 - exit 1 -fi -for icon in "/opt/%{_desktopeditors_prefix}/asc-de-"*.png; do - size="${icon##*/asc-de-}" - if [ $1 == 2 ];then #upgrade (not install) - "$XDG_ICON_RESOURCE" uninstall --size "${size%.png}" "%{_package_name}" - fi - "$XDG_ICON_RESOURCE" install --size "${size%.png}" "$icon" "%{_package_name}" -done - -UPDATE_MENUS="`which update-menus 2> /dev/null || true`" -if [ -x "$UPDATE_MENUS" ]; then - update-menus -fi - -xdg-mime install --mode system /opt/%{_desktopeditors_prefix}/mimetypes/onlyoffice-docxf.xml -xdg-mime install --mode system /opt/%{_desktopeditors_prefix}/mimetypes/onlyoffice-oform.xml - -update-mime-database /usr/share/mime -update-desktop-database /usr/share/applications - -# Update cache of .desktop file MIME types. Non-fatal since it's just a cache. -#update-desktop-database > /dev/null 2>&1 || true - -%preun - -set -e - -action="$1" -if [ "$2" = "in-favour" ]; then - # Treat conflict remove as an upgrade. - action="upgrade" -fi -# Don't clean-up just for an upgrade.` -if [ "$action" = "upgrade" ] ; then - exit 0 -fi - -# Remove icons from the system icons -if [ $1 == 0 ];then #uninstall (not upgrade) - XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`" - if [ ! -x "$XDG_ICON_RESOURCE" ]; then - echo "Error: Could not find xdg-icon-resource" >&2 - exit 1 - fi - for icon in "/opt/%{_desktopeditors_prefix}/asc-de-"*.png; do - size="${icon##*/asc-de-}" - "$XDG_ICON_RESOURCE" uninstall --size "${size%.png}" "%{_package_name}" - done -fi - -UPDATE_MENUS="`which update-menus 2> /dev/null || true`" -if [ -x "$UPDATE_MENUS" ]; then - update-menus -fi - -# Update cache of .desktop file MIME types. Non-fatal since it's just a cache. -#update-desktop-database > /dev/null 2>&1 || true - -%postun - -set -e # fail on any error - -%posttrans - -#for compatibility with old RPMs -XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`" -if [ ! -x "$XDG_ICON_RESOURCE" ]; then - echo "Error: Could not find xdg-icon-resource" >&2 - exit 1 -fi -for icon in "/opt/%{_desktopeditors_prefix}/asc-de-"*.png; do - size="${icon##*/asc-de-}" - "$XDG_ICON_RESOURCE" install --size "${size%.png}" "$icon" "%{_package_name}" -done - %changelog %include ../build/main/usr/share/doc/%{_package_name}/ChangeLog