Init repository
This commit is contained in:
commit
b51c10e9d6
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
out
|
31
build_debian.sh
Executable file
31
build_debian.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
function clean_exit() {
|
||||
echo "Cleaning up"
|
||||
sed -i "s/$VERSION/VERSION/" debian/DEBIAN/control
|
||||
sed -i "s/$INSTALLSIZE/INSTALLSIZE/" debian/DEBIAN/control
|
||||
exit 0
|
||||
}
|
||||
trap "clean_exit" 2
|
||||
|
||||
mkdir -p out
|
||||
|
||||
VERSION=$(cat version)
|
||||
REVISION=1
|
||||
FILENAME="usb-udev-helper_$VERSION-${REVISION}_all.deb"
|
||||
INSTALLSIZE=0
|
||||
|
||||
sed -i "s/VERSION/$VERSION/" debian/DEBIAN/control
|
||||
|
||||
INSTALLSIZE=$(du -ks debian|cut -f 1)
|
||||
|
||||
sed -i "s/INSTALLSIZE/$INSTALLSIZE/" debian/DEBIAN/control
|
||||
|
||||
chmod 755 debian/usr/bin/getudevid
|
||||
chown root:root debian/usr/bin/getudevid
|
||||
|
||||
mkdir -p out
|
||||
|
||||
dpkg-deb -b debian "out/$FILENAME"
|
||||
|
||||
clean_exit
|
9
debian/DEBIAN/control
vendored
Normal file
9
debian/DEBIAN/control
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
Package:usb-udev-helper
|
||||
Version:VERSION
|
||||
Installed-Size:INSTALLSIZE
|
||||
Maintainer:Netsyms Technologies LLC <contact@netsyms.com>
|
||||
Section:misc
|
||||
Homepage:https://netsyms.com
|
||||
Priority:optional
|
||||
Description:Assign predictable paths in /dev/usb/by-id to USB printers and Human Interface Devices, and adjust permissions to make them usable by the plugdev group.
|
||||
Architecture:all
|
9
debian/DEBIAN/copyright
vendored
Normal file
9
debian/DEBIAN/copyright
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
Copyright (c) 2024 Netsyms Technologies LLC
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
debian/DEBIAN/postinst
vendored
Executable file
9
debian/DEBIAN/postinst
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Ensure new udev rules take effect immediately
|
||||
echo "Reloading and triggering udev."
|
||||
udevadm control --reload || true
|
||||
udevadm trigger || true
|
||||
|
||||
echo "Adding $SUDO_USER to plugdev group."
|
||||
usermod -aG plugdev $SUDO_USER || true
|
10
debian/etc/udev/rules.d/50-usb-udev-helper.rules
vendored
Normal file
10
debian/etc/udev/rules.d/50-usb-udev-helper.rules
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Allow user-level access to some "raw" USB devices.
|
||||
# Also assigns a permanent path for each device so it won't change if things are unplugged or rebooted.
|
||||
#
|
||||
|
||||
# USB printers
|
||||
SUBSYSTEMS=="usb", DRIVERS=="usblp", MODE:="0660", GROUP="plugdev", PROGRAM="/usr/bin/getudevid $devpath" SYMLINK+="usb/by-id/printer_$result"
|
||||
|
||||
# Scales, barcode scanners, etc
|
||||
KERNEL=="hidraw*", MODE:="0660", GROUP="plugdev", PROGRAM="/usr/bin/getudevid $devpath" SYMLINK+="usb/by-id/hidraw_$result"
|
9
debian/usr/bin/getudevid
vendored
Executable file
9
debian/usr/bin/getudevid
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the vendor and product ID for a USB device path.
|
||||
# Used in udev rules.
|
||||
|
||||
PRODUCTID=$(udevadm info --attribute-walk --path=$1 | grep -m 1 "ATTRS{idProduct}==" | sed 's/^.*=="//' | sed 's/"$//')
|
||||
VENDORID=$(udevadm info --attribute-walk --path=$1 | grep -m 1 "ATTRS{idVendor}==" | sed 's/^.*=="//' | sed 's/"$//')
|
||||
|
||||
echo "$VENDORID:$PRODUCTID"
|
Loading…
x
Reference in New Issue
Block a user