aboutsummaryrefslogtreecommitdiffstats
path: root/community/cloud-init/APKBUILD
blob: b89dd4a805cb27bf0bc892a37f6d94dc7c4c94e7 (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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Contributor: Matt Dainty <matt+alpine@bodgit-n-scarper.com>
# Contributor: Dermot Bradley <dermot_bradley@yahoo.com>
# Maintainer: Dermot Bradley <dermot_bradley@yahoo.com>
pkgname=cloud-init
#
# Please do NOT do "drive by" upgrades of this package. I am an active
# participant in upstream cloud-init development and so am well aware of
# when new releases are coming out. If only a few days have passed since an
# upstream release has occurred then it is highly likely that I am *already*
# preparing an Alpine package upgrade.
#
# Similarly I receive advance notification of security fixes/releases from
# upstream and so if a cloud-init security fix has recently been released it
# is high likely I am already aware of it and working on an Alpine package
# update/upgrade.
#
pkgver=22.4
pkgrel=2
pkgdesc="Cloud instance init scripts"
url="https://cloud-init.io"
# Dependant package "cloud-utils-growpart" is not available for
# s390x so disable this arch for this package too.
arch="noarch !s390x"
license="Apache-2.0 OR GPL-3.0-only"
depends="
	blkid
	cloud-utils-growpart
	ifupdown-ng
	iproute2-minimal
	lsblk
	parted
	python3
	py3-configobj
	py3-jinja2
	py3-jsonpatch
	py3-jsonschema
	py3-requests
	py3-yaml
	sfdisk
	sgdisk
	shadow
	tzdata
	"
makedepends="py3-setuptools"
checkdepends="
	bash
	coreutils
	grep
	py3-netifaces
	py3-pytest
	py3-pytest-mock
	py3-responses
	py3-pyserial
	"
subpackages="
	$pkgname-bash-completion
	$pkgname-doc
	$pkgname-openrc
	"
source="cloud-init-$pkgver.tar.gz::https://github.com/canonical/cloud-init/archive/$pkgver.tar.gz
	01-oauthlib-remove.patch
	02-disable-irrelevant-modules.patch
	03-hook-hotplug-sh.patch
	04-add-doas.patch
	cloud-init-hotplugd
	cloud-init-hotplugd.initd
	cloud-init.logrotate
	interfaces
	setup-cloud-init
	README.Alpine
	"
install="$pkgname.post-install"

# secfixes:
#   22.2.2-r0:
#     - CVE-2022-2084
#   21.1-r1:
#     - CVE-2021-3429

prepare() {
	default_prepare
}

build() {
	python3 setup.py build
}

check() {
	python3 -m pytest
}

package() {
	python3 setup.py install \
		--prefix=/usr --root="$pkgdir" --init-system=sysvinit_openrc

	mkdir -p \
		"$pkgdir"/etc/network
	install -m644 \
		"$srcdir"/interfaces \
		"$pkgdir"/etc/network/

	install -m755 \
		-D \
		"$srcdir"/cloud-init-hotplugd.initd \
		"$pkgdir"/etc/init.d/cloud-init-hotplugd

	install -m644 \
		-D \
		"$srcdir"/cloud-init.logrotate \
		"$pkgdir"/etc/logrotate.d/cloud-init

	mkdir -p \
		"$pkgdir"/sbin
	install -m755 \
		"$srcdir"/setup-cloud-init \
		"$pkgdir"/sbin/

	mkdir -p \
		"$pkgdir"/usr/sbin
	install -m755 \
		"$srcdir"/cloud-init-hotplugd \
		"$pkgdir"/usr/sbin/

	install -m644 \
		"$srcdir"/README.Alpine \
		"$pkgdir"/usr/share/doc/"$pkgname"/

	# Delete non-Alpine distribution template files
	for distro in \
		arch centos cos debian fedora freebsd gentoo mariner openbsd \
		opensuse photon redhat rhel sles suse ubuntu
	do
		for file in \
			"$pkgdir"/etc/cloud/templates/*."$distro".tmpl
		do
			rm "$file"
		done
	done

	# Delete non-Alpine os-specific files
	for distro in \
		almalinux amazon arch bsd centos cloudlinux cos debian \
		dragonflybsd eurolinux fedora freebsd gentoo mariner \
		miraclelinux netbsd net_util openEuler openbsd openmandriva \
		opensuse photon rhel rhel_util rocky sles ubuntu virtuozzo
	do
		rm "$pkgdir"/usr/lib/python3.*/site-packages/cloudinit/distros/"$distro".py
		rm "$pkgdir"/usr/lib/python3.*/site-packages/cloudinit/distros/__pycache__/"$distro".*.pyc
	done
	rm "$pkgdir"/usr/lib/python3.*/site-packages/cloudinit/distros/parsers/sys_conf.py
	rm "$pkgdir"/usr/lib/python3.*/site-packages/cloudinit/distros/parsers/__pycache__/sys_conf.*.pyc

	# Delete systemd-related files
	rm \
		"$pkgdir"/etc/cloud/templates/timesyncd.conf.tmpl \
		"$pkgdir"/etc/cloud/templates/systemd.resolved.conf.tmpl
	rm -Rf "$pkgdir"/etc/systemd

	# Delete NetworkManager-related files
	rm -Rf "$pkgdir"/etc/NetworkManager

	# Delete cloud-init modules not relevant to Alpine
	for module in \
		apt_* \
		byobu \
		fan \
		grub_dpkg \
		keyboard \
		landscape \
		lxd \
		refresh_rmc_and_interface \
		reset_rmc \
		rh_subscription \
		snap \
		spacewalk \
		ssh_import_id \
		ubuntu_advantage \
		ubuntu_autoinstall \
		ubuntu_drivers \
		wireguard \
		yum_add_repo \
		zypper_add_repo
	do
		rm "$pkgdir"/usr/lib/python3.*/site-packages/cloudinit/config/cc_$module.py
		rm "$pkgdir"/usr/lib/python3.*/site-packages/cloudinit/config/__pycache__/cc_$module.*.pyc
	done

	# Delete cloud-init docs not relevant to Alpine
	for doc in \
		cloud-config-add-apt-repos.txt \
		cloud-config-apt.txt \
		cloud-config-update-apt.txt \
		cloud-config-yum-repo.txt
	do
		rm "$pkgdir"/usr/share/doc/cloud-init/examples/$doc
	done
}

sha512sums="
a3385316ecce1f7f351d6e90c308aaa0d17eae1827625d97f815431ee86acc35d9e94608262dc7bcd6c9d640d09fd3a02ab99a6bf4b2f248bab59ad1264d8ac1  cloud-init-22.4.tar.gz
c14ce3b27c55d1c381e27b2898bb73da8a74c53480d496bdfc87318b69fb612678205ab5a686c1ce703ef5c2c7a8529f629c8f908aeff39524d36870a83c1929  01-oauthlib-remove.patch
16833181bdb1f0f98bb7cb3037ada035c0cd9f1a1a9ff58fe48a6bd8cbfbd9c2adbbeec9d0e1e92686f4902d3b798ef5e487147db15749f316d63c4a0fb1a3d5  02-disable-irrelevant-modules.patch
463d7ca00f576de75444e86d9b32e1452c824a9f2708b624549e7e003b330c96fbc78d44756efd95d1f954fa0633ce0c0b619e798cdb33b8c86799ee07554834  03-hook-hotplug-sh.patch
adc410bf3a311fe7509825e4287e8fdda08a9bca5b6060036e8b1fffc58e3efa9aba0db4a8d3939f5ddac25cab1345af0db0798bbb5c608154d1feb586a7b424  04-add-doas.patch
3c6c5189859633012fd389a8d8370cbd46ddd07f206d61bcf872f12105f340552073cbf28f28096109c158b641de1c8199afcfc7f751166a27d4089355e1dd7d  cloud-init.logrotate
2d7b80fc248ec18f20c4ed2fbe0f8d6ea85ae57a0ece8ecf8a095cf910c576807c19ab0453c00160b85253df5725cba90abec731cb54f441a509611115519b46  cloud-init-hotplugd
ab44fc51979a5da8569b08ed2f290a6610de6c36cf147af20f30e9224847623d3594c056a1f64c614598ac130e9bec92d566fb901024f806b768a89190c45f59  cloud-init-hotplugd.initd
48b25ec4457c2b3772a7d210033551d041749a0d1869818d888030e6df7fd9bbc13a38b95cf465de3d46d96881a722f94a337584ce48f280c4a52b819586563a  interfaces
9340e30b6c95f66cb2cdc68c0c5d765e4ce879d2f2bfb042c4b45996cf2b5c542b3762c6abfd213b4b9610f290d6ca734c28c7240fea76fb5cf58253570d2e8f  setup-cloud-init
6d0ea580030e900a67bc4d94be9fa69899155b1725af3a6701f43874de73656bfc2a5ddfad03a1ef8969a80e6e7c88546cca2987fde4f4049b391ee69bc774f0  README.Alpine
"