/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-reset

  • Committer: Tim Marston
  • Date: 2016-04-10 17:42:36 UTC
  • Revision ID: tim@ed.am-20160410174236-708ckdxils6m2ndv
added tools

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
if [ "$CURRENT" == "off" ]; then
 
16
        echo "Dev environment is off" >&2
 
17
        exit 1
 
18
fi
 
19
 
 
20
# revno?
 
21
REVNO=
 
22
if [ -n "$1" ]; then
 
23
        if [ $(( 0 + $1 )) -gt 0 ]; then
 
24
                REVNO=$(( 0 + $1 ))
 
25
        fi
 
26
fi
 
27
 
 
28
# update repo
 
29
echo updating repo snapshot
 
30
cd ~/.stdhome.dev.reset/home
 
31
bzr up
 
32
cd
 
33
 
 
34
# reset repos
 
35
echo resetting repo
 
36
rm -rf ~/.stdhome
 
37
cp -a ~/.stdhome{.dev.reset,}
 
38
 
 
39
# revert stage
 
40
if [ -n "$REVNO" ]; then
 
41
        echo applying revno $REVNO
 
42
        /usr/local/bin/stdhome stage-revert
 
43
        cd ~/.stdhome/home
 
44
        bzr up -r $REVNO
 
45
        cd
 
46
fi
 
47
 
 
48
# reset "home" dir
 
49
echo resetting homedir
 
50
rm -rf ~/tmp/stdhome-dev
 
51
cp -a ~/.stdhome/home ~/tmp/stdhome-dev