]> us-delaporte.pagekite.me Git - dotfiles.git/blobdiff - bin/dot
Backup some backup scripts
[dotfiles.git] / bin / dot
diff --git a/bin/dot b/bin/dot
index dc3e8fa2e8114be4a85f5115f8d013bdd6efc47b..e2a83b382f052c6198e71b88af37e74c05778516 100755 (executable)
--- a/bin/dot
+++ b/bin/dot
@@ -9,6 +9,8 @@ INSTALLS="$DOTFILES/install"  # Install scripts
 DOT="$HOME/.dot"  # Touched files go here to track installs
 REQS="$DOTFILES/reqs"  # Python env requirements.txt files
 
 DOT="$HOME/.dot"  # Touched files go here to track installs
 REQS="$DOTFILES/reqs"  # Python env requirements.txt files
 
+mkdir -p "$DOT"
+
 read -d '' HELP << EOF
 dot - a (mostly) one script dotfiles manager
 
 read -d '' HELP << EOF
 dot - a (mostly) one script dotfiles manager
 
@@ -45,6 +47,9 @@ EOF
 
 read -d '' EXTRA_HELP << EOF
 
 
 read -d '' EXTRA_HELP << EOF
 
+dot list
+  display the contents of $TASKFILE
+
 dot install SCRIPT
   updates ~/dot.HOSTNAME.yaml
   to run ~/dotfiles/SCRIPT.sh if it has not yet been run
 dot install SCRIPT
   updates ~/dot.HOSTNAME.yaml
   to run ~/dotfiles/SCRIPT.sh if it has not yet been run
@@ -93,6 +98,11 @@ if [[ ! -f "$TASKFILE" ]]; then
        echo "$EMPTY_TASKFILE" >> $TASKFILE
 fi
 
        echo "$EMPTY_TASKFILE" >> $TASKFILE
 fi
 
+if [ "$1" == "list" ]; then
+       cat $TASKFILE
+       exit 0
+fi
+
 if [ "$1" == "setup" ]; then
   if [[ ! -f "$ANSIBLE" ]]; then
                mkdir -p "$ENVS"
 if [ "$1" == "setup" ]; then
   if [[ ! -f "$ANSIBLE" ]]; then
                mkdir -p "$ENVS"
@@ -164,7 +174,7 @@ if [ "$1" == "apply" ]; then
                echo "$TASKFILE is missing. Run 'dot setup'"
                exit 1
        fi
                echo "$TASKFILE is missing. Run 'dot setup'"
                exit 1
        fi
-       $ANSIBLE $TASKFILE
+       $ANSIBLE -v $TASKFILE
 fi
 
 if [ "$1" == "install" ]; then
 fi
 
 if [ "$1" == "install" ]; then
@@ -188,8 +198,12 @@ read -d '' RUN_INSTALL << EOF
       register: $2_installed
     - name: install $2
       ansible.builtin.shell: |
       register: $2_installed
     - name: install $2
       ansible.builtin.shell: |
-        "$INSTALLS/$2.sh"
-        touch "$DOT/$2.installed"
+        "$INSTALLS/$2.sh" && touch "$DOT/$2.installed"
+      register: ret
+      failed_when: >
+          ("Error" in ret.stdout) or
+          ("Error" in ret.stderr) or
+          (ret.rc != 0)
       when: not $2_installed.stat.exists
     - name: verify $2 is installed
       ansible.builtin.debug:
       when: not $2_installed.stat.exists
     - name: verify $2 is installed
       ansible.builtin.debug:
@@ -219,7 +233,7 @@ read -d '' ADD_ENV << EOF
       stat:
         path: "$ENVS/$2"
       register: $2_path
       stat:
         path: "$ENVS/$2"
       register: $2_path
-    - name: install $2
+    - name: add env $2
       ansible.builtin.shell: |
         cd $ENVS
         python3 -m venv $2
       ansible.builtin.shell: |
         cd $ENVS
         python3 -m venv $2