/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to tools/dev-environment

  • Committer: Tim Marston
  • Date: 2014-03-19 20:01:06 UTC
  • Revision ID: tim@ed.am-20140319200106-ou5y1nat6y2auaue
removed square brackets from AC_INIT parameter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
 
3
 
CURRENT=
4
 
if [ -d ~/.stdhome.orig -a ! -d ~/.stdhome.dev ]; then
5
 
        CURRENT=on
6
 
elif [ ! -d ~/.stdhome.orig -a -d ~/.stdhome.dev ]; then
7
 
        CURRENT=off
8
 
fi
9
 
 
10
 
if [ -z "$CURRENT" ]; then
11
 
        echo "Can't determine current state" >&2
12
 
        exit 1
13
 
fi
14
 
 
15
 
TARGET=
16
 
if [ "$1" == "on" ]; then
17
 
        TARGET=on
18
 
elif [ "$1" == "off" ]; then
19
 
        TARGET=off
20
 
fi
21
 
 
22
 
if [ "$TARGET" == "on" ]; then
23
 
 
24
 
        if [ "$CURRENT" == "on" ]; then
25
 
                echo already on >& 2
26
 
                exit 0
27
 
        fi
28
 
        echo turning on
29
 
 
30
 
        mv ~/.stdhome{,.orig}
31
 
        mv ~/.stdhome{.dev,}
32
 
        sed -ie 's/^#\(home-dir\)/\1/' ~/.stdhomerc
33
 
 
34
 
elif [ "$TARGET" == "off" ]; then
35
 
 
36
 
        if [ "$CURRENT" == "off" ]; then
37
 
                echo already off >& 2
38
 
                exit 0
39
 
        fi
40
 
        echo turning off
41
 
 
42
 
        mv ~/.stdhome{,.dev}
43
 
        mv ~/.stdhome{.orig,}
44
 
        sed -ie 's/^home-dir/#\0/' ~/.stdhomerc
45
 
 
46
 
else
47
 
        echo currently $CURRENT
48
 
fi