diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-12-28 13:29:40 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-12-28 13:29:40 -0200 |
commit | 3f145c0dfe21cc3d9d477d980d2322a728732753 (patch) | |
tree | 3b3267120b51e960e500f1e06086dc9b6fd5205a /metadot | |
parent | 0c8cbbc0ea7c6ae56758f21c5678a44c1e1888f2 (diff) | |
download | metadot-3f145c0dfe21cc3d9d477d980d2322a728732753.tar.gz metadot-3f145c0dfe21cc3d9d477d980d2322a728732753.tar.bz2 |
Enhancing 'update', adding 'clone' and 'create'
Diffstat (limited to 'metadot')
-rwxr-xr-x | metadot | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -81,11 +81,40 @@ elif [ "$OPT" == "version" ]; then ( cd $DOT && git log -n 1 ) elif [ "$OPT" == "update" ]; then if [ -d "$DOT/.git" ]; then - ( cd $DOT && git pull origin master && git submodule update --init ) + ( cd $DOT && git pull origin master && git submodule update --init --recursive ) + else + for module in `ls $MODULES`; do + ( cd $MODULES/$module && git pull origin master && git submodule update --init --recursive ) + done fi elif [ "$OPT" == "backup" ]; then shift metadot_backup $1 +elif [ "$OPT" == "clone" ]; then + shift + if [ "`basename $1 .git`" == "dotfiles" ]; then + metadot_backup $DOT + git clone --recursive $1 $DOT + echo "Backups saved at $BACKUPS." + else + mkdir -p $MODULES + git clone --recursive $1 $MODULES/`basename $1 .git` + fi +elif [ "$OPT" == "create" ]; then + shift + mkdir -p $MODULES/$1 + ( + cd $MODULES/$1 + git init + + echo "# $1 dotfile module" > README.mdwn + echo "" >> README.mdwn + echo "This is the repository for $1 configuration." >> README.mdwn + echo "More information at https://git.sarava.org/?p=metadot.git" >> README.mdwn + + git add . + ) + echo "Metadot skeleton module $1 created at $MODULES/$1" elif [ "$OPT" == "load" ]; then shift |