4
if [ ! -d ~/.stdhome -a ! -d ~/.stdhome.dev -a ! -d ~/.stdhome.orig ]; then
7
if [ ! -d ~/.stdhome ]; then
8
echo "Can't determine current state: no ~/.stdhome"
14
if [ -d ~/.stdhome.orig -a ! -d ~/.stdhome.dev ]; then
16
elif [ ! -d ~/.stdhome.orig ]; then
19
if [ -z "$CURRENT" ]; then
20
echo "Can't determine current state" >&2
26
if [ "$1" == "on" ]; then
28
elif [ "$1" == "off" ]; then
32
if [ "$TARGET" == "on" ]; then
35
if [ "$CURRENT" == "on" ]; then
42
if [ ! -f ~/.stdhomerc ]; then
43
echo "No ~/.stdhomerc, creating..."
44
echo "[stdhome]" >> ~/.stdhomerc
45
echo "#home-dir = ~/tmp/stdhome-test" >> ~/.stdhomerc
46
mkdir -p ~/tmp/stdhome-test
48
if ! grep -q '^#home-dir ?= ?~/tmp/stdhome-test' ~/.stdhomerc; then
49
echo "No commented home-dir in ~/.stdhomerc"
50
echo "Please add the following to the [stdhome] section:"
51
echo "#home-dir = ~/tmp/stdhome-test"
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-test
66
elif [ "$TARGET" == "off" ]; then
69
if [ "$CURRENT" == "off" ]; then
76
if ! grep -q '^home-dir ?= ?~/tmp/stdhome-test' ~/.stdhomerc; then
77
echo "No uncommented home-dir in ~/.stdhomerc"
84
sed -ie 's/^home-dir/#\0/' ~/.stdhomerc
87
echo currently $CURRENT