X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/9d039fd7e312d818f4b4f380541fd28ba19c5681..e923c81d138e2e8238d8564b919f88a18bc92eb9:/bin/dot diff --git a/bin/dot b/bin/dot index dc3e8fa..e2a83b3 100755 --- 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 +mkdir -p "$DOT" + read -d '' HELP << EOF dot - a (mostly) one script dotfiles manager @@ -45,6 +47,9 @@ 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 @@ -93,6 +98,11 @@ if [[ ! -f "$TASKFILE" ]]; then 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" @@ -164,7 +174,7 @@ if [ "$1" == "apply" ]; then echo "$TASKFILE is missing. Run 'dot setup'" exit 1 fi - $ANSIBLE $TASKFILE + $ANSIBLE -v $TASKFILE fi if [ "$1" == "install" ]; then @@ -188,8 +198,12 @@ read -d '' RUN_INSTALL << EOF 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: @@ -219,7 +233,7 @@ read -d '' ADD_ENV << EOF stat: path: "$ENVS/$2" register: $2_path - - name: install $2 + - name: add env $2 ansible.builtin.shell: | cd $ENVS python3 -m venv $2