Skip to content

Instantly share code, notes, and snippets.

@mahldcat
Created August 6, 2021 22:31
Show Gist options
  • Select an option

  • Save mahldcat/d747dc41194fcfd1b868b9861e7b2af3 to your computer and use it in GitHub Desktop.

Select an option

Save mahldcat/d747dc41194fcfd1b868b9861e7b2af3 to your computer and use it in GitHub Desktop.
The proper way to handle bootstrapping a new CentOS 8 server....
#!/bin/bash
msyumd="/etc/yum.repos.d/microsoft.repo"
msyumurl="https://packages.microsoft.com/config/rhel/8/prod.repo"
#-----------------------------------
# ARGS
#-----------------------------------
deployscript="./deploy.ps1"
if [ "X$1" != "X" ]; then
echo "overriding deploy script to $1"
deployscript=$1
fi
#-----------------------------------------------
# Configure Dependent (or QOL) services/packages
#-----------------------------------------------
# We need this to add MS support into yum....
if ! ls $msyumd > /dev/null 2>&1; then
echo "Adding Microsoft to yum repo list"
curl $msyumurl | sudo tee $msyumd
fi
# now check for powershell, and install it if it is not found
if ! which pwsh > /dev/null 2>&1; then
echo "Installing Powershell"
sudo yum install -y powershell
fi
# now lets pass things off to a real shell (shots fired)
eval $deployscript $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment