From ae8c936c7046bd6ea8f35c5c31006573a627b2e2 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Tue, 21 Jan 2014 13:08:10 -0600
Subject: [PATCH] bb.org: add spi group

Reported-by: Mark Grosen <mark@grosen.org>
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 scripts/chroot.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/chroot.sh b/scripts/chroot.sh
index 3644f6c44..996bd40b7 100755
--- a/scripts/chroot.sh
+++ b/scripts/chroot.sh
@@ -468,7 +468,11 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__
 
 	add_user () {
 		groupadd admin || true
-		default_groups="admin,adm,dialout,i2c,cdrom,floppy,audio,dip,video,netdev,plugdev,users"
+
+		groupadd spi || true
+		echo "KERNEL==\"spidev*\", GROUP=\"spi\", MODE=\"0660\"' > /etc/udev/rules.d/50-spi.rules
+
+		default_groups="admin,adm,dialout,i2c,spi,cdrom,floppy,audio,dip,video,netdev,plugdev,users"
 
 		pkg="sudo"
 		dpkg_check
@@ -492,7 +496,7 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__
 			EOF
 
 			sed -i -e 's:#EXTRA_GROUPS:EXTRA_GROUPS:g' /etc/adduser.conf
-			sed -i -e 's:dialout:dialout i2c:g' /etc/adduser.conf
+			sed -i -e 's:dialout:dialout i2c spi:g' /etc/adduser.conf
 			sed -i -e 's:#ADD_EXTRA_GROUPS:ADD_EXTRA_GROUPS:g' /etc/adduser.conf
 
 			;;
-- 
GitLab