1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-07 00:05:10 +01:00

Started on unified config

This commit is contained in:
Michiel Scholten
2014-07-18 11:48:59 +02:00
parent e8c6da8092
commit 6878d117c0

View File

@@ -1,20 +1,35 @@
#!/bin/bash #!/bin/bash
#value=`cat config.txt`
#echo "$value"
WORKSPACE="$HOME/workspace/projects"
if [ ! -e $WORKSPACE ]; then
mkdir -p $WORKSPACE
fi
saveIFS="$IFS" saveIFS="$IFS"
IFS=$'\n' IFS=$'\n'
GRPS=($(<~/.git_groups)) LINES=($(<~/.git_repos))
IFS="$saveIFS" IFS="$saveIFS"
for GRP in "${GRPS[@]}"; do # Set defaults to user's homedir and no group (e.g., subdir)
WORKSPACE=$HOME
GRP=""
for LINE in "${LINES[@]}"; do
if [ ${LINE:0:1} = '#' ] || [ -z $LINE ]; then
# Comment or empty line encountered, skip
continue
fi
if [ ${LINE:0:1} = 'workspace=' ]; then
# TODO: strip 'workspace=' from LINE
#WORKSPACE="$HOME/workspace/projects"
WORKSPACE="$HOME/$LINE"
if [ ! -e $WORKSPACE ]; then
mkdir -p $WORKSPACE
fi
fi
if [ ${LINE:0:1} = '[' ]; then
echo 'group: $GRP'
# TODO: strip [ and ] from LINE
GRP=$LINE
fi
if [ ! -e $WORKSPACE/$GRP ]; then if [ ! -e $WORKSPACE/$GRP ]; then
mkdir $WORKSPACE/$GRP mkdir $WORKSPACE/$GRP
elif [ -f $WORKSPACE/$GRP ]; then elif [ -f $WORKSPACE/$GRP ]; then