Skip to content

Commit

Permalink
argument parsing must come first
Browse files Browse the repository at this point in the history
  • Loading branch information
joelmccracken committed Nov 4, 2023
1 parent 908ae36 commit bcc11b2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
58 changes: 29 additions & 29 deletions bootstrap-workstation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,6 @@
# [[file:workstation.org::*Bootstraping Script][Bootstraping Script:1]]
set -xeuo pipefail

# [[file:../../workstation.org::workstation_foundation][workstation_foundation]]

export WORKSTATION_DIR="$HOME/workstation"
export WORKSTATION_HOST_SETTINGS_SRC_DIR=$WORKSTATION_DIR/hosts/$WORKSTATION_NAME
export WORKSTATION_HOST_CURRENT_SETTINGS_DIR=$WORKSTATION_DIR/hosts/current
export WORKSTATION_EMACS_CONFIG_DIR=~/.config/emacs
export WORKSTATION_GIT_ORIGIN='[email protected]:joelmccracken/workstation.git'
export WORKSTATION_GIT_ORIGIN_PUB='https://github.com/joelmccracken/workstation.git'

sourceIfExists () {
if [ -f "$1" ]; then
source "$1"
fi
}

if [ -z "${WORKSTATION_NAME+x}" ] ; then
if [ -f "$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh" ]; then
source "~/$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh"
fi
fi

# workstation_foundation ends here
# These are the various versions of things that should be installed. Keeping them
# in one place like this make them easier to keep track of.
# [[file:../../../workstation.org::workstation_setup_versions][workstation_setup_versions]]
export WORKSTATION_NIX_PM_VERSION=nix-2.11.1
export WORKSTATION_NIX_DARWIN_VERSION=f6648ca0698d1611d7eadfa72b122252b833f86c
export WORKSTATION_HOME_MANAGER_VERSION=0f4e5b4999fd6a42ece5da8a3a2439a50e48e486
# workstation_setup_versions ends here
# Script should be passed a single argument, which is name of this workstation.

# When using script to set up a workstation, the "name" of the workstation should
Expand Down Expand Up @@ -69,6 +40,35 @@ if [ -z "${2+x}" ]; then
else
export WORKSTATION_BOOTSTRAP_COMMIT="$2"
fi
# [[file:../../workstation.org::workstation_foundation][workstation_foundation]]

export WORKSTATION_DIR="$HOME/workstation"
export WORKSTATION_HOST_SETTINGS_SRC_DIR=$WORKSTATION_DIR/hosts/$WORKSTATION_NAME
export WORKSTATION_HOST_CURRENT_SETTINGS_DIR=$WORKSTATION_DIR/hosts/current
export WORKSTATION_EMACS_CONFIG_DIR=~/.config/emacs
export WORKSTATION_GIT_ORIGIN='[email protected]:joelmccracken/workstation.git'
export WORKSTATION_GIT_ORIGIN_PUB='https://github.com/joelmccracken/workstation.git'

sourceIfExists () {
if [ -f "$1" ]; then
source "$1"
fi
}

if [ -z "${WORKSTATION_NAME+x}" ] ; then
if [ -f "$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh" ]; then
source "~/$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh"
fi
fi

# workstation_foundation ends here
# These are the various versions of things that should be installed. Keeping them
# in one place like this make them easier to keep track of.
# [[file:../../../workstation.org::workstation_setup_versions][workstation_setup_versions]]
export WORKSTATION_NIX_PM_VERSION=nix-2.11.1
export WORKSTATION_NIX_DARWIN_VERSION=f6648ca0698d1611d7eadfa72b122252b833f86c
export WORKSTATION_HOME_MANAGER_VERSION=0f4e5b4999fd6a42ece5da8a3a2439a50e48e486
# workstation_setup_versions ends here
# hereafter, we use many helper functions. Here they are defined up front,
# as some of them are used throughout the other code.

Expand Down
20 changes: 10 additions & 10 deletions workstation.org
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,6 @@ set -xeuo pipefail
This portion of the document explains the various execution steps of bootstrap.

Each of these steps are executed sequentially.
*** Foundations
#+begin_src shell :noweb yes
«workstation_foundation»
#+end_src
*** Set Version Settings
#+begin_src shell :noweb yes
# These are the various versions of things that should be installed. Keeping them
# in one place like this make them easier to keep track of.
«workstation_setup_versions»
#+end_src
*** Argument Parsing
#+begin_src shell
# Script should be passed a single argument, which is name of this workstation.
Expand Down Expand Up @@ -211,6 +201,16 @@ else
export WORKSTATION_BOOTSTRAP_COMMIT="$2"
fi
#+end_src
*** Foundations
#+begin_src shell :noweb yes
«workstation_foundation»
#+end_src
*** Set Version Settings
#+begin_src shell :noweb yes
# These are the various versions of things that should be installed. Keeping them
# in one place like this make them easier to keep track of.
«workstation_setup_versions»
#+end_src
*** Helper and Component Functions
#+begin_src shell :noweb yes
# hereafter, we use many helper functions. Here they are defined up front,
Expand Down

0 comments on commit bcc11b2

Please sign in to comment.