diff --git a/CHANGELOG.md b/CHANGELOG.md index 33177d99..4ff73f5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ As documented in the README's [adopting](README.md#how-to-adoptcustomize-the-scr For those who follow this repo, here's the changelog for ease of adoption: +### 1.0-21 + +* *[fresh-install-of-osx-advanced.sh]* Nested conditions and print more specific warning message when skipping cloning of the home and profiles repos. + ### 1.0-20 * Removed necessity of quitting and restarting the Terminal application between executing the `fresh-install-of-osx.sh` and `fresh-install-of-osx-advanced.sh`. diff --git a/files/--HOME--/.gitconfig b/files/--HOME--/.gitconfig index b7295635..89f421a2 100644 --- a/files/--HOME--/.gitconfig +++ b/files/--HOME--/.gitconfig @@ -1,4 +1,4 @@ -# file location: ~/.gitconfig +# file location: ${HOME}/.gitconfig # Note: # [Windows users] If you are on windows, please search for the word 'windows' - and fix those lines - they seem to cause some trouble diff --git a/scripts/fresh-install-of-osx-advanced.sh b/scripts/fresh-install-of-osx-advanced.sh index aa483c5f..fe0ed1e0 100755 --- a/scripts/fresh-install-of-osx-advanced.sh +++ b/scripts/fresh-install-of-osx-advanced.sh @@ -19,36 +19,44 @@ if is_non_zero_string "${KEYBASE_USERNAME}"; then # Clone the home repo # ####################### section_header 'Cloning home repo' - if is_non_zero_string "${KEYBASE_HOME_REPO_NAME}" && ! is_git_repo "${HOME}"; then - clone_repo_into "keybase://private/${KEYBASE_USERNAME}/${KEYBASE_HOME_REPO_NAME}" "${HOME}/tmp" - mv -fv "${HOME}/tmp/.git" "${HOME}/" - rm -rf "${HOME}/tmp" - success "Successfully cloned the home repo into ${HOME}" - - # Checkout files (these should not have any modifications/conflicts with what is in the remote repo) - git -C "${HOME}" checkout ".[a-zA-Z]*" personal - - # Reset ssh keys' permissions so that git doesn't complain when using them - set_ssh_folder_permissions - - # Fix /etc/hosts file to block facebook - is_file "${PERSONAL_CONFIGS_DIR}/etc.hosts" && sudo cp "${PERSONAL_CONFIGS_DIR}/etc.hosts" /etc/hosts + if is_non_zero_string "${KEYBASE_HOME_REPO_NAME}"; then + if ! is_git_repo "${HOME}"; then + clone_repo_into "keybase://private/${KEYBASE_USERNAME}/${KEYBASE_HOME_REPO_NAME}" "${HOME}/tmp" + mv -fv "${HOME}/tmp/.git" "${HOME}/" + rm -rf "${HOME}/tmp" + success "Successfully cloned the home repo into ${HOME}" + + # Checkout files (these should not have any modifications/conflicts with what is in the remote repo) + git -C "${HOME}" checkout ".[a-zA-Z]*" personal + + # Reset ssh keys' permissions so that git doesn't complain when using them + set_ssh_folder_permissions + + # Fix /etc/hosts file to block facebook + is_file "${PERSONAL_CONFIGS_DIR}/etc.hosts" && sudo cp "${PERSONAL_CONFIGS_DIR}/etc.hosts" /etc/hosts + else + warn "skipping cloning of home repo since a git repo is already present in '${HOME}'" + fi else - warn "skipping cloning of home repo since the 'KEYBASE_HOME_REPO_NAME' env var hasn't been set or a git repo is already present in '${HOME}'" + warn "skipping cloning of home repo since the 'KEYBASE_HOME_REPO_NAME' env var hasn't been set" fi ########################### # Clone the profiles repo # ########################### section_header 'Cloning profiles repo' - if is_non_zero_string "${KEYBASE_PROFILES_REPO_NAME}" && ! is_git_repo "${PERSONAL_PROFILES_DIR}"; then - clone_repo_into "keybase://private/${KEYBASE_USERNAME}/${KEYBASE_PROFILES_REPO_NAME}" "${PERSONAL_PROFILES_DIR}" - success "Successfully cloned the profiles repo into ${PERSONAL_PROFILES_DIR}" - - # since the above lines will delete the .envrc & .gitignore that were earlier copied into the profiles folder, we will re-run the install script - eval "${DOTFILES_DIR}/scripts/install-dotfiles.rb" + if is_non_zero_string "${KEYBASE_PROFILES_REPO_NAME}"; then + if ! is_git_repo "${PERSONAL_PROFILES_DIR}"; then + clone_repo_into "keybase://private/${KEYBASE_USERNAME}/${KEYBASE_PROFILES_REPO_NAME}" "${PERSONAL_PROFILES_DIR}" + success "Successfully cloned the profiles repo into ${PERSONAL_PROFILES_DIR}" + + # since the above lines will delete the .envrc & .gitignore that were earlier copied into the profiles folder, we will re-run the install script + eval "${DOTFILES_DIR}/scripts/install-dotfiles.rb" + else + warn "skipping cloning of profiles repo since a git repo is already present in '${PERSONAL_PROFILES_DIR}'" + fi else - warn "skipping cloning of profiles repo since the 'KEYBASE_PROFILES_REPO_NAME' env var hasn't been set or a git repo is already present in '${PERSONAL_PROFILES_DIR}'" + warn "skipping cloning of profiles repo since the 'KEYBASE_PROFILES_REPO_NAME' env var hasn't been set" fi else warn "skipping cloning of any keybase repo since 'KEYBASE_USERNAME' has not been set"