X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/blobdiff_plain/b73d223b82be164767476049f621abdfa74e1b3b..8c7db1f6bb896bc732ec7aa925a7865d5e772f61:/bin/dot diff --git a/bin/dot b/bin/dot index 45a7a39..0fd7dd7 100755 --- a/bin/dot +++ b/bin/dot @@ -26,6 +26,7 @@ ENVS="$HOME/envs" ANSIBLE="$ENVS/ansible/bin/ansible-playbook" TASKFILE="$HOME/dot.$HOSTNAME.yaml" LINKFILES="$HOME/dotfiles/files" +INSTALLS="$HOME/dotfiles/install" read -d '' EMPTY_TASKFILE << EOF --- @@ -85,7 +86,7 @@ if [ "$1" == "link" ]; then read -d '' LINK_THIS_FILE << EOF - - name: Create a symbolic link + - name: symlink $2 ansible.builtin.file: src: "$LINKFILES/$2" dest: "$HOME/.$2" @@ -94,6 +95,26 @@ EOF echo " $LINK_THIS_FILE" >> $TASKFILE echo "$2 added to symlinks in $TASKFILE" - echo "Run `dot apply` to create all configured symlinks" + echo "Run 'dot apply' to create all configured symlinks" fi + +if [ "$1" == "apply" ]; then + if [[ ! -f "$TASKFILE" ]]; then + echo "$TASKFILE is missing. Run 'dot setup'" + exit 1 + fi + $ANSIBLE $TASKFILE +fi + +if [ "$1" == "install" ]; then + if [ ! -n "$2" ]; then + echo "Can install:" + cd $INSTALLS + ls -p | grep -v / + exit 1 + fi + $INSTALLS/$2 +fi + +