bfc63f
# With Fedora, nothing is bundled. For everything else, bundling is used.
bfc63f
# To use bundled stuff, use "--with vendorized" on rpmbuild
bfc63f
%if 0%{?fedora}
bfc63f
%bcond_with vendorized
bfc63f
%else
bfc63f
%bcond_without vendorized
bfc63f
%endif
bfc63f
c7cced
%global with_devel 1
c7cced
%global with_debug 1
c7cced
%global with_check 0
c7cced
%global with_unit_test 0
bfc63f
71bd7e
# For the moment, we don't support all golang arches...
71bd7e
%global with_goarches 0
71bd7e
bfc63f
%if ! %{with vendorized}
c7cced
%global with_bundled 0
bfc63f
%else
bfc63f
%global with_bundled 1
c7cced
%endif
c7cced
c7cced
%if 0%{?with_debug}
c7cced
%global _dwz_low_mem_die_limit 0
c7cced
%else
c7cced
%global debug_package   %{nil}
c7cced
%endif
c7cced
c7cced
%global provider        github
c7cced
%global provider_tld    com
c7cced
%global project         snapcore
c7cced
%global repo            snapd
c7cced
# https://github.com/snapcore/snapd
c7cced
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
c7cced
%global import_path     %{provider_prefix}
c7cced
bfc63f
%global snappy_svcs     snapd.service snapd.socket snapd.autoimport.service snapd.refresh.timer snapd.refresh.service
c7cced
c7cced
Name:           snapd
4a6082
Version:        2.26.3
da2b24
Release:        3%{?dist}
c7cced
Summary:        A transactional software package manager
bfc63f
Group:          System Environment/Base
c7cced
License:        GPLv3
c7cced
URL:            https://%{provider_prefix}
bfc63f
%if ! 0%{?with_bundled}
c7cced
Source0:        https://%{provider_prefix}/archive/%{version}/%{name}-%{version}.tar.gz
bfc63f
%else
9be007
Source0:        https://%{provider_prefix}/releases/download/%{version}/%{name}_%{version}.vendor.orig.tar.xz
bfc63f
%endif
90c912
# Script to implement certain package management actions
90c912
Source1:        snap-mgmt.sh
aa64e8
9be007
# Upstream proposed PR: https://github.com/snapcore/snapd/pull/3162
9be007
Patch0001:      0001-cmd-use-libtool-for-the-internal-library.patch
4a6082
4a6082
# Temporary patch until properly fixed in 2.27
4a6082
Patch0100:      snapd-2.26.1-interfaces-seccomp-allow-bind-for-Fedora.patch
c7cced
71bd7e
%if 0%{?with_goarches}
c7cced
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
c7cced
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
71bd7e
%else
71bd7e
# Verified arches from snapd upstream
71bd7e
ExclusiveArch:  %{ix86} x86_64 %{arm} aarch64 ppc64le s390x
71bd7e
%endif
71bd7e
c7cced
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
c7cced
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
c7cced
BuildRequires:  systemd
c7cced
%{?systemd_requires}
71bd7e
bfc63f
Requires:       snap-confine%{?_isa} = %{version}-%{release}
c7cced
Requires:       squashfs-tools
c7cced
# we need squashfs.ko loaded
c7cced
Requires:       kmod(squashfs.ko)
9be007
# bash-completion owns /usr/share/bash-completion/completions
9be007
Requires:       bash-completion
c7cced
c7cced
# Force the SELinux module to be installed
c7cced
Requires:       %{name}-selinux = %{version}-%{release}
c7cced
c7cced
%if ! 0%{?with_bundled}
c7cced
BuildRequires: golang(github.com/cheggaaa/pb)
c7cced
BuildRequires: golang(github.com/coreos/go-systemd/activation)
c7cced
BuildRequires: golang(github.com/gorilla/mux)
c7cced
BuildRequires: golang(github.com/jessevdk/go-flags)
c7cced
BuildRequires: golang(github.com/mvo5/uboot-go/uenv)
bfc63f
BuildRequires: golang(github.com/ojii/gettext.go)
bfc63f
BuildRequires: golang(golang.org/x/crypto/openpgp/armor)
bfc63f
BuildRequires: golang(golang.org/x/crypto/openpgp/packet)
bfc63f
BuildRequires: golang(golang.org/x/crypto/sha3)
c7cced
BuildRequires: golang(golang.org/x/crypto/ssh/terminal)
bfc63f
BuildRequires: golang(golang.org/x/net/context)
bfc63f
BuildRequires: golang(golang.org/x/net/context/ctxhttp)
c7cced
BuildRequires: golang(gopkg.in/check.v1)
bfc63f
BuildRequires: golang(gopkg.in/macaroon.v1)
bfc63f
BuildRequires: golang(gopkg.in/mgo.v2/bson)
bfc63f
BuildRequires: golang(gopkg.in/retry.v1)
c7cced
BuildRequires: golang(gopkg.in/tomb.v2)
c7cced
BuildRequires: golang(gopkg.in/yaml.v2)
c7cced
%endif
c7cced
c7cced
%description
f4c706
Snappy is a modern, cross-distribution, transactional package manager
f4c706
designed for working with self-contained, immutable packages.
c7cced
bfc63f
%package -n snap-confine
bfc63f
Summary:        Confinement system for snap applications
bfc63f
License:        GPLv3
bfc63f
Group:          System Environment/Base
bfc63f
BuildRequires:  autoconf
bfc63f
BuildRequires:  automake
bfc63f
BuildRequires:  libtool
bfc63f
BuildRequires:  gcc
90c912
BuildRequires:  gettext
90c912
BuildRequires:  gnupg
bfc63f
BuildRequires:  indent
bfc63f
BuildRequires:  pkgconfig(glib-2.0)
bfc63f
BuildRequires:  pkgconfig(libcap)
bfc63f
BuildRequires:  pkgconfig(libseccomp)
bfc63f
BuildRequires:  pkgconfig(libudev)
bfc63f
BuildRequires:  pkgconfig(systemd)
bfc63f
BuildRequires:  pkgconfig(udev)
bfc63f
BuildRequires:  xfsprogs-devel
bfc63f
BuildRequires:  glibc-static
bfc63f
BuildRequires:  valgrind
bfc63f
BuildRequires:  %{_bindir}/rst2man
c10d36
%if 0%{?fedora} >= 25
c10d36
# ShellCheck in F24 and older doesn't work
bfc63f
BuildRequires:  %{_bindir}/shellcheck
c10d36
%endif
bfc63f
bfc63f
# Ensures older version from split packaging is replaced
bfc63f
Obsoletes:      snap-confine < 2.19
bfc63f
bfc63f
%description -n snap-confine
f4c706
This package is used internally by snapd to apply confinement to
f4c706
the started snap applications.
bfc63f
c7cced
%package selinux
c7cced
Summary:        SELinux module for snapd
bfc63f
Group:          System Environment/Base
c7cced
License:        GPLv2+
c7cced
BuildArch:      noarch
c7cced
BuildRequires:  selinux-policy, selinux-policy-devel
c7cced
Requires(post): selinux-policy-base >= %{_selinux_policy_version}
c7cced
Requires(post): policycoreutils
c7cced
Requires(post): policycoreutils-python-utils
c7cced
Requires(pre):  libselinux-utils
c7cced
Requires(post): libselinux-utils
c7cced
c7cced
%description selinux
f4c706
This package provides the SELinux policy module to ensure snapd
f4c706
runs properly under an environment with SELinux enabled.
c7cced
c7cced
c7cced
%if 0%{?with_devel}
c7cced
%package devel
c7cced
Summary:       %{summary}
c7cced
BuildArch:     noarch
c7cced
c7cced
%if 0%{?with_check} && ! 0%{?with_bundled}
c7cced
%endif
c7cced
bfc63f
%if ! 0%{?with_bundled}
bfc63f
Requires:      golang(github.com/cheggaaa/pb)
bfc63f
Requires:      golang(github.com/coreos/go-systemd/activation)
bfc63f
Requires:      golang(github.com/gorilla/mux)
bfc63f
Requires:      golang(github.com/jessevdk/go-flags)
bfc63f
Requires:      golang(github.com/mvo5/uboot-go/uenv)
bfc63f
Requires:      golang(github.com/ojii/gettext.go)
bfc63f
Requires:      golang(golang.org/x/crypto/openpgp/armor)
bfc63f
Requires:      golang(golang.org/x/crypto/openpgp/packet)
bfc63f
Requires:      golang(golang.org/x/crypto/sha3)
bfc63f
Requires:      golang(golang.org/x/crypto/ssh/terminal)
bfc63f
Requires:      golang(golang.org/x/net/context)
bfc63f
Requires:      golang(golang.org/x/net/context/ctxhttp)
bfc63f
Requires:      golang(gopkg.in/check.v1)
bfc63f
Requires:      golang(gopkg.in/macaroon.v1)
bfc63f
Requires:      golang(gopkg.in/mgo.v2/bson)
bfc63f
Requires:      golang(gopkg.in/retry.v1)
bfc63f
Requires:      golang(gopkg.in/tomb.v2)
bfc63f
Requires:      golang(gopkg.in/yaml.v2)
bfc63f
%else
bfc63f
# These Provides are unversioned because the sources in
bfc63f
# the bundled tarball are unversioned (they go by git commit)
bfc63f
# *sigh*... I hate golang...
bfc63f
Provides:      bundled(golang(github.com/cheggaaa/pb))
bfc63f
Provides:      bundled(golang(github.com/coreos/go-systemd/activation))
bfc63f
Provides:      bundled(golang(github.com/gorilla/mux))
bfc63f
Provides:      bundled(golang(github.com/jessevdk/go-flags))
bfc63f
Provides:      bundled(golang(github.com/mvo5/uboot-go/uenv))
bfc63f
Provides:      bundled(golang(github.com/ojii/gettext.go))
bfc63f
Provides:      bundled(golang(golang.org/x/crypto/openpgp/armor))
bfc63f
Provides:      bundled(golang(golang.org/x/crypto/openpgp/packet))
bfc63f
Provides:      bundled(golang(golang.org/x/crypto/sha3))
bfc63f
Provides:      bundled(golang(golang.org/x/crypto/ssh/terminal))
bfc63f
Provides:      bundled(golang(golang.org/x/net/context))
bfc63f
Provides:      bundled(golang(golang.org/x/net/context/ctxhttp))
bfc63f
Provides:      bundled(golang(gopkg.in/check.v1))
bfc63f
Provides:      bundled(golang(gopkg.in/macaroon.v1))
bfc63f
Provides:      bundled(golang(gopkg.in/mgo.v2/bson))
bfc63f
Provides:      bundled(golang(gopkg.in/retry.v1))
bfc63f
Provides:      bundled(golang(gopkg.in/tomb.v2))
bfc63f
Provides:      bundled(golang(gopkg.in/yaml.v2))
bfc63f
%endif
bfc63f
bfc63f
# Generated by gofed
bfc63f
Provides:      golang(%{import_path}/arch) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/asserts) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/asserts/assertstest) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/asserts/signtool) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/asserts/snapasserts) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/asserts/sysdb) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/asserts/systestkeys) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/boot) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/boot/boottest) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/client) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/cmd) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/daemon) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/dirs) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/errtracker) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/httputil) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/i18n) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/i18n/dumb) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/image) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/apparmor) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/backends) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/builtin) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/dbus) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/ifacetest) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/kmod) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/mount) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/policy) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/seccomp) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/systemd) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/interfaces/udev) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/logger) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/osutil) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/assertstate) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/auth) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/configstate) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/configstate/config) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/devicestate) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/hookstate) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/hookstate/ctlcmd) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/hookstate/hooktest) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/ifacestate) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/patch) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/snapstate) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/snapstate/backend) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/overlord/state) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/partition) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/partition/grubenv) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/progress) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/provisioning) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/release) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/snap) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/snap/snapdir) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/snap/snapenv) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/snap/snaptest) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/snap/squashfs) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/store) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/strutil) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/systemd) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/tests/lib/fakestore/refresh) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/tests/lib/fakestore/store) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/testutil) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/timeout) = %{version}-%{release}
bfc63f
Provides:      golang(%{import_path}/wrappers) = %{version}-%{release}
bfc63f
c7cced
c7cced
%description devel
c7cced
%{summary}
c7cced
c7cced
This package contains library source intended for
c7cced
building other packages which use import path with
c7cced
%{import_path} prefix.
c7cced
%endif
c7cced
c7cced
%if 0%{?with_unit_test} && 0%{?with_devel}
c7cced
%package unit-test-devel
c7cced
Summary:         Unit tests for %{name} package
bfc63f
c7cced
%if 0%{?with_check}
c7cced
#Here comes all BuildRequires: PACKAGE the unit tests
c7cced
#in %%check section need for running
c7cced
%endif
c7cced
bfc63f
%if 0%{?with_check} && ! 0%{?with_bundled}
bfc63f
BuildRequires: golang(github.com/mvo5/goconfigparser)
bfc63f
%endif
bfc63f
bfc63f
%if ! 0%{?with_bundled}
bfc63f
Requires:      golang(github.com/mvo5/goconfigparser)
bfc63f
%else
bfc63f
Provides:      bundled(golang(github.com/mvo5/goconfigparser))
bfc63f
%endif
bfc63f
c7cced
# test subpackage tests code from devel subpackage
c7cced
Requires:        %{name}-devel = %{version}-%{release}
c7cced
c7cced
%description unit-test-devel
c7cced
%{summary}
c7cced
c7cced
This package contains unit tests for project
c7cced
providing packages with %{import_path} prefix.
c7cced
%endif
c7cced
c7cced
%prep
bfc63f
%autosetup -p1
aa64e8
c7cced
c7cced
%build
bfc63f
# Generate version files
bfc63f
./mkversion.sh "%{version}-%{release}"
c7cced
c7cced
# Build snapd
c7cced
mkdir -p src/github.com/snapcore
c7cced
ln -s ../../../ src/github.com/snapcore/snapd
c7cced
c7cced
%if ! 0%{?with_bundled}
c7cced
export GOPATH=$(pwd):%{gopath}
c7cced
%else
c7cced
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
c7cced
%endif
c7cced
c7cced
%gobuild -o bin/snap %{import_path}/cmd/snap
c7cced
%gobuild -o bin/snap-exec %{import_path}/cmd/snap-exec
bfc63f
%gobuild -o bin/snapctl %{import_path}/cmd/snapctl
c7cced
%gobuild -o bin/snapd %{import_path}/cmd/snapd
9be007
%gobuild -o bin/snap-update-ns %{import_path}/cmd/snap-update-ns
c7cced
bfc63f
# Build SELinux module
bfc63f
pushd ./data/selinux
bfc63f
make SHARE="%{_datadir}" TARGETS="snappy"
bfc63f
popd
bfc63f
bfc63f
# Build snap-confine
bfc63f
pushd ./cmd
bfc63f
autoreconf --force --install --verbose
bfc63f
# selinux support is not yet available, for now just disable apparmor
bfc63f
# FIXME: add --enable-caps-over-setuid as soon as possible (setuid discouraged!)
bfc63f
%configure \
bfc63f
    --disable-apparmor \
