aboutsummaryrefslogtreecommitdiffstats
path: root/community/cloud-init/APKBUILD
blob: 8233de4f7d2c8e0fdfe35ab0cf2aaf81422e7340 (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
# 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
pkgver=21.4
pkgrel=1
pkgdesc="Cloud instance init scripts"
url="https://cloud-init.io"
# Dependant package "cloud-utils-growpart" is not available for mips,
# mips64, or s390x so disable these archs for this package too.
arch="noarch !mips !mips64 !s390x"
license="Apache-2.0 OR GPL-3.0-only"
depends="
	blkid
	cloud-utils-growpart
	eudev
	ifupdown-ng
	iproute2-minimal
	logger
	lsblk
	parted
	python3
	py3-configobj
	py3-jinja2
	py3-jsonpatch
	py3-jsonschema
	py3-requests
	py3-yaml
	sfdisk
	sgdisk
	shadow
	tzdata
	"
makedepends="py3-setuptools"
checkdepends="py3-pytest py3-httpretty py3-netifaces bash coreutils grep"
subpackages="$pkgname-doc $pkgname-bash-completion $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-apk-upgrade.patch
	05-add-doas.patch
	06-ssh-fp-debug.patch
	cloud-init-hotplugd
	cloud-init-hotplugd.initd
	cloud-init.logrotate
	interfaces
	setup-cloud-init
	README.Alpine
	"
install="$pkgname.post-install"

# secfixes:
#   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

	# Delete __pycache__ directories containing PYC files
	find "$pkgdir" -name '__pycache__' -type d -print0 | xargs -0 rm -Rf

	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 \
		debian fedora freebsd opensuse photon redhat rhel sles suse ubuntu
	do
		for file in \
			"$pkgdir"/etc/cloud/templates/*."$distro".tmpl
		do
			rm "$file"
		done
	done

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

	# Delete cloud-init modules not relevant to Alpine
	for module in \
		cc_apt_*.py \
		cc_emit_upstart.py \
		cc_fan.py \
		cc_foo.py \
		cc_grub_dpkg.py \
		cc_landscape.py \
		cc_refresh_rmc_and_interface.py \
		cc_reset_rmc.py \
		cc_rh_subscription.py \
		cc_snap.py \
		cc_ssh_import_id.py \
		cc_spacewalk.py \
		cc_ubuntu_advantage.py \
		cc_ubuntu_drivers.py \
		cc_yum_add_repo.py \
		cc_zypper_add_repo.py
	do
		rm "$pkgdir"/usr/lib/python3.*/site-packages/cloudinit/config/$module
	done

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

sha512sums="
d4814042ceaf767f85105aa510d25c75752220f9ad968b35520074366b932c2c09781ad3a63bba8046e53632b45a765bd9f22e3d53a10f4f3dd631f9dbc3cfda  cloud-init-21.4.tar.gz
c14ce3b27c55d1c381e27b2898bb73da8a74c53480d496bdfc87318b69fb612678205ab5a686c1ce703ef5c2c7a8529f629c8f908aeff39524d36870a83c1929  01-oauthlib-remove.patch
cf97b2e2cfbe25cef5e58bf4507ac4240d7a62a396ef600978dc53b103149ffb051028b6da16c2594320898be6b9f9d68e9c3326bb9f3f1633264dd74d7f69e0  02-disable-irrelevant-modules.patch
463d7ca00f576de75444e86d9b32e1452c824a9f2708b624549e7e003b330c96fbc78d44756efd95d1f954fa0633ce0c0b619e798cdb33b8c86799ee07554834  03-hook-hotplug-sh.patch
501e00ad615e1363b3e6a0b68ae98e8d183e3fb087081451aaf254092392e924a600e4b97bc53260d288096dfd2774c0a1d9aa615f3a5fe6794b88013f8b12b2  04-apk-upgrade.patch
076b727428929b26cb315eb8741ce46f588d17a791d63596383cf18a3cca5523df81c5abf4075c59e5879afc595c50103fd8272b5c5884e06bd8c39277217833  05-add-doas.patch
945eead10b4852fc772e673999c6c2cbce38515df4a2cf87c56c57920c7ab90ee802c6d4c49fb5ce238d1338305bb89e4cd31ba36a23baed9e53c786da713f90  06-ssh-fp-debug.patch
2d41ec3c43f3a426b3c59526dbd34e4a6dd73c894dfe4b699a0f302c12cef3eab6c9300eb126010d00310a12843f56e49d0b1a088f320890d51fb905c3375bb7  cloud-init.logrotate
2d7b80fc248ec18f20c4ed2fbe0f8d6ea85ae57a0ece8ecf8a095cf910c576807c19ab0453c00160b85253df5725cba90abec731cb54f441a509611115519b46  cloud-init-hotplugd
ab44fc51979a5da8569b08ed2f290a6610de6c36cf147af20f30e9224847623d3594c056a1f64c614598ac130e9bec92d566fb901024f806b768a89190c45f59  cloud-init-hotplugd.initd
48b25ec4457c2b3772a7d210033551d041749a0d1869818d888030e6df7fd9bbc13a38b95cf465de3d46d96881a722f94a337584ce48f280c4a52b819586563a  interfaces
f32b90f26d1df0d88fbea7a1a9ab6704a20babdb750b933484bb7c4e91cc19a587d4bfbc95489a354003ecd00795d1592e71b4b93eccd41e392bb7170bfebb0e  setup-cloud-init
26ffe32f17cfb1e636c523311faa54c24f864756ccd84595034da8cfcf9fbc9a0d591785ee721e72cee92741a8af456f9f723d217f21f3403583f9c060fd3eae  README.Alpine
"