Skip to content

Commit 8e0f8a9

Browse files
committedNov 28, 2019
workaround: postinst has been hardcoded due to config.txt edition issue
1 parent 0010caf commit 8e0f8a9

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed
 

‎.drone.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pipeline:
1818
commands:
1919
- curl https://apt.matrix.one/doc/apt-key.gpg | apt-key add -
2020
- echo "deb https://apt.matrix.one/raspbian ${CODENAME} main" > /etc/apt/sources.list.d/matrixlabs.list
21+
- apt install -y dkms
2122
- ${UPDATE_CMD}
2223
- debuild -us -uc -b
2324
- mv ../*.deb .
@@ -31,16 +32,16 @@ pipeline:
3132
secrets: [aws_access_key_id, aws_secret_access_key, gpg_key, gpg_pass]
3233
commands:
3334
# Prepare GPG
34-
- echo "$${GPG_KEY}" > /tmp/tmpkey && gpg --import /tmp/tmpkey && rm /tmp/tmpkey
35+
- echo "$${GPG_KEY}" > /tmp/tmpkey && gpg --import --batch /tmp/tmpkey && rm /tmp/tmpkey
3536
- echo "personal-digest-preferences SHA512" >> /root/.gnupg/gpg.conf
3637

3738
# Only TAG events are published to main
3839
- export COMPONENT=$([ "${DRONE_BUILD_EVENT}" = "tag" ] && echo "main" || echo "unstable")
3940
- export PKG_VER=$(dpkg-parsechangelog --show-field Version -ldebian/changelog)
4041

4142
# Upload packages
42-
- mv matrixio-kernel-modules_$${PKG_VER}_armhf.deb
43-
matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_armhf.deb
43+
- mv matrixio-kernel-modules_$${PKG_VER}_all.deb
44+
matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_all.deb
4445

4546
- echo "$${GPG_PASS}" | deb-s3 upload --bucket apt.matrix.one
4647
--prefix $DISTRIBUTION
@@ -50,7 +51,7 @@ pipeline:
5051
--secret-access-key $${AWS_SECRET_ACCESS_KEY}
5152
--sign info@matrix.one
5253
--gpg-options="--batch --passphrase-fd 0"
53-
matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_armhf.deb
54+
matrixio-kernel-modules_${DISTRIBUTION}-${CODENAME}-$${PKG_VER}-$${COMPONENT}_all.deb
5455

5556
# Render the notification template for the notify-slack step
5657
- j2 --var-delimiter '%%' .drone/slack.tpl > notification.tpl

‎debian/postinst

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
set -e
3+
4+
DKMS_NAME=matrixio-kernel-modules
5+
DKMS_PACKAGE_NAME=$DKMS_NAME-dkms
6+
DKMS_VERSION=0.2.1
7+
8+
postinst_found=0
9+
10+
case "$1" in
11+
configure)
12+
for DKMS_POSTINST in /usr/lib/dkms/common.postinst /usr/share/$DKMS_PACKAGE_NAME/postinst; do
13+
if [ -f $DKMS_POSTINST ]; then
14+
$DKMS_POSTINST $DKMS_NAME $DKMS_VERSION /usr/share/$DKMS_PACKAGE_NAME "" $2
15+
postinst_found=1
16+
break
17+
fi
18+
done
19+
if [ "$postinst_found" -eq 0 ]; then
20+
echo "ERROR: DKMS version is too old and $DKMS_PACKAGE_NAME was not"
21+
echo "built with legacy DKMS support."
22+
echo "You must either rebuild $DKMS_PACKAGE_NAME with legacy postinst"
23+
echo "support or upgrade DKMS to a more current version."
24+
exit 1
25+
else
26+
echo "Enable configurations in /boot/config.txt"
27+
cp /boot/config.txt /boot/config.txt.matrixio.bk \
28+
&& /usr/share/matrixlabs/matrixio-devices/matrixlabs_edit_settings.py \
29+
/boot/config.txt.matrixio.bk \
30+
/usr/share/matrixlabs/matrixio-devices/config/kernel_modifications.txt > /boot/config.txt
31+
fi
32+
;;
33+
esac
34+

0 commit comments

Comments
 (0)
Please sign in to comment.