Included udev rules into packages
authorEd Bartosh <eduard.bartosh@intel.com>
Mon, 28 Jan 2013 08:31:26 +0000 (10:31 +0200)
committerEd Bartosh <eduard.bartosh@intel.com>
Wed, 30 Jan 2013 18:27:46 +0000 (20:27 +0200)
Udev rules set device mode to 0666 in order to give flashing
permissions to everyone. This is handy for developers to being able to
flash devices from user account.

Change-Id: Ibb3ccb6b54c3f3c56df66ad0d17772806f622129
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
99-lthor.rules [new file with mode: 0644]
CMakeLists.txt
debian/control
debian/postinst [new file with mode: 0644]
debian/postrm [new file with mode: 0644]
packaging/lthor.spec

diff --git a/99-lthor.rules b/99-lthor.rules
new file mode 100644 (file)
index 0000000..97440fe
--- /dev/null
@@ -0,0 +1 @@
+SUBSYSTEM=="tty", KERNEL=="ttyACM0", MODE="0666"
index 25d7c8fb4415105df9f2cafc5eb44cc699c572fe..076aff398c1e34ab27b3a47d813b70f1d7a77ef8 100755 (executable)
@@ -50,3 +50,6 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
 
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+INSTALL(FILES 99-lthor.rules
+        DESTINATION "/etc/udev/rules.d"
+        COMPONENT "udev")
index c1c09bca8e36d769cf1de65c3834b775d6f28a74..62b24eca6a51fa971f0d145ee73dc5da29925d19 100644 (file)
@@ -7,6 +7,6 @@ Standards-Version: 0.0.1
 
 Package: lthor
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, udev
 Description: Flashing tool for Tizen lunchbox
 
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..09b6e27
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Reload udev rules
+[ -x /sbin/udevadm ] && /sbin/udevadm control --reload-rules
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/postrm b/debian/postrm
new file mode 100644 (file)
index 0000000..09b6e27
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Reload udev rules
+[ -x /sbin/udevadm ] && /sbin/udevadm control --reload-rules
+
+#DEBHELPER#
+
+exit 0
+
index 8410a4eac9ce1f869cb9c19b7d77cd3c677832e2..313f0d4736f4162a1913ab76ad0e6f00b8fc2e9f 100644 (file)
@@ -14,6 +14,8 @@ BuildRequires:  libarchive-devel
 BuildRequires:  cmake
 BuildRequires:  pkg-config
 
+Requires: udev
+
 %description
 Tool for downloading binaries from a Linux host PC to a target phone.
 It uses a USB cable as a physical communication medium.
@@ -35,10 +37,21 @@ make install DESTDIR=$RPM_BUILD_ROOT
 rm -rf %{buildroot}
 
 %post
+if [ -x /sbin/udevadm ] ; then
+    alias udevcontrol="udevadm control"
+fi
+udevcontrol reload_rules ||:
+
+%postun
+if [ -x /sbin/udevadm ] ; then
+    alias udevcontrol="udevadm control"
+fi
+udevcontrol --reload-rules ||:
 
 %files
 %defattr(-,root,root)
 %{_bindir}/%{name}
+%config %{_sysconfdir}/udev/rules.d/*.rules
 
 %changelog