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
|
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
|
# doInstall
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
@@ -125,25 +131,39 @@ function to_install() {
|
|||||||
function doInstall () {
|
function doInstall () {
|
||||||
list="$(to_install "${RECIPES[*]}" "$($LISTINSTALLED)")"
|
list="$(to_install "${RECIPES[*]}" "$($LISTINSTALLED)")"
|
||||||
if [[ "${list}" ]]; then
|
if [[ "${list}" ]]; then
|
||||||
seek_confirmation "Confirm each install before running?"
|
seek_confirmation "Confirm each package before installing?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
for item in ${list[@]}
|
for item in ${list[@]}
|
||||||
do
|
do
|
||||||
seek_confirmation "Install ${item}?"
|
seek_confirmation "Install ${item}?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
notice "Installing ${item}"
|
notice "Installing ${item}"
|
||||||
${INSTALLCOMMAND} ${item}
|
# FFMPEG takes additional flags
|
||||||
|
if [[ "${item}" = "ffmpeg" ]]; then
|
||||||
|
install-ffmpeg
|
||||||
|
else
|
||||||
|
${INSTALLCOMMAND} ${item}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for item in ${list[@]}
|
for item in ${list[@]}
|
||||||
do
|
do
|
||||||
notice "Installing ${item}"
|
notice "Installing ${item}"
|
||||||
${INSTALLCOMMAND} ${item}
|
# FFMPEG takes additional flags
|
||||||
|
if [[ "${item}" = "ffmpeg" ]]; then
|
||||||
|
install-ffmpeg
|
||||||
|
else
|
||||||
|
${INSTALLCOMMAND} ${item}
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
notice "Nothing to install. You've already installed all your recipes."
|
# 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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -335,27 +335,32 @@ function help () {
|
|||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
|
|
||||||
function checkDependencies() {
|
function checkDependencies() {
|
||||||
# Check bashDependencies
|
if [ -n "$homebrewDependencies" ]; then
|
||||||
for dependency in "${homebrewDependencies[@]}"; do
|
LISTINSTALLED="brew list"
|
||||||
if type_not_exists "${dependency}"; then
|
INSTALLCOMMAND="brew install"
|
||||||
# Attempt to install necessary packages via Homebrew if invoked on a Mac
|
RECIPES="${homebrewDependencies}"
|
||||||
if [[ "${OSTYPE}" =~ ^darwin ]]; then
|
|
||||||
seek_confirmation "We can not proceed without '${dependency}'. Would you like to install it via Homebrew?"
|
# Invoke functions from setupScriptFunctions.sh
|
||||||
if is_confirmed; then
|
hasHomebrew
|
||||||
hasHomebrew # Installs Homebrew and all dependencies if needed.
|
doInstall
|
||||||
if [[ "${dependency}" == "ffmpeg" ]]; then # install ffmpeg with all packages
|
fi
|
||||||
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
|
if [ -n "$caskDependencies" ]; then
|
||||||
else
|
LISTINSTALLED="brew cask list"
|
||||||
brew install "${dependency}" #install anything else needed
|
INSTALLCOMMAND="brew cask install --appdir=/Applications"
|
||||||
fi
|
RECIPES="${caskDependencies}"
|
||||||
else
|
|
||||||
die "Can not proceed without '${dependency}'. Please install it before running this script."
|
# Invoke functions from setupScriptFunctions.sh
|
||||||
fi
|
hasHomebrew
|
||||||
else
|
hasCasks
|
||||||
die "Can not proceed without '${dependency}'. Please install it before running this script."
|
doInstall
|
||||||
fi # /OStype
|
fi
|
||||||
fi # not type $dependency
|
if [ -n "$gemDependencies" ]; then
|
||||||
done
|
LISTINSTALLED="gem list | awk '{print $1}'"
|
||||||
|
INSTALLCOMMAND="gem install"
|
||||||
|
RECIPES="${gemDependencies}"
|
||||||
|
# Invoke functions from setupScriptFunctions.sh
|
||||||
|
doInstall
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# pauseScript
|
# pauseScript
|
||||||
|
|||||||
@@ -5,13 +5,15 @@
|
|||||||
#
|
#
|
||||||
version="1.0.0" # Sets version variable
|
version="1.0.0" # Sets version variable
|
||||||
#
|
#
|
||||||
scriptTemplateVersion="1.3.0" # Version of scriptTemplate.sh that this script is based on
|
scriptTemplateVersion="1.4.0" # Version of scriptTemplate.sh that this script is based on
|
||||||
# v.1.1.0 - Added 'debug' option
|
# v1.1.0 - Added 'debug' option
|
||||||
# v.1.1.1 - Moved all shared variables to Utils
|
# v1.1.1 - Moved all shared variables to Utils
|
||||||
# - Added $PASS variable when -p is passed
|
# - 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
|
# 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:
|
# HISTORY:
|
||||||
#
|
#
|
||||||
@@ -89,9 +91,12 @@ logFile="$HOME/Library/Logs/${scriptBasename}.log"
|
|||||||
# Arrays containing package dependencies needed to execute this script.
|
# Arrays containing package dependencies needed to execute this script.
|
||||||
# The script will fail if dependencies are not installed. For Mac users,
|
# The script will fail if dependencies are not installed. For Mac users,
|
||||||
# most dependencies can be installed automatically using the package
|
# 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=()
|
homebrewDependencies=()
|
||||||
|
caskDependencies=()
|
||||||
|
gemDependencies=()
|
||||||
|
|
||||||
function mainScript() {
|
function mainScript() {
|
||||||
############## Begin Script Here ###################
|
############## Begin Script Here ###################
|
||||||
|
|||||||
@@ -149,15 +149,6 @@ RECIPES=(
|
|||||||
z
|
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() {
|
htopPermissions() {
|
||||||
seek_confirmation "Set HTOP permissions?"
|
seek_confirmation "Set HTOP permissions?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
@@ -173,7 +164,6 @@ htopPermissions() {
|
|||||||
hasHomebrew
|
hasHomebrew
|
||||||
brewMaintenance
|
brewMaintenance
|
||||||
doInstall
|
doInstall
|
||||||
install-ffmpeg
|
|
||||||
htopPermissions
|
htopPermissions
|
||||||
brewCleanup
|
brewCleanup
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user