Commit 8c74c980 authored by Dermot Bradley's avatar Dermot Bradley Committed by Ariadne Conill
Browse files

testing/cloud-init: Add post-install script

Add post-install script to setup init.d services and enable udev.
Add lsblk and util-linux to dependancies.
Add a patch to remove a debug line that appears on console during boot.
Add README.Alpine to docs package.
Prevent any pyc files from being packaged.
parent ee481428
From: Dermot Bradley <dermot_bradley@yahoo.com>
Date: Thu, 4 Sep 2020 14:51 +0100
Subject: [PATCH] cloud-init: Prevent debug output line appearing on console
During boot a debug lines appears on the console, this appears to be been
mistakenly added to the upstream code.
This patch removes the debug line. This change has already been applied
upstream, therefore this patch can be removed upon the next upstream release.
---
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2490,7 +2490,6 @@
LOG.debug("dmidata is not supported on %s", uname_arch)
return None
- print("hi, now its: %s\n", subp)
dmidecode_path = subp.which('dmidecode')
if dmidecode_path:
return _call_dmidecode(key, dmidecode_path)
......@@ -3,7 +3,7 @@
# Maintainer: Dermot Bradley <dermot_bradley@yahoo.com>
pkgname=cloud-init
pkgver=20.3
pkgrel=0
pkgrel=1
pkgdesc="Cloud instance init scripts"
url="https://cloud-init.io"
# Dependant package "cloud-utils-growpart" is not available for mips,
......@@ -17,6 +17,7 @@ depends="
eudev
ifupdown-ng
iproute2-minimal
lsblk
python3
py3-configobj
py3-jinja2
......@@ -28,12 +29,16 @@ depends="
py3-yaml
shadow
sudo
util-linux
"
makedepends="py3-setuptools"
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-remove-debug-line.patch
interfaces
README.Alpine
"
install="$pkgname-openrc.post-install"
prepare() {
default_prepare
......@@ -51,6 +56,9 @@ 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 | xargs rm -Rf
mkdir -p \
"$pkgdir"/etc/network
install -m644 \
......@@ -72,5 +80,17 @@ package() {
rm "$pkgdir"/etc/cloud/templates/timesyncd.conf.tmpl
}
doc() {
mkdir -p "$subpkgdir"/usr/share/doc/"$pkgname"/
amove usr/share/doc/"$pkgname"
install -m644 \
"$srcdir"/README.Alpine \
"$subpkgdir"/usr/share/doc/"$pkgname"/
}
sha512sums="10008710f1876538dab445b07e768953adf8ee31c8848bdf4c95201d6bc894b15ed042e7c90b2cf59491c9dc4b163f64d2be275fbd954f52cb6e4bf37b8e227b cloud-init-20.3.tar.gz
48b25ec4457c2b3772a7d210033551d041749a0d1869818d888030e6df7fd9bbc13a38b95cf465de3d46d96881a722f94a337584ce48f280c4a52b819586563a interfaces"
6f0e5c93c3136e3b06f6cfe71bb3160a800a681fa7ebb9aaf551b33fcfb5ac25cf24588c147e1d99e9b361482a8e6cedf4ff3a91d5b6b52e160c456a7033a77a 01-remove-debug-line.patch
48b25ec4457c2b3772a7d210033551d041749a0d1869818d888030e6df7fd9bbc13a38b95cf465de3d46d96881a722f94a337584ce48f280c4a52b819586563a interfaces
14a5f93b320b97aec8da6c043c07926b4a5591f6ad887e41e70de8aee732ae03914851af1e141ec958e15ece6ad1f7afb44646aafc505b94a29fd291b6d54083 README.Alpine"
When the cloud-init package is installed it will enable its init.d services
so that they are run upon future boots/reboots. It also enables eudev's
init.d services as udev is used by cloud-init for both disk configuration and
network card persistent naming.
NTP
---
It is recommended that you enable a NTP client on the machine. Cloud-init
supports both Chrony (fully featured) and Busybox's NTP client (a minimal
implementation).
Chrony is the default NTP client in cloud-init for Alpine Linux.
To use Chrony as the NTP client:
Install the chrony package and enable the chrony init.d service
# apk add chrony
# rc-update add chronyd default
Specify a ntp section in your cloud-init User Data like so:
ntp:
pool:
- 0.uk.pool.ntp.org
- 1.uk.pool.ntp.org
If you do not specify any pool or servers then 0.pool.ntp.org ->
3.pool.ntp.org will be used.
The file /etc/cloud/templates/chrony.conf.alpine.tmpl is used by cloud-init
as a template to create the configuration file /etc/chrony/chrony.conf.
To use Busybox as the NTP client:
Edit the /etc/conf.d/ntpd file and change the line:
NTPD_OPTS="-N -p pool.ntp.org"
so that it is instead:
NTPD_OPTS="-N"
This changes the NTP client from using the hardcoded NTP server
"pool.ntp.org" to instead use the /etc/ntp.conf file which will be
generated by cloud-init upon first boot.
Enable the ntp init.d service:
# rc-update add ntpd default
Specify a ntp section in your cloud-init User Data like so:
ntp:
ntp_client: ntp
servers:
- 192.168.0.1
- 192.168.0.2
If you do not specify any servers then 0.pool.ntp.org -> 3.pool.ntp.org
will be used.
The file /etc/cloud/templates/ntp.conf.alpine.tmpl is used by cloud-init
as a template to create the configuration file /etc/ntp.conf.
Known Issues
============
cc_ca_certs module
------------------
The remove-defaults option of the cloud-init cc_ca_certs module does not
currently work correctly. This option will delete certificates installed by
the Alpine ca-certificates package as expected. However the certificates
provided by the ca-certificates-bundle package, which is always automatically
installed in an Alpine system due to it being a dependancy of a base package,
are not deleted.
#!/bin/sh
for i in boot/cloud-init-local \
default/cloud-config \
default/cloud-final \
default/cloud-init; do
if ! [ -e /etc/runlevels/$i ]; then
ln -s /etc/init.d/${i#*/} /etc/runlevels/$i
fi
done
# Cloud-init requires udev so enable it also
setup-udev -n
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment