~vagrantc/ltsp/ltsp-debian-experimental-packaging

« back to all changes in this revision

Viewing changes to patches/localapps-edit-group-directly.dpatch

  • Committer: Vagrant Cascadian
  • Date: 2009-02-09 00:21:15 UTC
  • Revision ID: vagrant@freegeek.org-20090209002115-82th1md75xn6wwf5
remove patch to edit /etc/group directly, as it was applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## localapps-edit-group-directly.dpatch by Vagrant Cascadian <vagrant@freegeek.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
 
6
 
## DP: edit /etc/group directly, as usermod relies on /etc/ being writeable,
7
 
## DP: and in the default Debian ltsp client environment /etc/ is a read-only
8
 
## DP: NFS mount and /etc/group is a bind-mounted writeable file.
9
 
 
10
 
@DPATCH@
11
 
diff -urNad ltsp-5.1.47~20090109~/localapps/ldm-rc.d/X01-localapps ltsp-5.1.47~20090109/localapps/ldm-rc.d/X01-localapps
12
 
--- ltsp-5.1.47~20090109~/localapps/ldm-rc.d/X01-localapps      2009-01-09 16:11:18.000000000 -0800
13
 
+++ ltsp-5.1.47~20090109/localapps/ldm-rc.d/X01-localapps       2009-01-09 16:13:31.000000000 -0800
14
 
@@ -84,10 +84,23 @@
15
 
 
16
 
     # concatenate groups from different sources, stripping off prefixed and
17
 
     # trailing commas
18
 
-    myGroups=$(echo ${myGroups},${myGroups1} | sed -e 's/^,//g' -e 's/,$//g')
19
 
+    myGroups=$(echo ${myGroups},${myGroups1} | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's/^,//g' -e 's/,$//g')
20
 
 
21
 
     if [ -n "$myGroups" ]; then
22
 
-        usermod -G "$myGroups" "${LDM_USERNAME}" 2>/dev/null
23
 
+        OLDIFS="$IFS"
24
 
+        IFS=,
25
 
+        cp /etc/group $TMPGROUP
26
 
+        for group in $myGroups ; do
27
 
+            # add user to each group manually
28
 
+            line="$(egrep ^${group}: $TMPGROUP | egrep -v [:,]${LDM_USERNAME}'(,|$)' )"
29
 
+            if [ -n "$line" ]; then
30
 
+                # add the user to the group
31
 
+                sed -i -e "s/^$line/$line,${LDM_USERNAME}/g" -e 's/:,/:/g' $TMPGROUP
32
 
+            fi
33
 
+        done
34
 
+        cp $TMPGROUP /etc/group
35
 
+        unset IFS
36
 
+        test -n "$OLDIFS" && IFS="$OLDIFS"
37
 
     fi
38
 
 
39
 
     # Now, let's mount the home directory