]> ToastFreeware Gitweb - gregoa/movein.git/blobdiff - movein
reading settings from .movein
[gregoa/movein.git] / movein
diff --git a/movein b/movein
index a8f19433284796e7d9afa1943795812aec404487..08bb7ffb673535224fd48c846ac63595e9c3f296 100755 (executable)
--- a/movein
+++ b/movein
@@ -4,11 +4,10 @@
 
 set -e
 
-
 usage() {
     bn=$(basename $0)
     cat <<EOF
-$0: manage .mrconfig
+$0: manage home directory using mr
 
 NAME
   $bn - a command to manage detached git repositories using mr
@@ -22,7 +21,7 @@ SYNOPSIS
 
 COMMANDS
   init 
-      create .mrconfig  
+      create ~/.mrconfig
 
   add repository_name
       checkout the repository from the remote host and add it to
@@ -40,8 +39,11 @@ EOF
 
 GIT_HOST=flounder.vireo.org
 REMOTE_REPOS=~/git
-LOCAL_REPOS=.fgits
+LOCAL_REPOS=~/.fgits
+MRCONFIG=~/.mrconfig
+MOVEIN=~/.movein
 
+source $MOVEIN
 
 init() {
 
@@ -49,16 +51,54 @@ init() {
        usage
     fi
     
-    if [ -e .mrconfig ]; then
-       echo .mrconfig already exists
+    if [ -e $MRCONFIG ]; then
+       echo $MRCONFIG already exists
+       exit 1
+    fi
+    
+    if [ -e $MOVEIN ]; then
+       echo $MOVEIN already exists
        exit 1
     fi
 
+    echo -n "git server hostname? [git.vireo.org] " 
+    read GIT_HOST
+    if [ -z "$GIT_HOST" ]; then 
+       GIT_HOST=git.vireo.org
+    fi
+
+    echo -n "path to remote repositories? [~/git] " 
+    read REMOTE_REPOS
+    if [ -z "$REMOTE_REPOS" ]; then 
+       REMOTE_REPOS=~/git
+    fi
+
+    echo -n "Local repository directory? [~/.fgit] " 
+    read LOCAL_REPOS
+    if [ -z "$LOCAL_REPOS" ]; then 
+       LOCAL_REPOS=~/.fgits
+    fi
+
+    echo -n "Location of .mrconfig file? [~/.mrconfig] " 
+    read MRCONFIG
+    if [ -z "$MRCONFIG" ]; then 
+       MRCONFIG=~/.mrconfig
+    fi
+
+    cat <<EOF > .movein
+GIT_HOST=$GIT_HOST
+REMOTE_REPOS=$REMOTE_REPOS
+LOCAL_REPOS=$LOCAL_REPOS
+MRCONFIG=$MRCONFIG
+EOF
+
     mkdir $LOCAL_REPOS
-    cat <<END > .mrconfig
+    cat <<END > $MRCONFIG
 [DEFAULT]
 include = cat /usr/share/mr/git-fake-bare
 END
+
+    
 }
 
 
@@ -85,7 +125,7 @@ add() {
        git config core.bare false
        GIT_WORK_TREE="$PWD" git pull
        trap - 0
-       cat <<END >> .mrconfig
+       cat <<END >> $MRCONFIG
 
 [$LOCAL_REPO]
 checkout = git_fake_bare_checkout '$REPO_URL' '$REPO_NAME' '../../'
@@ -133,7 +173,7 @@ new() {
        git push --all
        
        trap - 0
-       cat <<END >> .mrconfig
+       cat <<END >> $MRCONFIG
 
 [$LOCAL_REPO]
 checkout = git_fake_bare_checkout '$REPO_URL' '$REPO_NAME' '../../'
@@ -153,4 +193,4 @@ case "$command" in
     new)
         new $@
        ;;
-esac
\ No newline at end of file
+esac