From 76ef84f42e2da17a97214d8bc6cae1a570e5676c Mon Sep 17 00:00:00 2001
From: Thiago Abdo <tja14@inf.ufpr.br>
Date: Tue, 1 Mar 2016 10:23:08 -0300
Subject: [PATCH] Add what usb is from what user

Signed-off-by: Thiago Abdo <tja14@inf.ufpr.br>
---
 usb_drive/insert_data.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/usb_drive/insert_data.sh b/usb_drive/insert_data.sh
index 734225a..1c34735 100755
--- a/usb_drive/insert_data.sh
+++ b/usb_drive/insert_data.sh
@@ -65,6 +65,10 @@ if [ -z "$users" ]; then
 fi
 set $users
 
+if [ ! -e "/home/openslx/usb_users" ]; then
+    mkdir -p /home/openslx/usb_users;
+fi
+
 # parse config file until EOF
 while (( [ $# -gt 0 ] )); do
     # get the respective line for passwd, shadow and group
@@ -95,6 +99,8 @@ while (( [ $# -gt 0 ] )); do
         # because grep will not find anything
         if [ -n "$localID" ] && [ -n "$localGID" ]; then
             /opt/openslx/scripts/adduser.sh "$passwdf" "$groupf" "$shadowf"
+            #Add to a file what pendrive this user is from
+            echo "$mountpath" > "/home/openslx/usb_users/$username"
         fi
     fi
 done
-- 
GitLab