bfc63f
    --libexecdir=%{_libexecdir}/snapd/ \
bfc63f
    --with-snap-mount-dir=%{_sharedstatedir}/snapd/snap \
bfc63f
    --with-merged-usr
bfc63f
bfc63f
%make_build
bfc63f
popd
bfc63f
bfc63f
# Build systemd units
bfc63f
pushd ./data/systemd
bfc63f
make BINDIR="%{_bindir}" LIBEXECDIR="%{_libexecdir}" \
9be007
     SNAP_MOUNT_DIR="%{_sharedstatedir}/snapd/snap" \
bfc63f
     SNAPD_ENVIRONMENT_FILE="%{_sysconfdir}/sysconfig/snapd"
bfc63f
popd
c7cced
c7cced
%install
c7cced
install -d -p %{buildroot}%{_bindir}
c7cced
install -d -p %{buildroot}%{_libexecdir}/snapd
c7cced
install -d -p %{buildroot}%{_mandir}/man1
c7cced
install -d -p %{buildroot}%{_unitdir}
c7cced
install -d -p %{buildroot}%{_sysconfdir}/profile.d
c7cced
install -d -p %{buildroot}%{_sysconfdir}/sysconfig
c7cced
install -d -p %{buildroot}%{_sharedstatedir}/snapd/assertions
4a6082
install -d -p %{buildroot}%{_sharedstatedir}/snapd/desktop/applications
da2b24
install -d -p %{buildroot}%{_sharedstatedir}/snapd/device
4a6082
install -d -p %{buildroot}%{_sharedstatedir}/snapd/hostfs
c7cced
install -d -p %{buildroot}%{_sharedstatedir}/snapd/mount
4a6082
install -d -p %{buildroot}%{_sharedstatedir}/snapd/seccomp/profiles
c7cced
install -d -p %{buildroot}%{_sharedstatedir}/snapd/snaps
4a6082
install -d -p %{buildroot}%{_sharedstatedir}/snapd/snap/bin
c7cced
install -d -p %{buildroot}%{_localstatedir}/snap
c7cced
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/contrib
c7cced
install -d -p %{buildroot}%{_datadir}/selinux/packages
c7cced
c7cced
# Install snap and snapd
c7cced
install -p -m 0755 bin/snap %{buildroot}%{_bindir}
c7cced
install -p -m 0755 bin/snap-exec %{buildroot}%{_libexecdir}/snapd
bfc63f
install -p -m 0755 bin/snapctl %{buildroot}%{_bindir}/snapctl
c7cced
install -p -m 0755 bin/snapd %{buildroot}%{_libexecdir}/snapd
9be007
install -p -m 0755 bin/snap-update-ns %{buildroot}%{_libexecdir}/snapd
c7cced
bfc63f
# Install SELinux module
bfc63f
install -p -m 0644 data/selinux/snappy.if %{buildroot}%{_datadir}/selinux/devel/include/contrib
bfc63f
install -p -m 0644 data/selinux/snappy.pp.bz2 %{buildroot}%{_datadir}/selinux/packages
bfc63f
c7cced
# Install snap(1) man page
c7cced
bin/snap help --man > %{buildroot}%{_mandir}/man1/snap.1
c7cced
9be007
# Install the "info" data file with snapd version
9be007
install -m 644 -D data/info %{buildroot}%{_libexecdir}/snapd/info
9be007
9be007
# Install bash completion for "snap"
9be007
install -m 644 -D data/completion/snap %{buildroot}%{_datadir}/bash-completion/completions/snap
9be007
bfc63f
# Install snap-confine
bfc63f
pushd ./cmd
bfc63f
%make_install
f4c706
# Undo the 0000 permissions, they are restored in the files section
bfc63f
chmod 0755 %{buildroot}%{_sharedstatedir}/snapd/void
bfc63f
# We don't use AppArmor
bfc63f
rm -rfv %{buildroot}%{_sysconfdir}/apparmor.d
bfc63f
# ubuntu-core-launcher is dead
bfc63f
rm -fv %{buildroot}%{_bindir}/ubuntu-core-launcher
bfc63f
popd
bfc63f
c7cced
# Install all systemd units
bfc63f
pushd ./data/systemd
bfc63f
%make_install SYSTEMDSYSTEMUNITDIR="%{_unitdir}"
bfc63f
# Remove snappy core specific units
bfc63f
rm -fv %{buildroot}%{_unitdir}/snapd.system-shutdown.service
bfc63f
popd
c7cced
c7cced
# Put /var/lib/snapd/snap/bin on PATH
c7cced
# Put /var/lib/snapd/desktop on XDG_DATA_DIRS
c7cced
cat << __SNAPD_SH__ > %{buildroot}%{_sysconfdir}/profile.d/snapd.sh
e631be
PATH=\$PATH:/var/lib/snapd/snap/bin
e631be
if [ -z "\$XDG_DATA_DIRS" ]; then
e631be
    XDG_DATA_DIRS=/usr/share/:/usr/local/share/:/var/lib/snapd/desktop
