123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/bin/sh
- if [ -z "${DOTFILES_DIR}" ]; then
- DOTFILES_DIR="kolter-dotfiles"
- fi
- printf "Looking for dotfiles dir '%s' ... " "${DOTFILES_DIR}"
- if [ -d "${DOTFILES_DIR}" ]; then
- printf "OK\n"
- else
- printf "FAILED\n"
- exit 1
- fi
- printf "Copying config files in home directory '%s':\n" "${HOME}"
- find "${DOTFILES_DIR}" -maxdepth 1 -mindepth 1 | \
- while read d ; do
- printf "\t'%s' -> '%s/%s' ... " "${d}" "${HOME}" "$(basename "${d}")"
- if mv -f "${d}" "${HOME}" >/dev/null 2>&1 ; then
- printf "OK\n"
- else
- printf "KO\n"
- fi
- done
- printf "Removing dotfiles dir '%s' ... " "${DOTFILES_DIR}"
- if rmdir "${DOTFILES_DIR}" >/dev/null 2>&1 ; then
- printf "OK\n"
- else
- printf "KO\n"
- fi
- printf "Adding some symbolic links ...\n" "${DOTFILES_DIR}"
- for lnk in .zsh.d/zshrc:.zshrc .vim/vimrc:.vimrc ; do
- lnk_src=$(echo "${lnk}" | cut -d ':' -f 1)
- lnk_dest=$(echo "${lnk}" | cut -d ':' -f 2)
- printf "\t'%s/%s' -> '%s/%s' ... " "${HOME}" "${lnk_src}" "${HOME}" "${lnk_dest}"
- if [ -f "${lnk_src}" ] && (cd "${HOME}" && ln -sf "${lnk_src}" "${lnk_dest}" ) ; then
- printf "OK\n"
- else
- printf "KO\n"
- fi
- done
- exit 0
|