Add devify package from lemon-lime overlay

This commit is contained in:
Sravan Balaji
2024-05-13 07:40:04 -04:00
parent 953a69b75c
commit f4d7775756
5 changed files with 175 additions and 0 deletions

1
app-misc/devify/Manifest Normal file
View File

@ -0,0 +1 @@
DIST V1.1.tar.gz 96160 BLAKE2B 1381c7f3abdc5d2c19f3a058cc8efd4ab71753787219f3e36ed6c71402d9d16c0bfb148e5b9e19f37b6dc0e1fd621dede6203dcfb0055ecb0b344fc31c5c9c8c SHA512 c8181f50fd84770302f5e995def2c0ee28ee2ced60b22799cb66f67d051f64c19363ec5546aa18beb383c3858a0b5f159611d8fd80972b55e7ac2fb4c9c7ae9c

View File

@ -0,0 +1,47 @@
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit udev
DESCRIPTION="Device notification system using udev rules for monitoring connections"
HOMEPAGE="https://github.com/pog102/devify"
# if [[ ${PV} == 9999 ]] ; then
# EGIT_REPO_URI="https://github.com/pog102/devify.git"
# EGIT_BRANCH="main"
# inherit git-r3
# else
SRC_URI="https://github.com/pog102/devify/archive/refs/tags/V${PV}.tar.gz"
# fi
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
DEPEND="
x11-libs/libnotify
media-libs/libcanberra
"
RDEPEND="${DEPEND}"
BDEPEND=""
PATCHES=(
"${FILESDIR}/different-directories-makefile-1.patch"
"${FILESDIR}/different-directories-script-1.patch"
"${FILESDIR}/different-path.patch"
)
pkg_postinst() {
udev_reload
elog "Besides changing directory destinations, the ebuild also"
elog "changes one thing about the script. Instead of using"
elog "DBUS_SESSION_BUS_ADDRESS it uses DISPLAY."
elog "Without it, it would not work in my machine. If it leads"
elog "to unintended behavior, leave and issue on the lemon-lime-overlay"
elog "Cheers!"
}
pkg_postrm() {
udev_reload
}

View File

