aboutsummaryrefslogtreecommitdiffstats
path: root/ak820-ctl/doinst.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-02 17:50:44 +0200
committerDanilo M. <danix@danix.xyz>2026-10-02 17:50:44 +0200
commitdadac25a4e0c008cf5821b4d2f7bb6a27e9528f1 (patch)
tree21f9055a38a7bfad71deb313691ff2299b4557cf /ak820-ctl/doinst.sh
parent0c5f4df2088d1d132ee38aa4c75727d86daf9c48 (diff)
downloadmy-slackbuilds-dadac25a4e0c008cf5821b4d2f7bb6a27e9528f1.tar.gz
my-slackbuilds-dadac25a4e0c008cf5821b4d2f7bb6a27e9528f1.zip
ak820-ctl: add version 0.1.0+git20260414main
CLI and GUI control software for the Ajazz AK820 Pro keyboard (lighting, sleep timer, clock sync). Upstream has no tags, so the source is pinned to a commit and nvchecker tracks the commit date. Ships a uaccess udev rule for 0c45:8009, a desktop entry for ak820-gui, and rc.ak820-lcd, a Slackware replacement for upstream's systemd unit that runs the lcd subcommand in a restart loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'ak820-ctl/doinst.sh')
-rw-r--r--ak820-ctl/doinst.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/ak820-ctl/doinst.sh b/ak820-ctl/doinst.sh
new file mode 100644
index 0000000..7d36484
--- /dev/null
+++ b/ak820-ctl/doinst.sh
@@ -0,0 +1,34 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.ak820-lcd.new
+
+if [ -z "$ROOT" ] && [ -x /sbin/udevadm ]; then
+ /sbin/udevadm control --reload-rules >/dev/null 2>&1
+ /sbin/udevadm trigger --subsystem-match=usb --subsystem-match=hidraw >/dev/null 2>&1
+fi
+
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi