blob: 0efa21813343fd996db0dcd597a41c81b452474b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# Maintainer: aimileus <me at aimileus dot nl>
# Maintainer: Maciej Borzecki <maciek.borzecki@gmail.com>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Zygmunt Krynicki <me at zygoon dot pl>
pkgname=snapd
pkgdesc="Service and tools for management of snap packages."
depends=('squashfs-tools' 'libseccomp' 'libsystemd' 'apparmor')
optdepends=('bash-completion: bash completion support'
'xdg-desktop-portal: desktop integration')
pkgver=2.65.1
pkgrel=1
arch=('x86_64' 'i686' 'armv7h' 'aarch64')
url="https://github.com/snapcore/snapd"
license=('GPL3')
makedepends=('git' 'go' 'go-tools' 'libseccomp' 'libcap' 'systemd' 'xfsprogs' 'python-docutils' 'apparmor' 'autoconf-archive')
conflicts=('snap-confine')
options=('!strip' 'emptydirs' '!lto')
install=snapd.install
source=(
"$pkgname-$pkgver.tar.xz::https://github.com/snapcore/${pkgname}/releases/download/${pkgver}/${pkgname}_${pkgver}.vendor.tar.xz"
)
sha256sums=(
'826f8fa8021400326c7be40ea2d45c2d3f80288b41effba21cd5677fde5c2db0'
)
prepare() {
cd "$pkgname-$pkgver"
for name in "${source[@]}"; do
if [[ "${name%.patch}" == "$name" ]]; then
# not a patch
continue
fi
msg2 "applying $name"
patch -p1 -i "$srcdir/$name"
done
}
build() {
cd "$pkgname-$pkgver"
unset GO111MODULE
export CGO_ENABLED="1"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
# Generate snapd.defines.mk, this file is included by snapd.mk.
cat >"$srcdir/snapd.defines.mk" <<__DEFINES__
# This file is generated by snapd packaging
# Directory variables.
prefix = /usr
bindir = /usr/bin
sbindir = /usr/sbin
libexecdir = /usr/lib
mandir = /usr/share/man
datadir = /usr/share
localstatedir = /var
sharedstatedir = /var/lib
unitdir = /usr/lib/systemd/system
builddir = $srcdir/_go_build
# Build configuration
with_core_bits = 0
with_alt_snap_mount_dir = 1
with_apparmor = 1
with_testkeys = 0
EXTRA_GO_BUILD_FLAGS = -trimpath
EXTRA_GO_LDFLAGS = -w -s
__DEFINES__
./mkversion.sh $pkgver-$pkgrel
make -f packaging/snapd.mk \
SNAPD_DEFINES_DIR="$srcdir"
# Generate data files such as real systemd units, dbus service, environment
# setup helpers out of the available templates
make -C data \
BINDIR=/bin \
LIBEXECDIR=/usr/lib \
SYSTEMDSYSTEMUNITDIR=/usr/lib/systemd/system \
SNAP_MOUNT_DIR=/var/lib/snapd/snap \
SNAPD_ENVIRONMENT_FILE=/etc/default/snapd
cd cmd
autoreconf -i -f
./configure \
--prefix=/usr \
--libexecdir=/usr/lib/snapd \
--with-snap-mount-dir=/var/lib/snapd/snap \
--enable-apparmor \
--enable-nvidia-biarch \
--enable-merged-usr
make $MAKEFLAGS
}
check() {
cd "$pkgname-$pkgver"
# make sure the binaries that need to be built statically really are
for binary in snap-exec snap-update-ns snapctl; do
if ! LC_ALL=C ldd "$srcdir/_go_build/$binary" 2>&1 | grep -q 'not a dynamic executable'; then
echo "$binary is not a static binary"
exit 1
fi
done
}
package() {
cd "$pkgname-$pkgver"
# Install bash completion
install -Dm644 data/completion/bash/snap \
"$pkgdir/usr/share/bash-completion/completions/snap"
install -Dm644 data/completion/bash/complete.sh \
"$pkgdir/usr/lib/snapd/complete.sh"
install -Dm644 data/completion/bash/etelpmoc.sh \
"$pkgdir/usr/lib/snapd/etelpmoc.sh"
# Install zsh completion
install -Dm644 data/completion/zsh/_snap \
"$pkgdir/usr/share/zsh/site-functions/_snap"
# Install systemd units, dbus services and a script for environment variables
make -C data/ install \
DBUSSERVICESDIR=/usr/share/dbus-1/services \
BINDIR=/usr/bin \
SYSTEMDSYSTEMUNITDIR=/usr/lib/systemd/system \
SNAP_MOUNT_DIR=/var/lib/snapd/snap \
DESTDIR="$pkgdir"
make -C cmd install DESTDIR="$pkgdir/"
make -f packaging/snapd.mk \
SNAPD_DEFINES_DIR="$srcdir" \
DESTDIR="$pkgdir" \
install
# Install the "info" data file with snapd version
install -m 644 -D "data/info" "$pkgdir/usr/lib/snapd/info"
# these locations are created at runtime but were not part of the packaging
# previously, thus would trigger a file conflict on upgrade
rm -rfv "$pkgdir/var/cache/snapd"
rm -rfv "$pkgdir/var/lib/snapd/snap/README"
rm -rfv "$pkgdir/var/lib/snapd/state.json"
rm -rfv "$pkgdir/var/lib/snapd/system-key"
# Remove snappy core specific units
rm -fv "$pkgdir/usr/lib/snapd/snapd.core-fixup.sh"
rm -fv "$pkgdir/usr/bin/ubuntu-core-launcher"
rm -fv "$pkgdir/usr/lib/snapd/system-shutdown"
# drop the last remaining Ubuntu Core specific service
rm -fv "$pkgdir/usr/lib/systemd/system/snapd.failure.service"
# Remove prompt services
rm -fv "$pkgdir/usr/lib/systemd/system/snapd.aa-prompt-listener.service"
rm -fv "$pkgdir/usr/lib/systemd/user/snapd.aa-prompt-ui.service"
rm -fv "$pkgdir/usr/share/dbus-1/services/io.snapcraft.Prompt.service"
}
|