summaryrefslogtreecommitdiff
path: root/dev-embedded/dfu-programmer/dfu-programmer-1.0.0.ebuild
blob: 9f6025c857fd215b2346a05d58bfa65c29792083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools udev

DESCRIPTION="A Device Firmware Update based USB programmer for Atmel chips"
HOMEPAGE="
	https://dfu-programmer.github.io/
	https://sourceforge.net/projects/dfu-programmer/
	https://github.com/dfu-programmer/dfu-programmer
"

SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm ~arm64"

RDEPEND="
	acct-group/plugdev
	virtual/libusb:1
	virtual/udev
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

src_prepare() {
	default

	eautoreconf
}

src_install() {
	default

	cat <<-EOF > 70-dfu-programmer.rules
	#
	# do not edit this file, it will be overwritten on update
	#
	EOF
	printf 'SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="%s", MODE="660", GROUP="plugdev", SYMLINK+="dfu-%%n"\n' \
		2ff{a,b,9,7,4,3} >> 70-dfu-programmer.rules

	udev_dorules 70-dfu-programmer.rules
}

pkg_postinst() {
	udev_reload

	elog "To update device firmware as user you must be in the plugdev group:"
	elog
	elog "usermod -aG plugdev <user>"
}

pkg_postrm() {
	udev_reload
}