c7cced
else
e631be
    XDG_DATA_DIRS="\$XDG_DATA_DIRS":/var/lib/snapd/desktop
c7cced
fi
c7cced
export XDG_DATA_DIRS
c7cced
__SNAPD_SH__
c7cced
c7cced
# Disable re-exec by default
c7cced
echo 'SNAP_REEXEC=0' > %{buildroot}%{_sysconfdir}/sysconfig/snapd
c7cced
90c912
# Install snap management script
90c912
install -pm 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/snapd/snap-mgmt
90c912
4a6082
# Create state.json file to be ghosted
4a6082
touch %{buildroot}%{_sharedstatedir}/snapd/state.json
4a6082
c7cced
# source codes for building projects
c7cced
%if 0%{?with_devel}
c7cced
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
c7cced
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
c7cced
# find all *.go but no *_test.go files and generate devel.file-list
90c912
for file in $(find . -iname "*.go" -o -iname "*.s" \! -iname "*_test.go") ; do
c7cced
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
c7cced
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
c7cced
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
c7cced
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
c7cced
done
c7cced
%endif
c7cced
c7cced
# testing files for this project
c7cced
%if 0%{?with_unit_test} && 0%{?with_devel}
c7cced
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
c7cced
# find all *_test.go files and generate unit-test.file-list
c7cced
for file in $(find . -iname "*_test.go"); do
c7cced
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
c7cced
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
c7cced
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
c7cced
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
c7cced
done
90c912
90c912
# Install additional testdata
90c912
install -d %{buildroot}/%{gopath}/src/%{import_path}/cmd/snap/test-data/
90c912
cp -pav cmd/snap/test-data/* %{buildroot}/%{gopath}/src/%{import_path}/cmd/snap/test-data/
90c912
echo "%%{gopath}/src/%%{import_path}/cmd/snap/test-data" >> unit-test-devel.file-list
c7cced
%endif
c7cced
c7cced
%if 0%{?with_devel}
c7cced
sort -u -o devel.file-list devel.file-list
c7cced
%endif
c7cced
c7cced
%check
bfc63f
# snapd tests
c7cced
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
c7cced
%if ! 0%{?with_bundled}
c7cced
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
c7cced
%else
c7cced
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
c7cced
%endif
90c912
%gotest %{import_path}/...
c7cced
%endif
c7cced
bfc63f
# snap-confine tests (these always run!)
bfc63f
pushd ./cmd
bfc63f
make check
bfc63f
popd
c7cced
c7cced
%files
bfc63f
#define license tag if not already defined
bfc63f
%{!?_licensedir:%global license %doc}
90c912
%license COPYING
c7cced
%doc README.md docs/*
c7cced
%{_bindir}/snap
bfc63f
%{_bindir}/snapctl
f4c706
%dir %{_libexecdir}/snapd
f4c706
%{_libexecdir}/snapd/snapd
f4c706
%{_libexecdir}/snapd/snap-exec
9be007
%{_libexecdir}/snapd/info
90c912
%{_libexecdir}/snapd/snap-mgmt
c7cced
%{_mandir}/man1/snap.1*
9be007
%{_datadir}/bash-completion/completions/snap
c7cced
%{_sysconfdir}/profile.d/snapd.sh
c7cced
%{_unitdir}/snapd.socket
c7cced
%{_unitdir}/snapd.service
bfc63f
%{_unitdir}/snapd.autoimport.service
c7cced
%{_unitdir}/snapd.refresh.service
c7cced
%{_unitdir}/snapd.refresh.timer
c7cced
%config(noreplace) %{_sysconfdir}/sysconfig/snapd
c7cced
%dir %{_sharedstatedir}/snapd
c7cced
%dir %{_sharedstatedir}/snapd/assertions
c7cced
%dir %{_sharedstatedir}/snapd/desktop
4a6082
%dir %{_sharedstatedir}/snapd/desktop/applications
da2b24
%dir %{_sharedstatedir}/snapd/device
4a6082
%dir %{_sharedstatedir}/snapd/hostfs
c7cced
%dir %{_sharedstatedir}/snapd/mount
c7cced
%dir %{_sharedstatedir}/snapd/seccomp
4a6082
%dir %{_sharedstatedir}/snapd/seccomp/profiles
c7cced
%dir %{_sharedstatedir}/snapd/snaps
c7cced
%dir %{_sharedstatedir}/snapd/snap
4a6082
%ghost %dir %{_sharedstatedir}/snapd/snap/bin
c7cced
%dir %{_localstatedir}/snap
4a6082
%ghost %{_sharedstatedir}/snapd/state.json
c7cced
bfc63f
%files -n snap-confine
bfc63f
%doc cmd/snap-confine/PORTING
bfc63f
%license COPYING
f4c706
%dir %{_libexecdir}/snapd
bfc63f
# For now, we can't use caps
bfc63f
# FIXME: Switch to "%%attr(0755,root,root) %%caps(cap_sys_admin=pe)" asap!
bfc63f
%attr(4755,root,root) %{_libexecdir}/snapd/snap-confine
bfc63f
%{_libexecdir}/snapd/snap-discard-ns
f4c706
%{_libexecdir}/snapd/snap-update-ns
f4c706
%{_libexecdir}/snapd/system-shutdown
bfc63f
%{_mandir}/man5/snap-confine.5*
bfc63f
%{_mandir}/man5/snap-discard-ns.5*
bfc63f
%{_prefix}/lib/udev/snappy-app-dev
bfc63f
%{_udevrulesdir}/80-snappy-assign.rules
bfc63f
%attr(0000,root,root) %{_sharedstatedir}/snapd/void
bfc63f
bfc63f
bfc63f
%files selinux
bfc63f
%license data/selinux/COPYING
bfc63f
%doc data/selinux/README.md
bfc63f
%{_datadir}/selinux/packages/snappy.pp.bz2
bfc63f
%{_datadir}/selinux/devel/include/contrib/snappy.if
bfc63f
c7cced
%if 0%{?with_devel}
c7cced
%files devel -f devel.file-list
c7cced
%license COPYING
c7cced
%doc README.md
c7cced
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
c7cced
%endif
c7cced
c7cced
%if 0%{?with_unit_test} && 0%{?with_devel}
c7cced
%files unit-test-devel -f unit-test-devel.file-list
c7cced
%license COPYING
c7cced
%doc README.md
c7cced
%endif
c7cced
c7cced
%post
bfc63f
%systemd_post %{snappy_svcs}
62ba86
# If install, test if snapd socket and timer are enabled.
62ba86
# If enabled, then attempt to start them. This will silently fail
62ba86
# in chroots or other environments where services aren't expected
62ba86
# to be started.
62ba86
if [ $1 -eq 1 ] ; then
62ba86
   if systemctl -q is-enabled snapd.socket > /dev/null 2>&1 ; then
62ba86
      systemctl start snapd.socket > /dev/null 2>&1 || :
62ba86
   fi
62ba86
   if systemctl -q is-enabled snapd.refresh.timer > /dev/null 2>&1 ; then
62ba86
      systemctl start snapd.refresh.timer > /dev/null 2>&1 || :
62ba86
   fi
62ba86
fi
c7cced
c7cced
%preun
bfc63f
%systemd_preun %{snappy_svcs}
c7cced
90c912
# Remove all Snappy content if snapd is being fully uninstalled
90c912
if [ $1 -eq 0 ]; then
90c912
   %{_libexecdir}/snapd/snap-mgmt purge || :
90c912
fi
90c912
90c912
c7cced
%postun
bfc63f
%systemd_postun_with_restart %{snappy_svcs}
c7cced
c7cced
%pre selinux
c7cced
%selinux_relabel_pre
c7cced
c7cced
%post selinux
c7cced
%selinux_modules_install %{_datadir}/selinux/packages/snappy.pp.bz2
c7cced
%selinux_relabel_post
c7cced
c7cced
%postun selinux
c7cced
%selinux_modules_uninstall snappy
c7cced
if [ $1 -eq 0 ]; then
c7cced
    %selinux_relabel_post
c7cced
fi
c7cced
c7cced
c7cced
%changelog
da2b24
* Thu May 25 2017 Neal Gompa <ngompa13@gmail.com> - 2.26.3-3
da2b24
- Cover even more stuff for proper erasure on final uninstall (RH#1444422)
da2b24
751790
* Sun May 21 2017 Neal Gompa <ngompa13@gmail.com> - 2.26.3-2
751790
- Fix error in script for removing Snappy content (RH#1444422)
751790
- Adjust changelog bug references to be specific on origin
751790
4a6082
* Wed May 17 2017 Neal Gompa <ngompa13@gmail.com> - 2.26.3-1
4a6082
- Update to snapd 2.26.3
4a6082
- Drop merged and unused patches
751790
- Cover more Snappy content for proper erasure on final uninstall (RH#1444422)
4a6082
- Add temporary fix to ensure generated seccomp profiles don't break snapctl
4a6082
90c912
* Mon May 01 2017 Neal Gompa <ngompa13@gmail.com> - 2.25-1
90c912
- Update to snapd 2.25
751790
- Ensure all Snappy content is gone on final uninstall (RH#1444422)
90c912
9be007
* Tue Apr 11 2017 Neal Gompa <ngompa13@gmail.com> - 2.24-1
9be007
- Update to snapd 2.24
9be007
- Drop merged patches
9be007
- Install snap bash completion and snapd info file
9be007
62ba86
* Wed Apr 05 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.6-4
62ba86
- Test if snapd socket and timer enabled and start them if enabled on install
62ba86
e631be
* Sat Apr 01 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.6-3
e631be
- Fix profile.d generation so that vars aren't expanded in package build
e631be
f4c706
* Fri Mar 31 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.6-2
f4c706
- Fix the overlapping file conflicts between snapd and snap-confine
f4c706
- Rework package descriptions slightly
f4c706
bfc63f
* Thu Mar 30 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.6-1
bfc63f
- Rebase to snapd 2.23.6
bfc63f
- Rediff patches
bfc63f
- Re-enable seccomp
3f78ea
- Fix building snap-confine on 32-bit arches
71bd7e
- Set ExclusiveArch based on upstream supported arch list
bfc63f
bfc63f
* Wed Mar 29 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.5-1
bfc63f
- Rebase to snapd 2.23.5
bfc63f
- Disable seccomp temporarily avoid snap-confine bugs (LP#1674193)
bfc63f
- Use vendorized build for non-Fedora
bfc63f
bfc63f
* Mon Mar 13 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.1-1
bfc63f
- Rebase to snapd 2.23.1
bfc63f
- Add support for vendored tarball for non-Fedora targets
bfc63f
- Use merged in SELinux policy module
bfc63f
8ccd81
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.16-2
8ccd81
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
8ccd81
c7cced
* Wed Oct 19 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.16-1
c7cced
- New upstream release
bfc63f
c7cced
* Tue Oct 18 2016 Neal Gompa <ngompa13@gmail.com> - 2.14-2
c7cced
- Add SELinux policy module subpackage
bfc63f
c7cced
* Tue Aug 30 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.14-1
c7cced
- New upstream release
bfc63f
c7cced
* Tue Aug 23 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.13-1
c7cced
- New upstream release
bfc63f
c7cced
* Thu Aug 18 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.12-2
c7cced
- Correct license identifier
bfc63f
c7cced
* Thu Aug 18 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.12-1
c7cced
- New upstream release
bfc63f
c7cced
* Thu Aug 18 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-8
c7cced
- Add %%dir entries for various snapd directories
c7cced
- Tweak Source0 URL
bfc63f
c7cced
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-7
c7cced
- Disable snapd re-exec feature by default
bfc63f
c7cced
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-6
c7cced
- Don't auto-start snapd.socket and snapd.refresh.timer
bfc63f
c7cced
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-5
c7cced
- Don't touch snapd state on removal
bfc63f
c7cced
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-4
c7cced
- Use ExecStartPre to load squashfs.ko before snapd starts
c7cced
- Use dedicated systemd units for Fedora
bfc63f
c7cced
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-3
c7cced
- Remove systemd preset (will be requested separately according to distribution
c7cced
  standards).
bfc63f
c7cced
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-2
c7cced
- Use Requires: kmod(squashfs.ko) instead of Requires: kernel-modules
bfc63f
c7cced
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-1
c7cced
- New upstream release
c7cced
- Move private executables to /usr/libexec/snapd/
bfc63f
bfc63f
* Fri Jun 24 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.9-2
c7cced
- Depend on kernel-modules to ensure that squashfs can be loaded. Load it afer
c7cced
  installing the package. This hopefully fixes
c7cced
  https://github.com/zyga/snapcore-fedora/issues/2
bfc63f
bfc63f
* Fri Jun 17 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.9
c7cced
- New upstream release
c7cced
  https://github.com/snapcore/snapd/releases/tag/2.0.9
bfc63f
bfc63f
* Tue Jun 14 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.8.1
c7cced
- New upstream release
bfc63f
bfc63f
* Fri Jun 10 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.8
c7cced
- First package for Fedora