4
if [ ! -d ~/.stdhome -a ! -d ~/.stdhome.dev -a ! -d ~/.stdhome.orig ]; then
7
if [ ! -d ~/.stdhome ]; then
8
echo "ERROR: can't determine current state: no ~/.stdhome"
14
4
if [ -d ~/.stdhome.orig -a ! -d ~/.stdhome.dev ]; then
16
elif [ ! -d ~/.stdhome.orig ]; then
6
elif [ ! -d ~/.stdhome.orig -a -d ~/.stdhome.dev ]; then
19
10
if [ -z "$CURRENT" ]; then
20
echo "ERROR: can't determine current state" >&2
11
echo "Can't determine current state" >&2
26
16
if [ "$1" == "on" ]; then
32
22
if [ "$TARGET" == "on" ]; then
35
24
if [ "$CURRENT" == "on" ]; then
36
25
echo already on >& 2
42
if [ ! -f ~/.stdhomerc ]; then
43
echo "ERROR: no ~/.stdhomerc, creating..."
44
echo "[stdhome]" >> ~/.stdhomerc
45
echo "#home-dir = ~/tmp/stdhome-dev" >> ~/.stdhomerc
46
mkdir -p ~/tmp/stdhome-dev
48
if ! grep -q '^#home-dir \?= \?~/tmp/stdhome-dev' ~/.stdhomerc; then
49
echo "ERROR: no commented home-dir in ~/.stdhomerc"
50
echo "Please add the following to the [stdhome] section:"
51
echo "#home-dir = ~/tmp/stdhome-dev"
56
30
mv ~/.stdhome{,.orig}
57
if [ -d ~/.stdhome.dev ]; then
61
echo new dev environment, use stdhome init
63
sed -ie 's/^#\(home-dir\)/\1/' ~/.stdhomerc
64
mkdir -p ~/tmp/stdhome-dev
65
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
66
ln -s "$DIR"/src/stdhome ~/bin/stdhome
32
sed -ie 's/^#\(home-dir\)/\1/' ~/.stdhomerc
68
34
elif [ "$TARGET" == "off" ]; then
71
36
if [ "$CURRENT" == "off" ]; then
72
37
echo already off >& 2
78
if ! grep -q '^home-dir \?= \?~/tmp/stdhome-dev' ~/.stdhomerc; then
79
echo "ERROR: no uncommented home-dir in ~/.stdhomerc"
84
42
mv ~/.stdhome{,.dev}
85
43
mv ~/.stdhome{.orig,}
86
44
sed -ie 's/^home-dir/#\0/' ~/.stdhomerc
90
47
echo currently $CURRENT