65 lines
1.5 KiB
Bash
Executable File
65 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
#-----------------------------------
|
|
# Name: install-misc
|
|
# Version: 1.0.0
|
|
# Author: Solomon Laing
|
|
# Description:
|
|
# Installs all of my misc programs to
|
|
# the system.
|
|
#-----------------------------------
|
|
|
|
clear
|
|
|
|
default_programs="./default-programs"
|
|
dependencies=$(sed -n '/MISC_START/,/MISC_END/p' $default_programs | sed -e 's/MISC_START//' -e 's/MISC_END//')
|
|
|
|
# check user is happy to run this script
|
|
echo "This script is going to install all of my misc programs that I frequently use."
|
|
echo "Misc programs:$dependencies"
|
|
|
|
read -r -p "Are you sure you want to continue? [Y/n] " input
|
|
case $input in
|
|
[nN][oO] | [nN])
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "The program will continue..."
|
|
;;
|
|
esac
|
|
|
|
# if yay is not installed the run the install script
|
|
if ! command -v yay &> /dev/null; then
|
|
./install-yay
|
|
fi
|
|
|
|
failures=()
|
|
|
|
# run though each dependency and install it if it's not already installed
|
|
for dependency in $dependencies
|
|
do
|
|
clear
|
|
sudo -v
|
|
if ! yay -Qi $dependency &> /dev/null; then
|
|
echo "Installing $dependency and it's dependencies..."
|
|
yay -S --noconfirm $dependency
|
|
fi
|
|
|
|
if ! yay -Qi $dependency &> /dev/null; then
|
|
failures+=("$dependency\n")
|
|
fi
|
|
done
|
|
|
|
total_failures=$((${#failures[@]}))
|
|
|
|
if [ $total_failures -gt 0 ]; then
|
|
echo "$total_failures of the programs failed to install..."
|
|
echo -e "${failures[@]}"
|
|
echo "Please manually rectify this and then rerun this setup with: ./setup misc"
|
|
exit 1
|
|
else
|
|
echo "Misc programs sucessfully installed"
|
|
fi
|
|
|
|
exit 0
|