From 8e0f8a95634c5e717a009fa33c24a4df2968a580 Mon Sep 17 00:00:00 2001 From: Andres Calderon Date: Thu, 28 Nov 2019 16:10:23 +0000 Subject: [PATCH] workaround: postinst has been hardcoded due to config.txt edition issue --- .drone.yml | 9 +++++---- debian/postinst | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100755 debian/postinst diff --git a/.drone.yml b/.drone.yml index 428ebe4..c1a4ecd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,6 +18,7 @@ pipeline: commands: - curl https://apt.matrix.one/doc/apt-key.gpg | apt-key add - - echo "deb https://apt.matrix.one/raspbian ${CODENAME} main" > /etc/apt/sources.list.d/matrixlabs.list + - apt install -y dkms - ${UPDATE_CMD} - debuild -us -uc -b - mv ../*.deb . @@ -31,7 +32,7 @@ pipeline: secrets: [aws_access_key_id, aws_secret_access_key, gpg_key, gpg_pass] commands: # Prepare GPG - - echo "$${GPG_KEY}" > /tmp/tmpkey && gpg --import /tmp/tmpkey && rm /tmp/tmpkey + - echo "$${GPG_KEY}" > /tmp/tmpkey && gpg --import --batch /tmp/tmpkey && rm /tmp/tmpkey - echo "personal-digest-preferences SHA512" >> /root/.gnupg/gpg.conf # Only TAG events are published to main @@ -39,8 +40,8 @@ pipeline: - export PKG_VER=$(dpkg-parsechangelog --show-field Version -ldebian/changelog) # Upload packages - - mv matrixio-kernel-modules_$${PKG_VER}_armhf.deb - matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_armhf.deb + - mv matrixio-kernel-modules_$${PKG_VER}_all.deb + matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_all.deb - echo "$${GPG_PASS}" | deb-s3 upload --bucket apt.matrix.one --prefix $DISTRIBUTION @@ -50,7 +51,7 @@ pipeline: --secret-access-key $${AWS_SECRET_ACCESS_KEY} --sign info@matrix.one --gpg-options="--batch --passphrase-fd 0" - matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_armhf.deb + matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_all.deb # Render the notification template for the notify-slack step - j2 --var-delimiter '%%' .drone/slack.tpl > notification.tpl diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..ac86939 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +DKMS_NAME=matrixio-kernel-modules +DKMS_PACKAGE_NAME=$DKMS_NAME-dkms +DKMS_VERSION=0.2.1 + +postinst_found=0 + +case "$1" in + configure) + for DKMS_POSTINST in /usr/lib/dkms/common.postinst /usr/share/$DKMS_PACKAGE_NAME/postinst; do + if [ -f $DKMS_POSTINST ]; then + $DKMS_POSTINST $DKMS_NAME $DKMS_VERSION /usr/share/$DKMS_PACKAGE_NAME "" $2 + postinst_found=1 + break + fi + done + if [ "$postinst_found" -eq 0 ]; then + echo "ERROR: DKMS version is too old and $DKMS_PACKAGE_NAME was not" + echo "built with legacy DKMS support." + echo "You must either rebuild $DKMS_PACKAGE_NAME with legacy postinst" + echo "support or upgrade DKMS to a more current version." + exit 1 + else + echo "Enable configurations in /boot/config.txt" + cp /boot/config.txt /boot/config.txt.matrixio.bk \ + && /usr/share/matrixlabs/matrixio-devices/matrixlabs_edit_settings.py \ + /boot/config.txt.matrixio.bk \ + /usr/share/matrixlabs/matrixio-devices/config/kernel_modifications.txt > /boot/config.txt + fi + ;; +esac +