Skip to content

Commit

Permalink
workaround: postinst has been hardcoded due to config.txt edition issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eljuguetero committed Nov 28, 2019
1 parent 0010caf commit 8e0f8a9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand All @@ -31,16 +32,16 @@ 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
- export COMPONENT=$([ "${DRONE_BUILD_EVENT}" = "tag" ] && echo "main" || echo "unstable")
- 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
Expand All @@ -50,7 +51,7 @@ pipeline:
--secret-access-key $${AWS_SECRET_ACCESS_KEY}
--sign [email protected]
--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
Expand Down
34 changes: 34 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8e0f8a9

Please sign in to comment.