snapd/snapd.spec

315 lines
11 KiB
RPMSpec

%define _gourl github.com/snapcore/snapd
Name: snapd
Version: 2.65.1
Release: 1mamba
Summary: Background service that manages and maintains installed snaps
Group: System/Management
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://github.com/canonical/snapd
Source: https://github.com/snapcore/snapd/releases/download/%{version}/%{name}_%{version}.vendor.tar.xz
Patch0: snapd-2.57.4-alternate-dir-add-openmamba.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libapparmor-devel
BuildRequires: libcap-devel
BuildRequires: libseccomp-devel
BuildRequires: libudev-devel
## AUTOBUILDREQ-END
BuildRequires: libxfsprogs-devel
Requires: apparmor
%description
snapd is the background service that manages and maintains installed snaps.
Snaps are app packages for desktop, cloud and IoT that update automatically, are easy to install, secure, cross-platform and dependency-free.
%debug_package
%prep
%setup -q
#-D -T
#:<< _EOF
%patch 0 -p1
export GOPATH=${PWD}/go
mkdir -p ${GOPATH}
# Have snapd checkout appear in a place suitable for subsequent GOPATH. This
# way we don't have to go get it again and it is exactly what the tag/hash
# above describes.
mkdir -p ${GOPATH}/src/github.com/snapcore
ln --no-target-directory -fs ${PWD} ${GOPATH}/src/github.com/snapcore/snapd
# Fix source dir cleanup
chmod -R +w go
%build
#:<< _EOF
export GOPATH=${PWD}/go
# GOFLAGS may be modified by CI tools
# GOFLAGS are the go build flags for all binaries, GOFLAGS_SNAP are for snap
# build only.
GOFLAGS=""
GOFLAGS_SNAP="-tags nomanagers"
export CGO_ENABLED="1"
export CGO_CFLAGS="%{optflags}"
export CGO_CPPFLAGS="%{optflags}"
export CGO_CXXFLAGS="%{optflags}"
export CGO_LDFLAGS="${LDFLAGS}"
./mkversion.sh %{version}-%{release}
# Generate data files such as real systemd units, dbus service, environment
# setup helpers out of the available templates
make -C data \
BINDIR=%{_bindir} \
LIBEXECDIR=%{_prefix}/lib \
SYSTEMDSYSTEMUNITDIR=%{_unitdir} \
SNAP_MOUNT_DIR=/var/lib/snapd/snap \
SNAPD_ENVIRONMENT_FILE=%{_sysconfdir}/default/snapd
cd cmd
# Don't move autoreconf in prepare
autoreconf -f -i
%configure \
--libexecdir=%{_prefix}/lib/snapd \
--with-snap-mount-dir=/var/lib/snapd/snap \
--enable-apparmor \
--enable-nvidia-biarch \
--enable-merged-usr
%make
cd ..
# because argument expansion with quoting in bash is hard, and -ldflags=-extldflags='-foo'
# is not exactly the same as -ldflags "-extldflags '-foo'" use the array trick
# to pass exactly what we want
flags=(-buildmode=pie -ldflags "-w -s -linkmode external -extldflags '$LDFLAGS'" -trimpath -mod=vendor)
staticflags=(-buildmode=pie -ldflags "-w -s -linkmode external -extldflags '$LDFLAGS -static'" -trimpath -mod=vendor)
# Build/install snap and snapd
go build "${flags[@]}" -o ${GOPATH}/bin/snap $GOFLAGS_SNAP %{_gourl}/cmd/snap
go build "${flags[@]}" -o ${GOPATH}/bin/snapd $GOFLAGS %{_gourl}/cmd/snapd
go build "${flags[@]}" -o ${GOPATH}/bin/snap-seccomp $GOFLAGS %{_gourl}/cmd/snap-seccomp
go build "${flags[@]}" -o ${GOPATH}/bin/snap-failure $GOFLAGS %{_gourl}/cmd/snap-failure
go build "${flags[@]}" -o ${GOPATH}/bin/snapd-apparmor $GOFLAGS %{_gourl}/cmd/snapd-apparmor
# build snap-exec and snap-update-ns completely static for base snaps
go build "${staticflags[@]}" -o ${GOPATH}/bin/snap-update-ns $GOFLAGS %{_gourl}/cmd/snap-update-ns
go build "${staticflags[@]}" -o ${GOPATH}/bin/snap-exec $GOFLAGS %{_gourl}/cmd/snap-exec
go build "${staticflags[@]}" -o ${GOPATH}/bin/snapctl $GOFLAGS %{_gourl}/cmd/snapctl
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
# Install bash completion
install -Dm644 data/completion/bash/snap \
%{buildroot}%{_datadir}/bash-completion/completions/snap
install -Dm644 data/completion/bash/complete.sh \
%{buildroot}%{_prefix}/lib/snapd/complete.sh
install -Dm644 data/completion/bash/etelpmoc.sh \
%{buildroot}%{_prefix}/lib/snapd/etelpmoc.sh
# Install zsh completion
install -Dm644 data/completion/zsh/_snap \
%{buildroot}%{_datadir}/zsh/site-functions/_snap
# Install systemd units, dbus services and a script for environment variables
%makeinstall -C data \
BINDIR=%{_bindir} \
DBUSSERVICESDIR=%{_datadir}/dbus-1/services \
SYSTEMDSYSTEMUNITDIR=%{_unitdir} \
SNAP_MOUNT_DIR=/var/lib/snapd/snap
# Install polkit policy
install -Dm644 data/polkit/io.snapcraft.snapd.policy \
%{buildroot}%{_datadir}/polkit-1/actions/io.snapcraft.snapd.policy
# Install executables
install -Dm755 go/bin/snap %{buildroot}%{_bindir}/snap
install -Dm755 go/bin/snapctl %{buildroot}%{_prefix}/lib/snapd/snapctl
install -Dm755 go/bin/snapd %{buildroot}%{_prefix}/lib/snapd/snapd
install -Dm755 go/bin/snap-seccomp %{buildroot}%{_prefix}/lib/snapd/snap-seccomp
install -Dm755 go/bin/snap-failure %{buildroot}%{_prefix}/lib/snapd/snap-failure
install -Dm755 go/bin/snapd-apparmor %{buildroot}%{_prefix}/lib/snapd/snapd-apparmor
install -Dm755 go/bin/snap-update-ns %{buildroot}%{_prefix}/lib/snapd/snap-update-ns
install -Dm755 go/bin/snap-exec %{buildroot}%{_prefix}/lib/snapd/snap-exec
# Ensure /usr/bin/snapctl is a symlink to /usr/libexec/snapd/snapctl
ln -s ../lib/snapd/snapctl %{buildroot}%{_bindir}/snapctl
# pre-create directories
install -dm755 %{buildroot}/var/lib/snapd/snap
install -dm755 %{buildroot}/var/cache/snapd
install -dm755 %{buildroot}/var/lib/snapd/{apparmor,assertions,dbus-1/services,dbus-1/system-services,desktop/applications}
install -dm755 %{buildroot}/var/lib/snapd/{device,hostfs,mount,seccomp/bpf,snap/bin,snaps,inhibit}
install -dm755 %{buildroot}/var/lib/snapd/lib/{gl,gl32,vulkan,glvnd}
# these dirs have special permissions
install -dm111 %{buildroot}/var/lib/snapd/void
install -dm700 %{buildroot}/var/lib/snapd/cookie
install -dm700 %{buildroot}/var/lib/snapd/cache
%makeinstall -C cmd
# Install man file
mkdir -p %{buildroot}%{_mandir}/man8
${PWD}/go/bin/snap help --man > %{buildroot}%{_mandir}/man8/snap.8
# Install the "info" data file with snapd version
install -m 644 -D go/src/%{_gourl}/data/info \
%{buildroot}%{_prefix}/lib/snapd/info
# Remove snappy core specific units
rm -fv %{buildroot}%{_unitdir}/snapd.system-shutdown.service
rm -fv %{buildroot}%{_unitdir}/snapd.autoimport.service
rm -fv %{buildroot}%{_unitdir}/snapd.recovery-chooser-trigger.service
rm -fv %{buildroot}%{_unitdir}/snapd.snap-repair.*
rm -fv %{buildroot}%{_unitdir}/snapd.core-fixup.*
# and scripts
rm -fv %{buildroot}%{_prefix}/lib/snapd/snapd.core-fixup.sh
rm -fv %{buildroot}%{_bindir}/ubuntu-core-launcher
rm -fv %{buildroot}%{_prefix}/lib/snapd/system-shutdown
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%preun
%systemd_preun %{name}.socket
:
%post
%systemd_post %{name}.socket
:
%postun
%systemd_postun %{name}.socket
:
%files
%defattr(-,root,root)
%{_sysconfdir}/apparmor.d/usr.lib.snapd.snap-confine
%{_sysconfdir}/profile.d/snapd.sh
%{_sysconfdir}/xdg/autostart/snap-userd-autostart.desktop
%{_bindir}/snap
%{_bindir}/snapctl
%dir %{_prefix}/lib/snapd
%{_prefix}/lib/snapd/*
%{_prefix}/lib/environment.d/990-snapd.conf
%{_systemd_system_env_generator_dir}/snapd-env-generator
%{_systemdgeneratordir}/snapd-generator
%{_unitdir}/snapd.apparmor.service
%{_unitdir}/snapd.failure.service
%{_unitdir}/snapd.seeded.service
%{_unitdir}/snapd.service
%{_unitdir}/snapd.socket
%{_unitdir}/snapd.mounts-pre.target
%{_unitdir}/snapd.mounts.target
%{_tmpfilesdir}/snapd.conf
%{_userunitdir}/snapd.session-agent.service
%{_userunitdir}/snapd.session-agent.socket
%{_datadir}/applications/io.snapcraft.SessionAgent.desktop
%{_datadir}/applications/snap-handle-link.desktop
%{_datadir}/bash-completion/completions/snap
%{_datadir}/dbus-1/services/io.snapcraft.*.service
%{_datadir}/dbus-1/session.d/snapd.session-services.conf
%{_datadir}/dbus-1/system.d/snapd.system-services.conf
%{_datadir}/polkit-1/actions/io.snapcraft.snapd.policy
%{_datadir}/fish/vendor_conf.d/snapd.fish
%{_datadir}/snapd/snapcraft-logo-bird.svg
%{_datadir}/zsh/site-functions/_snap
%{_mandir}/man8/snap.8*
%{_mandir}/man8/snap-confine.8*
%{_mandir}/man8/snap-discard-ns.8*
%{_mandir}/man8/snapd-env-generator.8*
%dir /var/lib/snapd
%dir /var/lib/snapd/snap
%dir /var/cache/snapd
%dir /var/lib/snapd/apparmor
%dir /var/lib/snapd/assertions
%dir /var/lib/snapd/dbus-1/services
%dir /var/lib/snapd/dbus-1/system-services
%dir /var/lib/snapd/desktop/applications
%dir /var/lib/snapd/device
%dir /var/lib/snapd/hostfs
%dir /var/lib/snapd/mount
%dir /var/lib/snapd/seccomp/bpf
%dir /var/lib/snapd/snap/bin
%dir /var/lib/snapd/snaps
%dir /var/lib/snapd/inhibit
%dir /var/lib/snapd/lib/gl
%dir /var/lib/snapd/lib/gl32
%dir /var/lib/snapd/lib/vulkan
%dir /var/lib/snapd/lib/glvnd
%attr(0111,root,root) %dir /var/lib/snapd/void
%attr(0700,root,root) %dir /var/lib/snapd/cookie
%attr(0700,root,root) %dir /var/lib/snapd/cache
%doc COPYING
%changelog
* Thu Sep 05 2024 Automatic Build System <autodist@openmamba.org> 2.65.1-1mamba
- automatic version update by autodist
* Fri May 24 2024 Automatic Build System <autodist@openmamba.org> 2.63-1mamba
- automatic version update by autodist
* Tue Apr 09 2024 Automatic Build System <autodist@openmamba.org> 2.62-1mamba
- automatic version update by autodist
* Thu Mar 07 2024 Automatic Build System <autodist@openmamba.org> 2.61.3-1mamba
- automatic version update by autodist
* Wed Feb 21 2024 Automatic Build System <autodist@openmamba.org> 2.61.2-1mamba
- automatic version update by autodist
* Fri Dec 01 2023 Automatic Build System <autodist@mambasoft.it> 2.61.1-1mamba
- automatic version update by autodist
* Mon Oct 16 2023 Automatic Build System <autodist@mambasoft.it> 2.61-1mamba
- automatic version update by autodist
* Mon Sep 18 2023 Automatic Build System <autodist@mambasoft.it> 2.60.4-1mamba
- automatic version update by autodist
* Thu Aug 31 2023 Automatic Build System <autodist@mambasoft.it> 2.60.3-1mamba
- automatic version update by autodist
* Thu Jul 06 2023 Automatic Build System <autodist@mambasoft.it> 2.60.1-1mamba
- automatic version update by autodist
* Fri Jun 16 2023 Automatic Build System <autodist@mambasoft.it> 2.60-1mamba
- automatic version update by autodist
* Sat May 27 2023 Automatic Build System <autodist@mambasoft.it> 2.59.5-1mamba
- automatic version update by autodist
* Fri May 12 2023 Automatic Build System <autodist@mambasoft.it> 2.59.4-1mamba
- automatic version update by autodist
* Thu Mar 30 2023 Automatic Build System <autodist@mambasoft.it> 2.59.1-1mamba
- automatic version update by autodist
* Sat Feb 25 2023 Automatic Build System <autodist@mambasoft.it> 2.58.3-1mamba
- automatic version update by autodist
* Thu Jan 26 2023 Automatic Build System <autodist@mambasoft.it> 2.58.2-1mamba
- automatic version update by autodist
* Tue Jan 24 2023 Automatic Build System <autodist@mambasoft.it> 2.58.1-1mamba
- automatic version update by autodist
* Sun Dec 04 2022 Automatic Build System <autodist@mambasoft.it> 2.58-1mamba
- automatic version update by autodist
* Thu Oct 27 2022 Automatic Build System <autodist@mambasoft.it> 2.57.5-1mamba
- automatic version update by autodist
* Tue Oct 04 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 2.57.4-3mamba
- add patch to support alternate SNAP_MOUNT_DIR in openmamba
* Sat Oct 01 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 2.57.4-2mamba
- fix libexec dir
* Fri Sep 30 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 2.57.4-1mamba
- package created using the webbuild interface