1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-07 03:35: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` saveIFS="$IFS"
#echo "$value" IFS=$'\n'
LINES=($(<~/.git_repos))
IFS="$saveIFS"
WORKSPACE="$HOME/workspace/projects" # 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 if [ ! -e $WORKSPACE ]; then
mkdir -p $WORKSPACE mkdir -p $WORKSPACE
fi fi
fi
saveIFS="$IFS" if [ ${LINE:0:1} = '[' ]; then
IFS=$'\n' echo 'group: $GRP'
GRPS=($(<~/.git_groups)) # TODO: strip [ and ] from LINE
IFS="$saveIFS" GRP=$LINE
fi
for GRP in "${GRPS[@]}"; do
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