~ubuntu-branches/debian/experimental/arduino/experimental

« back to all changes in this revision

Viewing changes to debian/dist/arduino-add-groups

  • Committer: Package Import Robot
  • Author(s): Scott Howard
  • Date: 2012-03-11 18:19:42 UTC
  • mfrom: (1.1.5) (5.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20120311181942-be2clnbz1gcehixb
Tags: 1:1.0.1~rc1+dfsg-1
New upstream release, experimental.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
uid=${PKEXEC_UID:-${SUDO_UID}}
 
4
 
 
5
if [[ -z $uid ]]; then
 
6
    echo "Could not determine which user to add to the groups."
 
7
    exit 2
 
8
fi
 
9
 
 
10
login=$(perl -e 'print((getpwuid shift)[0])' $uid)
 
11
 
 
12
#for group in dialout tty; do
 
13
for group in dialout; do
 
14
    if ! groups $login | grep -q "\b$group\b"; then
 
15
        missing_groups=${missing_groups:+$missing_groups,}$group
 
16
    fi
 
17
done
 
18
 
 
19
if [[ -n $missing_groups ]]; then
 
20
    exec usermod -a -G $missing_groups $login
 
21
else
 
22
    echo "No required groups are missing for this user."
 
23
    exit 1
 
24
fi