@ -0,0 +1,35 @@
diff --git a/Makefile b/Makefile
index e48f96a..e044fb5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
TARGET = devify
-PREFIX ?= /usr/local
+PREFIX ?= /usr
INSTALL = install -Dm755
RM ?= rm -f
-DESTINATIONUDEV = $(DESTDIR)/usr/lib/udev/rules.d/
+DESTINATIONUDEV = $(DESTDIR)/lib/udev/rules.d/
DESTINATIONBIN = $(DESTDIR)$(PREFIX)/bin/
@@ -14,7 +14,7 @@ install: $(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/bin
$(INSTALL) $(TARGET) $(DESTINATIONBIN)$(TARGET)
- install -Dm644 devify.rules $(DESTINATIONUDEV)99-devify.rules
+ install -Dm644 devify.rules $(DESTINATIONUDEV)60-devify.rules
mkdir -p $(DESTDIR)$(PREFIX)/share/icons
install -d $(DESTDIR)$(PREFIX)/share/icons/MonoDev
install -d $(DESTDIR)$(PREFIX)/share/sounds/MonoDev
@@ -26,7 +26,7 @@ uninstall: $(TARGET)
rm $(DESTINATIONBIN)$(TARGET)
rm -rf $(DESTDIR)$(PREFIX)/share/icons/MonoDev
rm -rf $(DESTDIR)$(PREFIX)/share/sounds/MonoDev
- rm $(DESTINATIONUDEV)99-devify.rules
+ rm $(DESTINATIONUDEV)60-devify.rules
clean:
$(RM) ./devify

View File

@ -0,0 +1,28 @@
diff --git a/devify b/devify
index e65d3a4..e8c701b 100755
--- a/devify
+++ b/devify
@@ -10,18 +10,18 @@ else
fi
status=$2
-icon_pack=/usr/local/share/icons/MonoDev
-sound_pack=/usr/local/share/sounds/MonoDev
+icon_pack=/usr/share/icons/MonoDev
+sound_pack=/usr/share/sounds/MonoDev
user=$(who | head -n 1 | awk '{print $1}')
uid=$( id -u "$user" )
wal_dir=/home/$user/.cache/wal/colors
icon_color=$(grep -oP '#.*([A-Za-z]|[0-9])' $icon_pack/main_color.svg)
POWER_ADAPTER_STATUS="/var/run/devify_power_adapter_status"
-DBUS_SESSION_BUS_ADDRESS=unix:path="/run/user/$uid/bus"
-export DBUS_SESSION_BUS_ADDRESS
+# DBUS_SESSION_BUS_ADDRESS=unix:path="/run/user/$uid/bus"
+# export DBUS_SESSION_BUS_ADDRESS
# required by Libcanberra
-XDG_RUNTIME_DIR=/run/user/$uid
+# XDG_RUNTIME_DIR=/run/user/$uid
export XDG_RUNTIME_DIR
export DISPLAY=:0
export WAYLAND_DISPLAY=wayland-0

View File

@ -0,0 +1,64 @@
diff --git a/devify.rules b/devify.rules
index 2edc354..d8ebda9 100644
--- a/devify.rules
+++ b/devify.rules
@@ -1,5 +1,5 @@
SUBSYSTEM=="hid", ACTION=="add|remove", \
-RUN+="/usr/local/bin/devify \"$env{HID_NAME}\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"$env{HID_NAME}\" \"$env{ACTION}\"", GOTO="end_lookup"
# These are for xbox controller that, for some reason* don't use the hid
# SUBSYSTEM, but rather the input SUBSYSTEM
@@ -9,42 +9,42 @@ RUN+="/usr/local/bin/devify \"$env{HID_NAME}\" \"$env{ACTION}\"", GOTO="end_look
# prevent repeated notificatios, also for some reason NAME doesn't work here
# so use ID_MODEL
ACTION=="add|remove", SUBSYSTEM=="input", ENV{ID_TYPE}!="hid", \
-RUN+="/usr/local/bin/devify \"$env{ID_MODEL}\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"$env{ID_MODEL}\" \"$env{ACTION}\"", GOTO="end_lookup"
# Removable drive
ACTION=="add|remove", SUBSYSTEM=="block", ENV{DEVNAME}=="/dev/sd?", \
-RUN+="/usr/local/bin/devify \"removable_drive:$env{ID_MODEL} ($env{ID_VENDOR})\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"removable_drive:$env{ID_MODEL} ($env{ID_VENDOR})\" \"$env{ACTION}\"", GOTO="end_lookup"
# Android device
ACTION=="add|remove", SUBSYSTEM=="usb", ENV{DEVLINKS}=="*android_adb*|*android_fastboot*", \
-RUN+="/usr/local/bin/devify \"android_device:$env{ID_MODEL} ($env{ID_VENDOR})\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"android_device:$env{ID_MODEL} ($env{ID_VENDOR})\" \"$env{ACTION}\"", GOTO="end_lookup"
# USB serial device, those tend to have some random numeric NAMEs so
# use database info instead, tested with Arduino and PIC K150 Programmer
ACTION=="add|remove", SUBSYSTEM=="tty", ENV{DEVLINKS}=="/dev/serial*", \
-RUN+="/usr/local/bin/devify \"serial_device:$env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"serial_device:$env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" \"$env{ACTION}\"", GOTO="end_lookup"
# Power adapter
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", ENV{POWER_SUPPLY_TYPE}=="Mains", ACTION=="change", \
-RUN+="/usr/local/bin/devify \"power_adapter:Power Adapter ($env{POWER_SUPPLY_NAME})\" add", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"power_adapter:Power Adapter ($env{POWER_SUPPLY_NAME})\" add", GOTO="end_lookup"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", ENV{POWER_SUPPLY_TYPE}=="Mains", ACTION=="change", \
-RUN+="/usr/local/bin/devify \"power_adapter:Power Adapter ($env{POWER_SUPPLY_NAME})\" remove", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"power_adapter:Power Adapter ($env{POWER_SUPPLY_NAME})\" remove", GOTO="end_lookup"
# # Sound cards
ACTION=="remove", SUBSYSTEM=="sound", ENV{SOUND_INITIALIZED}=="1", \
-RUN+="/usr/local/bin/devify \"sound_card:$env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"sound_card:$env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" \"$env{ACTION}\"", GOTO="end_lookup"
ACTION=="change", SUBSYSTEM=="sound", ENV{SOUND_INITIALIZED}=="1", \
-RUN+="/usr/local/bin/devify \"sound_card:$env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" add", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"sound_card:$env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" add", GOTO="end_lookup"
# Network adapters / usb thethering
# Devices not in db
ACTION=="add|remove", SUBSYSTEM=="net", ENV{ID_MODEL}!="", \
-RUN+="/usr/local/bin/devify \"network_adapter:Network adapter - $env{ID_MODEL} ($env{ID_VENDOR})\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"network_adapter:Network adapter - $env{ID_MODEL} ($env{ID_VENDOR})\" \"$env{ACTION}\"", GOTO="end_lookup"
# Devices in db (most on board controllers fall in this category)
ACTION=="add|remove", SUBSYSTEM=="net", ENV{ID_MODEL}=="", \
-RUN+="/usr/local/bin/devify \"network_adapter:Network adapter - $env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" \"$env{ACTION}\"", GOTO="end_lookup"
+RUN+="/usr/bin/devify \"network_adapter:Network adapter - $env{ID_MODEL_FROM_DATABASE} ($env{ID_VENDOR_FROM_DATABASE})\" \"$env{ACTION}\"", GOTO="end_lookup"
# Try to avoid matching more than one rule per udev event
# Calling GOTO="end_lookup" in each rule