summaryrefslogtreecommitdiffstats
path: root/recipes-sota/sota-credentials/sota-credentials.bb
blob: f523f214bedb9418f9ca515c723b55a6b404fc1a (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
SUMMARY = "Deploy SOTA credentials on the defice"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

FILES_${PN} += "${sysconfdir}/sota.toml"

ALLOW_EMPTY_${PN} = "1"

export SOTA_CREDENTIALS

do_install() {
	if [ -n "$SOTA_CREDENTIALS" ]; then
		if [ -f "$SOTA_CREDENTIALS" ]; then
			EXT=`basename $SOTA_CREDENTIALS | cut -d'.' -f2` 
			if [ "$EXT" != "toml" ]; then
				bbwarn "File\'s extension is not \'toml\', make sure you have the correct file"
			fi

			install -d ${D}${sysconfdir}
			cat $SOTA_CREDENTIALS | sed 's/^package_manager = .*$/package_manager = "ostree"/' > ${D}${sysconfdir}/sota.toml
			chmod 644 ${D}${sysconfdir}/sota.toml
		else
			bberror "File $SOTA_CREDENTIALS does not exist"
		fi
	fi
}