mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-09 05:33:48 -05:00
checkDependencies now checks gems and mac apps via homebrew casks.
This commit is contained in:
@@ -73,6 +73,12 @@ hasCasks () {
|
||||
fi
|
||||
}
|
||||
|
||||
# My preferred installation of FFMPEG
|
||||
install-ffmpeg () {
|
||||
if [ ! $(type -P "ffmpeg") ]; then
|
||||
brew install ffmpeg --with-faac --with-fdk-aac --with-ffplay --with-fontconfig --with-freetype --with-libcaca --with-libass --with-frei0r --with-libass --with-libbluray --with-libcaca --with-libquvi --with-libvidstab --with-libsoxr --with-libssh --with-libvo-aacenc --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-webp --with-x265
|
||||
fi
|
||||
}
|
||||
|
||||
# doInstall
|
||||
# ------------------------------------------------------
|
||||
@@ -125,26 +131,40 @@ function to_install() {
|
||||
function doInstall () {
|
||||
list="$(to_install "${RECIPES[*]}" "$($LISTINSTALLED)")"
|
||||
if [[ "${list}" ]]; then
|
||||
seek_confirmation "Confirm each install before running?"
|
||||
seek_confirmation "Confirm each package before installing?"
|
||||
if is_confirmed; then
|
||||
for item in ${list[@]}
|
||||
do
|
||||
seek_confirmation "Install ${item}?"
|
||||
if is_confirmed; then
|
||||
notice "Installing ${item}"
|
||||
# FFMPEG takes additional flags
|
||||
if [[ "${item}" = "ffmpeg" ]]; then
|
||||
install-ffmpeg
|
||||
else
|
||||
${INSTALLCOMMAND} ${item}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
for item in ${list[@]}
|
||||
do
|
||||
notice "Installing ${item}"
|
||||
# FFMPEG takes additional flags
|
||||
if [[ "${item}" = "ffmpeg" ]]; then
|
||||
install-ffmpeg
|
||||
else
|
||||
${INSTALLCOMMAND} ${item}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
# only print notice when not checking dependencies via another script
|
||||
if [ -z "$homebrewDependencies" ] && [ -z "$caskDependencies" ] && [ -z "$gemDependencies" ]; then
|
||||
notice "Nothing to install. You've already installed all your recipes."
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
# brewCleanup
|
||||
|
||||
@@ -335,27 +335,32 @@ function help () {
|
||||
# -----------------------------------
|
||||
|
||||
function checkDependencies() {
|
||||
# Check bashDependencies
|
||||
for dependency in "${homebrewDependencies[@]}"; do
|
||||
if type_not_exists "${dependency}"; then
|
||||
# Attempt to install necessary packages via Homebrew if invoked on a Mac
|
||||
if [[ "${OSTYPE}" =~ ^darwin ]]; then
|
||||
seek_confirmation "We can not proceed without '${dependency}'. Would you like to install it via Homebrew?"
|
||||
if is_confirmed; then
|
||||
hasHomebrew # Installs Homebrew and all dependencies if needed.
|
||||
if [[ "${dependency}" == "ffmpeg" ]]; then # install ffmpeg with all packages
|
||||
brew install ffmpeg --with-faac --with-fdk-aac --with-ffplay --with-fontconfig --with-freetype --with-libcaca --with-libass --with-frei0r --with-libass --with-libbluray --with-libcaca --with-libquvi --with-libvidstab --with-libsoxr --with-libssh --with-libvo-aacenc --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-webp --with-x265
|
||||
else
|
||||
brew install "${dependency}" #install anything else needed
|
||||
if [ -n "$homebrewDependencies" ]; then
|
||||
LISTINSTALLED="brew list"
|
||||
INSTALLCOMMAND="brew install"
|
||||
RECIPES="${homebrewDependencies}"
|
||||
|
||||
# Invoke functions from setupScriptFunctions.sh
|
||||
hasHomebrew
|
||||
doInstall
|
||||
fi
|
||||
else
|
||||
die "Can not proceed without '${dependency}'. Please install it before running this script."
|
||||
if [ -n "$caskDependencies" ]; then
|
||||
LISTINSTALLED="brew cask list"
|
||||
INSTALLCOMMAND="brew cask install --appdir=/Applications"
|
||||
RECIPES="${caskDependencies}"
|
||||
|
||||
# Invoke functions from setupScriptFunctions.sh
|
||||
hasHomebrew
|
||||
hasCasks
|
||||
doInstall
|
||||
fi
|
||||
if [ -n "$gemDependencies" ]; then
|
||||
LISTINSTALLED="gem list | awk '{print $1}'"
|
||||
INSTALLCOMMAND="gem install"
|
||||
RECIPES="${gemDependencies}"
|
||||
# Invoke functions from setupScriptFunctions.sh
|
||||
doInstall
|
||||
fi
|
||||
else
|
||||
die "Can not proceed without '${dependency}'. Please install it before running this script."
|
||||
fi # /OStype
|
||||
fi # not type $dependency
|
||||
done
|
||||
}
|
||||
|
||||
# pauseScript
|
||||
|
||||
@@ -5,13 +5,15 @@
|
||||
#
|
||||
version="1.0.0" # Sets version variable
|
||||
#
|
||||
scriptTemplateVersion="1.3.0" # Version of scriptTemplate.sh that this script is based on
|
||||
# v.1.1.0 - Added 'debug' option
|
||||
# v.1.1.1 - Moved all shared variables to Utils
|
||||
scriptTemplateVersion="1.4.0" # Version of scriptTemplate.sh that this script is based on
|
||||
# v1.1.0 - Added 'debug' option
|
||||
# v1.1.1 - Moved all shared variables to Utils
|
||||
# - Added $PASS variable when -p is passed
|
||||
# v.1.2.0 - Added 'checkDependencies' function to ensure needed
|
||||
# v1.2.0 - Added 'checkDependencies' function to ensure needed
|
||||
# Bash packages are installed prior to execution
|
||||
# v.1.3.0 - Can now pass CLI without an option to $args
|
||||
# v1.3.0 - Can now pass CLI without an option to $args
|
||||
# v1.4.0 - checkDependencies now checks gems and mac apps via
|
||||
# Homebrew cask
|
||||
#
|
||||
# HISTORY:
|
||||
#
|
||||
@@ -89,9 +91,12 @@ logFile="$HOME/Library/Logs/${scriptBasename}.log"
|
||||
# Arrays containing package dependencies needed to execute this script.
|
||||
# The script will fail if dependencies are not installed. For Mac users,
|
||||
# most dependencies can be installed automatically using the package
|
||||
# manager 'Homebrew'.
|
||||
# manager 'Homebrew'. Mac applications will be installed using
|
||||
# Homebrew Casks. Ruby and gems via RVM.
|
||||
# -----------------------------------
|
||||
homebrewDependencies=()
|
||||
caskDependencies=()
|
||||
gemDependencies=()
|
||||
|
||||
function mainScript() {
|
||||
############## Begin Script Here ###################
|
||||
|
||||
@@ -149,15 +149,6 @@ RECIPES=(
|
||||
z
|
||||
)
|
||||
|
||||
install-ffmpeg () {
|
||||
if type_not_exists 'ffmpeg'; then
|
||||
seek_confirmation "Install ffmpeg?"
|
||||
if is_confirmed; then
|
||||
brew install ffmpeg --with-faac --with-fdk-aac --with-ffplay --with-fontconfig --with-freetype --with-libcaca --with-libass --with-frei0r --with-libass --with-libbluray --with-libcaca --with-libquvi --with-libvidstab --with-libsoxr --with-libssh --with-libvo-aacenc --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-webp --with-x265
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
htopPermissions() {
|
||||
seek_confirmation "Set HTOP permissions?"
|
||||
if is_confirmed; then
|
||||
@@ -173,7 +164,6 @@ htopPermissions() {
|
||||
hasHomebrew
|
||||
brewMaintenance
|
||||
doInstall
|
||||
install-ffmpeg
|
||||
htopPermissions
|
||||
brewCleanup
|
||||
|
||||
|
||||
Reference in New Issue
Block a user