CTF: Application Install
For this script I decided to have some fun and use a trick not many people will know about to be able to run the same script on Mac, Linux and Windows. It is not the most elegant solution to the problem, but I thought it was the most fun way
#!/bin/bash
@echo off
goto WindowsSection
if uname -a | grep -q "Darwin"; then
echo "Mac Installer"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null
if ["$Slack" -eq 'Y']; then
brew install --cask slack
fi
if ["$Chrome" -eq 'Y']; then
brew install --cask google-chrome
fi
if ["$Firefox" -eq 'Y']; then
brew install --cask firefox
fi
if ["Adobe" -eq 'Y']; then
brew install --cask adobe-acrobat-reader
fi
else
echo "Linux installer"
if ["$Slack" -eq 'Y']; then
snap install slack --classic
fi
if ["$Chrome" -eq 'Y']; then
snap install chromium
fi
if ["$Firefox" -eq 'Y']; then
snap install firefox
fi
if ["Adobe" -eq 'Y']; then
snap install acrordrdc
fi
fi
echo "Install Complete"
exit 0
:WindowsSection
SetLocal EnableDelayedExpansion
echo "Windows Installler"
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
if "%Slack%" EQU "Y" (
choco install slack
)
if "%Chrome%" EQU "Y" (
choco install googlechrome
)
if "%Firefox%" EQU "Y" (
choco install firefox
)
if "%Adobe%" EQU "Y" (
choco install adobereader
)
echo "Install Complete"
exit 0