File appimaged.spec of Package appimaged
#
# spec file for package appimaged
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# About packaging programs written in Go, please see
# https://en.opensuse.org/openSUSE:Packaging_Go
# steps to produce tarballs:
# COMMIT="92b4e77"
# wget https://github.com/probonopd/go-appimage/archive/${COMMIT}.tar.gz
# tar -xzf ${COMMIT}.tar.gz
# mv go-appimage* go-appimage
# cd go-appimage
# go mod vendor
# tar -czf ../vendor.${COMMIT}.tar.gz vendor/
%global provider_prefix github.com/probonopd/go-appimage
%global import_path %{provider_prefix}
%global version_date 20210116
%global version_commit 92b4e77
%global commit_full 92b4e776ef5269211cd5104ce89c3b69507ff67b
Name: appimaged
Version: 11.0.0+git%{version_date}.%{version_commit}
Release: 0
Summary: Daemon that registers AppImages and integrates them with the system
License: MIT
URL: https://github.com/probonopd/go-appimage
Group: System/Daemons
Source0: https://github.com/probonopd/go-appimage/archive/%{version_commit}.tar.gz
Source1: vendor.%{version_commit}.tar.gz
Source2: appimaged.service
# PATCH-FIX-OPENSUSE By default only appimage packaging is supported
Patch1: 001-enable-running-from-non-appimage.patch
# PATCH-FIX-OPENSUSE By default, only certain live CD ISOs are supported,
# however it works on TW as well
Patch2: 002-enable-running-from-non-live-iso.patch
# PATCH-FIX-OPENSUSE unit file is installed by rpm, no need for runtime install
Patch3: 003-disable-sysdemd-unit-registration.patch
BuildRequires: fdupes
BuildRequires: golang-packaging
BuildRequires: systemd-rpm-macros
BuildRequires: upx
Requires: bsdtar
Requires: desktop-file-utils
Requires: squashfs
Suggests: firejail
%description
Sets the executable bit on AppImages, adds them to the system menu,
and makes it possible to launch the most recent AppImage
that is registered on the system for a given application.
%prep
# unpack source
%setup -q -n go-appimage-%{commit_full}
# unpack vendor directory to the source root
%setup -q -a 1 -n go-appimage-%{commit_full}
# apply patches
%patch1
%patch2
%patch3
%build
%goprep %{import_path}/src/appimaged
%if "%go_ver" >= "1.13.0"
%define trimpath -trimpath
%endif
%gobuild -ldflags="-s -w -X main.commit=%version_commit" %trimpath --mod=vendor ''
# compress binary
upx %{_builddir}/go/bin/appimaged
%install
%goinstall
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/appimaged.service
%gofilelist
%fdupes %{buildroot}/%{_prefix}
# trigger systemctl daemon-reload
%pre
%service_add_pre appimaged.service
%post
%service_add_post appimaged.service
%preun
%service_del_preun appimaged.service
%postun
%service_del_postun appimaged.service
%files -f file.lst
%{_bindir}/appimaged
%{_unitdir}/appimaged.service
%license LICENSE
%doc src/appimaged/README.md
%changelog