bzr branch
http://bzr.ed.am/stdhome
| 
68
by Tim Marston
 added tools  | 
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  | 
||
| 
69
by Tim Marston
 fixed-up tools  | 
28  | 
# check/create reset dir  | 
29  | 
if [ ! -d ~/.stdhome.dev.reset/home -a ! -d ~/.stdhome/home ]; then  | 
|
30  | 
echo "No ~/.stdhome.dev/home and nothing to copy it from"  | 
|
31  | 
exit 1  | 
|
32  | 
fi  | 
|
33  | 
if [ ! -d ~/.stdhome.dev.reset/home ]; then  | 
|
34  | 
echo copying dev environment to initial snapshot  | 
|
35  | 
rm -rf ~/.stdhome.dev.reset  | 
|
36  | 
cp -a ~/.stdhome ~/.stdhome.dev.reset  | 
|
37  | 
fi  | 
|
38  | 
||
| 
68
by Tim Marston
 added tools  | 
39  | 
# update repo  | 
40  | 
echo updating repo snapshot  | 
|
41  | 
cd ~/.stdhome.dev.reset/home  | 
|
42  | 
bzr up  | 
|
43  | 
cd  | 
|
44  | 
||
45  | 
# reset repos  | 
|
46  | 
echo resetting repo  | 
|
47  | 
rm -rf ~/.stdhome  | 
|
48  | 
cp -a ~/.stdhome{.dev.reset,}
 | 
|
49  | 
||
50  | 
# revert stage  | 
|
51  | 
if [ -n "$REVNO" ]; then  | 
|
52  | 
echo applying revno $REVNO  | 
|
53  | 
/usr/local/bin/stdhome stage-revert  | 
|
54  | 
cd ~/.stdhome/home  | 
|
55  | 
bzr up -r $REVNO  | 
|
56  | 
cd  | 
|
57  | 
fi  | 
|
58  | 
||
59  | 
# reset "home" dir  | 
|
60  | 
echo resetting homedir  | 
|
61  | 
rm -rf ~/tmp/stdhome-dev  | 
|
62  | 
cp -a ~/.stdhome/home ~/tmp/stdhome-dev  |