Update setup.sh
This commit is contained in:
parent
5f8f0adcdd
commit
f5ebab20e5
118
setup.sh
118
setup.sh
|
@ -1,100 +1,98 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Define global variables
|
||||||
|
readonly BANNER_PATH="$PWD/images/banner"
|
||||||
|
readonly PHOTOSHOP_CC_SCRIPT="scripts/PhotoshopSetup.sh"
|
||||||
|
readonly CAMERA_RAW_SCRIPT="scripts/cameraRawInstaller.sh"
|
||||||
|
readonly WINECFG_SCRIPT="scripts/winecfg.sh"
|
||||||
|
readonly UNINSTALL_SCRIPT="scripts/uninstaller.sh"
|
||||||
|
|
||||||
|
# Define the main function
|
||||||
function main() {
|
function main() {
|
||||||
|
# Print banner
|
||||||
#print banner
|
print_banner
|
||||||
banner
|
|
||||||
|
|
||||||
#read inputs
|
# Read user input
|
||||||
read_input
|
local option=$(read_input)
|
||||||
let answer=$?
|
|
||||||
|
|
||||||
case "$answer" in
|
|
||||||
|
|
||||||
|
# Execute the chosen option
|
||||||
|
case "$option" in
|
||||||
1)
|
1)
|
||||||
echo "run photoshop CC Installation..."
|
echo "Running Photoshop CC installation script..."
|
||||||
echo -n "using winetricks for component installation..."
|
echo -n "Using winetricks for component installation..."
|
||||||
run_script "scripts/PhotoshopSetup.sh" "PhotoshopSetup.sh"
|
run_script "$PHOTOSHOP_CC_SCRIPT"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
echo -n "run adobe camera Raw installer"
|
echo "Running Adobe Camera Raw installer script..."
|
||||||
run_script "scripts/cameraRawInstaller.sh" "cameraRawInstaller.sh"
|
run_script "$CAMERA_RAW_SCRIPT"
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
echo "run winecfg..."
|
echo "Running winecfg script..."
|
||||||
echo -n "open virtualdrive configuration..."
|
echo -n "Opening virtualdrive configuration..."
|
||||||
run_script "scripts/winecfg.sh" "winecfg.sh"
|
run_script "$WINECFG_SCRIPT"
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
echo -n "uninstall photoshop CC ..."
|
echo "Running Photoshop CC uninstaller script..."
|
||||||
run_script "scripts/uninstaller.sh" "uninstaller.sh"
|
run_script "$UNINSTALL_SCRIPT"
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
echo "exit setup..."
|
echo "Exiting setup..."
|
||||||
exitScript
|
exit_script
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
#argumaents 1=script_path 2=script_name
|
# Define the function that runs a script
|
||||||
|
# Arguments:
|
||||||
|
# - $1: The path to the script to be run
|
||||||
function run_script() {
|
function run_script() {
|
||||||
local script_path=$1
|
local script_path=$1
|
||||||
local script_name=$2
|
|
||||||
|
|
||||||
wait_second 5
|
# Wait for 5 seconds
|
||||||
if [ -f "$script_path" ];then
|
wait_seconds 5
|
||||||
echo "$script_path Found..."
|
|
||||||
|
# Check if the script exists
|
||||||
|
if [ -f "$script_path" ]; then
|
||||||
|
echo "$script_path found..."
|
||||||
|
# Make the script executable
|
||||||
chmod +x "$script_path"
|
chmod +x "$script_path"
|
||||||
|
# Change directory to the scripts directory and run the script
|
||||||
|
cd "./scripts/" && bash "$script_path"
|
||||||
else
|
else
|
||||||
error "$script_name not Found..."
|
error "$script_path not found..."
|
||||||
fi
|
fi
|
||||||
cd "./scripts/" && bash $script_name
|
|
||||||
unset script_path
|
unset script_path
|
||||||
}
|
}
|
||||||
|
|
||||||
function wait_second() {
|
# Define the function that waits for a specified number of seconds
|
||||||
for (( i=0 ; i<$1 ; i++ ));do
|
# Arguments:
|
||||||
|
# - $1: The number of seconds to wait
|
||||||
|
function wait_seconds() {
|
||||||
|
for (( i=0; i<$1; i++ )); do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Define the function that reads user input
|
||||||
function read_input() {
|
function read_input() {
|
||||||
while true ;do
|
# Read the user's choice
|
||||||
read -p "[choose an option]$ " choose
|
read -p "[Choose an option]$ " choose
|
||||||
if [[ "$choose" =~ (^[1-5]$) ]];then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
warning "choose a number between 1 to 5"
|
|
||||||
done
|
|
||||||
|
|
||||||
return $choose
|
# Check if the user's choice is a number between 1 and 5
|
||||||
}
|
if [[ "$choose" =~ (^[1-5]$) ]]; then
|
||||||
|
# Return the user's choice
|
||||||
function exitScript() {
|
echo "$choose"
|
||||||
echo "Good Bye :)"
|
|
||||||
}
|
|
||||||
|
|
||||||
function banner() {
|
|
||||||
local banner_path="$PWD/images/banner"
|
|
||||||
if [ -f $banner_path ];then
|
|
||||||
clear && echo ""
|
|
||||||
cat $banner_path
|
|
||||||
echo ""
|
|
||||||
else
|
else
|
||||||
error "banner not Found..."
|
warning "Choose a number between 1 and 5"
|
||||||
|
# Call the function recursively until the user enters a valid choice
|
||||||
|
read_input
|
||||||
fi
|
fi
|
||||||
unset banner_path
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function error() {
|
# Define the function that exits the script
|
||||||
echo -e "\033[1;31merror:\e[0m $@"
|
function exit_script() {
|
||||||
exit 1
|
echo "Goodbye :)"
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function warning() {
|
|
||||||
echo -e "\033[1;33mWarning:\e[0m $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
|
|
Loading…
Reference in New Issue