Refactor code so coder_template_type is considered

This commit is contained in:
Andrew R. M. 2025-03-10 15:09:09 -04:00
parent da4d9dc4ce
commit 30ff982bff

View File

@ -10,13 +10,21 @@ git submodule init && git submodule update
shopt -s nocasematch shopt -s nocasematch
echo "Installing dotfiles..." echo "Installing dotfiles..."
if [ -f /etc/os-release ]; then
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
installers/install-nix.sh
installers/install-nix-packages-flake.sh
elif [ "${CODER_OS_FAMILY:-}" == "Ubuntu" ]; then
echo "Detected OS as Ubuntu, using apt";
sudo apt-get update;
sudo apt-get install -y stow;
installers/install-nix.sh
elif [ -f /etc/os-release ]; then
echo "Idenitfying OS to install GNU stow..." echo "Idenitfying OS to install GNU stow..."
if [ "${CODER_OS_FAMILY:-}" == "Ubuntu" ] || grep -q -i debian /etc/os-release; then if grep -q -i debian /etc/os-release; then
echo "Detected OS as Ubuntu, using apt"; echo "Detected OS as Ubuntu, using apt";
sudo apt-get update; sudo apt-get update;
sudo apt-get install -y stow; sudo apt-get install -y stow;
installers/install-nix.sh
elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then
echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!"; echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!";
# sudo yum install -y stow; # sudo yum install -y stow;
@ -31,13 +39,10 @@ if [ -f /etc/os-release ]; then
exit 1; exit 1;
fi; fi;
else else
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
installers/install-nix.sh
installers/install-nix-packages-flake.sh
fi
echo "ERROR: Unable to find '/etc/os-release' information!" 1>&2; echo "ERROR: Unable to find '/etc/os-release' information!" 1>&2;
exit 1; exit 1;
fi fi
shopt -u nocasematch shopt -u nocasematch
# Apply the dotfiles with stow # Apply the dotfiles with stow