Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate
1
#!/bin/bash
2
#  version date: 2010-06-15 22:44:57 -0400 
3
#
4
#  launcher:  launches code from a bundled script
5
#
6
#  Copyright 2010, Sugar Labs
7
#  Frederick Grose <fgrose@sugarlabs.org>
8
#
9
#  Usage:
10
#       ${TMPDIR}/launcher $*
11
#
12
#       Used with the 'bundle' package builder to control the launch environment
13
#       for a bundled script.  See 'bundle' documentation.
14
#        
15
#       $*  are options or arguments given to the bundleFile and passed on to
16
#       launcher.
17
#        
18
#  This program is free software; you can redistribute it and/or modify
19
#  it under the terms of the GNU General Public License as published by
20
#  the Free Software Foundation; version 2 of the License.
21
#
22
#  This program is distributed in the hope that it will be useful,
23
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
24
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
#  GNU Library General Public License for more details.
26
#
27
#  You should have received a copy of the GNU General Public License
28
#  along with this program; if not, write to the Free Software
29
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30
31
TMPDIR=${TMPDIR:-/tmp}
32
33
su --session-command="pwd" 2>/dev/null 1>2&
34
case $? in
35
    0)
36
        su_option=--session-command
37
        ;;
38
    *)
39
        su_option=--command
40
        ;;
41
esac
42
su ${su_option}="${TMPDIR}/newSugarStick $* " root
43
exit 0