<commit_before>DESCRIPTION = "Dreambox second stage bootloader"
SECTION = "base"
PRIORITY = "required"
MAINTAINER = "<NAME> <<EMAIL>>"
PV_dm7020 = "35"
PV_dm7025 = "61"
PV_dm600pvr = "66"
PV_dm500plus = "66"
PV_dm8000 = "70"
PV_dm800 = "70"
PR = "r0"

SRC_URI = "http://sources.dreamboxupdate.com/download/7020/secondstage-${MACHINE}-${PV}.bin"

SECONDSTAGE_UPDATE_SRC = "http://sources.dreamboxupdate.com/download/7020/secondstage-${MACHINE}-${PV}.nfi \
	http://sources.dreamboxupdate.com/download/7020/writenfi-${MACHINE}-r0"

SRC_URI_append_dm8000 = " ${SECONDSTAGE_UPDATE_SRC}"
SRC_URI_append_dm800 = " ${SECONDSTAGE_UPDATE_SRC}"

S = "${WORKDIR}"

do_stage() {
	install -d ${STAGING_LIBDIR}/dreambox-secondstage
	gzip -c ${S}/secondstage-${MACHINE}-${PV}.bin > ${STAGING_LIBDIR}/dreambox-secondstage/main.bin.gz
}

# the dm{800,8000} secondstage is already compressed (and encrypted)

do_stage_dm8000() {
	install -d ${STAGING_LIBDIR}/dreambox-secondstage
	cp ${S}/secondstage-${MACHINE}-${PV}.bin ${STAGING_LIBDIR}/dreambox-secondstage/main.bin.gz
}

do_install_dm8000() {
	install -d ${D}/tmp
	install ${WORKDIR}/secondstage-${MACHINE}-${PV}.nfi ${D}/tmp/secondstage.nfi
	install -m 0755 ${WORKDIR}/writenfi-${MACHINE}-r0 ${D}/tmp/writenfi
}

do_stage_dm800() {
	do_stage_dm8000
}

do_install_dm800() {
	do_install_dm8000
}

FILES_${PN} = "/tmp"
PACKAGE_ARCH := "${MACHINE_ARCH}"

pkg_postinst() {<commit_msg>dreambox-secondstage: forward-port "fix dm800 secondstage update breakage, introduce unified writenfi"<commit_after>DESCRIPTION = "Dreambox second stage bootloader"
SECTION = "base"
PRIORITY = "required"
MAINTAINER = "<NAME> <<EMAIL>>"
PV_dm7020 = "35"
PV_dm7025 = "61"
PV_dm600pvr = "66"
PV_dm500plus = "66"
PV_dm8000 = "70"
PV_dm800 = "70"
PR = "r1"

SRC_URI = "http://sources.dreamboxupdate.com/download/7020/secondstage-${MACHINE}-${PV}.bin"

SECONDSTAGE_UPDATE_SRC = "http://sources.dreamboxupdate.com/download/7020/secondstage-${MACHINE}-${PV}.nfi \
	http://sources.dreamboxupdate.com/download/7020/writenfi-r1"

SRC_URI_append_dm8000 = " ${SECONDSTAGE_UPDATE_SRC}"
SRC_URI_append_dm800 = " ${SECONDSTAGE_UPDATE_SRC}"

S = "${WORKDIR}"

do_stage() {
	install -d ${STAGING_LIBDIR}/dreambox-secondstage
	gzip -c ${S}/secondstage-${MACHINE}-${PV}.bin > ${STAGING_LIBDIR}/dreambox-secondstage/main.bin.gz
}

# the dm{800,8000} secondstage is already compressed (and encrypted)

do_stage_dm8000() {
	install -d ${STAGING_LIBDIR}/dreambox-secondstage
	cp ${S}/secondstage-${MACHINE}-${PV}.bin ${STAGING_LIBDIR}/dreambox-secondstage/main.bin.gz
}

do_install_dm8000() {
	install -d ${D}/tmp
	install ${WORKDIR}/secondstage-${MACHINE}-${PV}.nfi ${D}/tmp/secondstage.nfi
	install -m 0755 ${WORKDIR}/writenfi-r1 ${D}/tmp/writenfi
}

do_stage_dm800() {
	do_stage_dm8000
}

do_install_dm800() {
	do_install_dm8000
}

FILES_${PN} = "/tmp"
PACKAGE_ARCH := "${MACHINE_ARCH}"

pkg_postinst() {
{'fraction_non_alphanumeric': 0.1731631597102449, 'fraction_numerical': 0.06174542945843394, 'mean_word_length': 5.839622641509434, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1356496', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1206, 'n_words': 171}