systemctl list-units --full -all | grep -q "$unit_name"; then systemctl disable --now "$unit_name" fi fi done } Package: APPLICATION_PACKAGE Version: APPLICATION_VERSION_WITH_RELEASE Section: APPLICATION_SECTION Maintainer: APPLICATION_MAINTAINER Priority: optional Architecture: APPLICATION_ARCH Provides: APPLICATION_PACKAGE Description: APPLICATION_DESCRIPTION Depends: PACKAGE_DEFAULT_DEPENDENCIES PACKAGE_CUSTOM_DEPENDENCIES Installed-Size: APPLICATION_INSTALLED_SIZE APPLICATION_HOMEPAGE Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * Copyright: APPLICATION_COPYRIGHT License: APPLICATION_LICENSE_TEXT [Desktop Entry] Name=APPLICATION_NAME Comment=APPLICATION_DESCRIPTION Exec=APPLICATION_LAUNCHER Icon=APPLICATION_ICON Terminal=false Type=Application Categories=DEPLOY_BUNDLE_CATEGORY DESKTOP_MIMES #!/bin/sh # postinst script for APPLICATION_PACKAGE # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package package_type=deb LAUNCHER_AS_SERVICE_SCRIPTS case "$1" in configure) DESKTOP_COMMANDS_INSTALL LAUNCHER_AS_SERVICE_COMMANDS_INSTALL ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0 #!/bin/sh # postrm script for APPLICATION_PACKAGE # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `purge' # * `upgrade' # * `failed-upgrade' # * `abort-install' # * `abort-install' # * `abort-upgrade' # * `disappear' # # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0 #!/bin/sh # preinst script for APPLICATION_PACKAGE # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package package_type=deb COMMON_SCRIPTS LAUNCHER_AS_SERVICE_SCRIPTS case "$1" in install|upgrade) if [ -n "$2" ]; then :; LAUNCHER_AS_SERVICE_COMMANDS_UNINSTALL fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0 #!/bin/sh # prerm script for APPLICATION_PACKAGE # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `upgrade' # * `failed-upgrade' # * `remove' `in-favour' # * `deconfigure' `in-favour' # `removing' # # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package package_type=deb COMMON_SCRIPTS DESKTOP_SCRIPTS LAUNCHER_AS_SERVICE_SCRIPTS case "$1" in remove|upgrade|deconfigure) DESKTOP_COMMANDS_UNINSTALL LAUNCHER_AS_SERVICE_COMMANDS_UNINSTALL ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0 Summary: APPLICATION_SUMMARY Name: APPLICATION_PACKAGE Version: APPLICATION_VERSION Release: APPLICATION_RELEASE License: APPLICATION_LICENSE_TYPE Vendor: APPLICATION_VENDOR %if "xAPPLICATION_URL" != "x" URL: APPLICATION_URL %endif %if "xAPPLICATION_PREFIX" != "x" Prefix: APPLICATION_PREFIX %endif Provides: APPLICATION_PACKAGE %if "xAPPLICATION_GROUP" != "x" Group: APPLICATION_GROUP %endif Autoprov: 0 Autoreq: 0 %if "xPACKAGE_DEFAULT_DEPENDENCIES" != "x" || "xPACKAGE_CUSTOM_DEPENDENCIES" != "x" Requires: PACKAGE_DEFAULT_DEPENDENCIES PACKAGE_CUSTOM_DEPENDENCIES %endif #comment line below to enable effective jar compression #it could easily get your package size from 40 to 15Mb but #build time will substantially increase and it may require unpack200/system java to install %define __jar_repack %{nil} # on RHEL we got unwanted improved debugging enhancements %define _build_id_links none %define package_filelist %{_builddir}/%{name}.files %define app_filelist %{_builddir}/%{name}.app.files %define filesystem_filelist %{_builddir}/%{name}.filesystem.files %define default_filesystem / /opt /usr /usr/bin /usr/lib /usr/local /usr/local/bin /usr/local/lib %description APPLICATION_DESCRIPTION %global __os_install_post %{nil} %prep %build %install rm -rf %{buildroot} install -d -m 755 %{buildroot}APPLICATION_DIRECTORY cp -r %{_sourcedir}APPLICATION_DIRECTORY/* %{buildroot}APPLICATION_DIRECTORY if [ "$(echo %{_sourcedir}/lib/systemd/system/*.service)" != '%{_sourcedir}/lib/systemd/system/*.service' ]; then install -d -m 755 %{buildroot}/lib/systemd/system cp %{_sourcedir}/lib/systemd/system/*.service %{buildroot}/lib/systemd/system fi %if "xAPPLICATION_LICENSE_FILE" != "x" %define license_install_file %{_defaultlicensedir}/%{name}-%{version}/%{basename:APPLICATION_LICENSE_FILE} install -d -m 755 "%{buildroot}%{dirname:%{license_install_file}}" install -m 644 "APPLICATION_LICENSE_FILE" "%{buildroot}%{license_install_file}" %endif (cd %{buildroot} && find . -path ./lib/systemd -prune -o -type d -print) | sed -e 's/^\.//' -e '/^$/d' | sort > %{app_filelist} { rpm -ql filesystem || echo %{default_filesystem}; } | sort > %{filesystem_filelist} comm -23 %{app_filelist} %{filesystem_filelist} > %{package_filelist} sed -i -e 's/.*/%dir "&"/' %{package_filelist} (cd %{buildroot} && find . -not -type d) | sed -e 's/^\.//' -e 's/.*/"&"/' >> %{package_filelist} %if "xAPPLICATION_LICENSE_FILE" != "x" sed -i -e 's|"%{license_install_file}"||' -e '/^$/d' %{package_filelist} %endif %files -f %{package_filelist} %if "xAPPLICATION_LICENSE_FILE" != "x" %license "%{license_install_file}" %endif %post package_type=rpm LAUNCHER_AS_SERVICE_SCRIPTS DESKTOP_COMMANDS_INSTALL LAUNCHER_AS_SERVICE_COMMANDS_INSTALL %pre package_type=rpm COMMON_SCRIPTS LAUNCHER_AS_SERVICE_SCRIPTS if [ "$1" -gt 1 ]; then :; LAUNCHER_AS_SERVICE_COMMANDS_UNINSTALL fi %preun package_type=rpm COMMON_SCRIPTS DESKTOP_SCRIPTS LAUNCHER_AS_SERVICE_SCRIPTS DESKTOP_COMMANDS_UNINSTALL LAUNCHER_AS_SERVICE_COMMANDS_UNINSTALL %clean [Unit] Description=SERVICE_DESCRIPTION [Service] ExecStart=APPLICATION_LAUNCHER Restart=on-failure [Install] WantedBy=multi-user.target Ê