summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
author7Ji2023-08-24 16:59:12 +0800
committer7Ji2023-08-24 17:04:51 +0800
commit95e662b14641d7a87465dcdb18e2c2cdf160c61f (patch)
tree1cbc62bf9d180b554c5c26d24d3c01c1b3e73662 /PKGBUILD
downloadaur-usb2host.tar.gz
init commit
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD31
1 files changed, 31 insertions, 0 deletions
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