Skip to content

Commit

Permalink
Print more specific warning message when skipping cloning of the home…
Browse files Browse the repository at this point in the history
… and profiles repos.
  • Loading branch information
vraravam committed Dec 18, 2024
1 parent 61d362b commit db3c904
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion files/--HOME--/.gitconfig
Original file line number Diff line number Diff line change
@@ -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
Expand Down
52 changes: 30 additions & 22 deletions scripts/fresh-install-of-osx-advanced.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit db3c904

Please sign in to comment.