Skip to content

Commit

Permalink
Move dotfiles remote setup to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
fortes committed Aug 21, 2024
1 parent 826d79f commit 005a056
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions scripts/remove_default_dotfiles
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Make your machine usable
# Remove the default OS-provided dotfiles so stow can use their location
#
# Usage: install_google_chrome
# Usage: remote_default_dotfiles

set -euo pipefail
IFS=$'\n\t'
Expand Down
24 changes: 24 additions & 0 deletions scripts/set_dotfiles_remote
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Make your machine usable
#
# Usage: set_dotfiles_remote

set -euo pipefail
IFS=$'\n\t'

declare dotfiles_root
dotfiles_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

set_dotfiles_remote() {
(
cd "${dotfiles_root}"
if git remote get-url "$(git remote)" | grep -q https; then
echo "Setting dotfiles git remote"
git remote set-url origin [email protected]:fortes/dotfiles.git
fi
)
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set_dotfiles_remote "${@}"
fi
12 changes: 1 addition & 11 deletions scripts/setup_machine
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,6 @@ set_default_applications() {
fi
}

set_dotfiles_remote() {
(
cd "${dotfiles_root}"
if git remote get-url "$(git remote)" | grep -q https; then
echo "Setting dotfiles git remote"
git remote set-url origin [email protected]:fortes/dotfiles.git
fi
)
}

setup_backports() {
declare -r codename="$(lsb_release -cs | tail -n 1)"

Expand Down Expand Up @@ -259,7 +249,7 @@ main() {

check_prerequisites
setup_shell
set_dotfiles_remote
"${dotfiles_root}/scripts/set_dotfiles_remote"

if [[ ! -f "${local_profile_path}" ]]; then
echo "Generating ${local_profile_path}"
Expand Down

0 comments on commit 005a056

Please sign in to comment.