Revision 24230,
1.4 KB
checked in by broder, 15 years ago
(diff) |
Add missing trailing semicolons to the new helper functions in
reactivate
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | # |
---|
3 | # snapshot-run PROGRAM [ARGS] |
---|
4 | # Create an Athena login snapshot, run PROGRAM within it, and clean up |
---|
5 | # the snapshot. |
---|
6 | # |
---|
7 | # This script is run as the user who is logging in, usually as a wrapper |
---|
8 | # around their Xsession or shell. You probably want to run reactivate |
---|
9 | # immediately afterwards, as root. |
---|
10 | |
---|
11 | set -e |
---|
12 | cd / |
---|
13 | |
---|
14 | addgroups="admin lpadmin adm fuse cdrom floppy audio video plugdev scanner dialout" |
---|
15 | daemons="$(/usr/sbin/policy-rc.d --daemons)" |
---|
16 | |
---|
17 | # Setup |
---|
18 | |
---|
19 | session=$(schroot -c login -b) |
---|
20 | sch() { schroot -r -c "$session" -- "$@"; } # Run in the chroot |
---|
21 | schq() { schroot -q -r -c "$session" -- "$@"; } # Run in the chroot quietly |
---|
22 | schr() { schroot -r -c -u root "$session" -- "$@"; } # Run in the chroot as root |
---|
23 | |
---|
24 | for group in $addgroups; do |
---|
25 | schr getent group "$group" >/dev/null 2>&1 && schr adduser "$USER" "$group" |
---|
26 | done |
---|
27 | |
---|
28 | schr sed -i "/su-error/d" "/etc/pam.d/su.debathena" |
---|
29 | |
---|
30 | schr touch /ClusterLogin |
---|
31 | |
---|
32 | for daemon in $daemons; do |
---|
33 | schr invoke-rc.d "$daemon" start || [ $? = 100 ] |
---|
34 | done |
---|
35 | |
---|
36 | schr rm /etc/debian_chroot |
---|
37 | |
---|
38 | # Run the session |
---|
39 | # |
---|
40 | # We wrap the target command in sudo because it runs initgroups(3) |
---|
41 | # /after/ being chrooted, which puts users back in the groups we |
---|
42 | # added them to |
---|
43 | |
---|
44 | set +e |
---|
45 | |
---|
46 | cd |
---|
47 | schroot -c "$session" -r -p -- sudo -E -u "$USER" -- "$@" |
---|
48 | cd / |
---|
49 | |
---|
50 | # Teardown |
---|
51 | |
---|
52 | for daemon in $daemons; do |
---|
53 | schr invoke-rc.d "$daemon" stop || [ $? = 100 ] |
---|
54 | done |
---|
55 | |
---|
56 | schroot -c "$session" -e |
---|
Note: See
TracBrowser
for help on using the repository browser.