Skip to content

Commit

Permalink
Devify version 1.1 ebuild done :D
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
  • Loading branch information
lima-limon-inc committed Jul 12, 2023
1 parent caf8232 commit 914dfc2
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 0 deletions.
44 changes: 44 additions & 0 deletions app-misc/devify/devify-1.1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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"
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
}
35 changes: 35 additions & 0 deletions app-misc/devify/files/different-directories-makefile-1.patch
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions app-misc/devify/files/different-directories-script-1.patch
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions app-misc/devify/files/different-path.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 914dfc2

Please sign in to comment.