diff options
-rw-r--r-- | .SRCINFO | 12 | ||||
-rw-r--r-- | PKGBUILD | 31 | ||||
-rw-r--r-- | usb2host.install | 3 |
3 files changed, 46 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..4f786ebde658 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,12 @@ +pkgbase = usb2host + pkgdesc = A tiny program to put dual-role USB port to host mode + pkgver = 1.0 + pkgrel = 1 + url = https://github.com/7Ji/usb2host + install = usb2host.install + arch = any + license = GPL3 + source = https://github.com/7Ji/usb2host/archive/refs/tags/v1.0.tar.gz + sha256sums = 0a00ab9b3db484be2c90b0cb6a7c99d9a88f22b5768eed90605c3c631b048a23 + +pkgname = usb2host diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..b7fc50218b4c --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,31 @@ +# Maintainer: 7Ji <pugokushin@gmail.com> + +pkgname='usb2host' +pkgver='1.0' +pkgrel='1' +pkgdesc='A tiny program to put dual-role USB port to host mode' +url='https://github.com/7Ji/usb2host' +license=('GPL3') +install="${pkgname}".install +source=("${url}"/archive/refs/tags/v"${pkgver}".tar.gz) +sha256sums=('0a00ab9b3db484be2c90b0cb6a7c99d9a88f22b5768eed90605c3c631b048a23') +arch=('any') + +_srcname="${pkgname}-${pkgver}" +build() { + make -C "${_srcname}" +} +package() { + make -C "${_srcname}" install PREFIX="${pkgdir}" NODE='\$$NODE' + # Arch-specific, use a config file instead of embedding the node name in service file. + # This is not set in usb2host itself as when users install it they should already know the node name. + # That, however, is not the case if we want to distribute the pacakge. + sed 's_ExecStart_EnvironmentFile=/etc/conf.d/'"${pkgname}"'\n&_' \ + -i "${pkgdir}"/usr/lib/systemd/system/"${pkgname}".service + { + echo "# The node should exist under '/sys/kernel/debug/usb' and has a file entry 'mode'" + echo "# e.g. for OrangePi5, it's 'fc000000.usb'" + echo "NODE=fc000000.usb" + } | \ + install -D --mode 644 /dev/stdin "${pkgdir}"/etc/conf.d/"${pkgname}" +}
\ No newline at end of file diff --git a/usb2host.install b/usb2host.install new file mode 100644 index 000000000000..8e3542bf2714 --- /dev/null +++ b/usb2host.install @@ -0,0 +1,3 @@ +post_install() { + echo "WARNING: Before enabling the bundled usb2host.service, you must set a valid USB node name in /etc/conf.d/usb2host, which should exist under /sys/kernel/debug/usb and has a file entry 'mode'" +}
\ No newline at end of file |