Change some functions

This commit is contained in:
Steve Zabka
2022-02-18 09:02:13 +01:00
committed by GitHub
parent 4470aa1f92
commit 6e9c8ed296

View File

@@ -7,8 +7,8 @@
# Author URI: https://cryinkfly.com # # Author URI: https://cryinkfly.com #
# License: MIT # # License: MIT #
# Copyright (c) 2020-2022 # # Copyright (c) 2020-2022 #
# Time/Date: 11:15/17.02.2022 # # Time/Date: 09:00/18.02.2022 #
# Version: 0.0.4 # # Version: 0.0.5 #
#################################################################################################### ####################################################################################################
# Path: /$HOME/.config/fusion-360/bin/update.sh # Path: /$HOME/.config/fusion-360/bin/update.sh
@@ -22,9 +22,12 @@ program_name="Autodesk Fusion 360 for Linux - Launcher"
# A value of 0 means that there is no update and a value of 1 will notify the user that there is an update. # A value of 0 means that there is no update and a value of 1 will notify the user that there is an update.
get_update=0 get_update=0
# Domain Name # Domain Name:
domain="www.github.com" domain="www.github.com"
# Reset connection-value!
connection=0
############################################################################################################################################################### ###############################################################################################################################################################
# ALL FUNCTIONS ARE ARRANGED HERE: # # ALL FUNCTIONS ARE ARRANGED HERE: #
############################################################################################################################################################### ###############################################################################################################################################################
@@ -33,49 +36,35 @@ domain="www.github.com"
function setupact-check-connection { function setupact-check-connection {
ping -c 5 $domain 2>/dev/null 1>/dev/null ping -c 5 $domain 2>/dev/null 1>/dev/null
if [ "$?" = 0 ]; then if [ "$?" = 0 ]; then
echo "Host found" connection=1
echo "Connection to the domain worked!"
else else
echo "Host not found" echo "No connection to the domain!"
setupact-no-connection-warning
# Skip the update proecess ... (Still in Progress!)
fi fi
} }
###############################################################################################################################################################
# Checks if there is an update for Autodesk Fusion 360. # Checks if there is an update for Autodesk Fusion 360.
function setupact-check-update { function setupact-check-info {
if [ $get_update -eq 1 ]; then if [ $connection -eq 1 ] && [ $get_update -eq 1 ]; then
setupact-get-update setupact-update-question
else elif [ $connection -eq 1 ] && [ $get_update -eq 0 ]; then
echo "Do nothing!"
setupact-no-update-info setupact-no-update-info
else
setupact-no-connection-error
fi fi
} }
# Checks the current day of the week so that the update can be performed. ###############################################################################################################################################################
# %u day of week (1..7); 1 is Monday.
# The update runs on Monday, Wednesday and Friday. function setupact-get-update {
function setupact-get-update {
pc_date=$(date +%u)
if [ $pc_date -eq 1 ]; then
echo "Monday"
setupact-update-question
elif [ $pc_date -eq 3 ]; then
echo "Wednesday"
setupact-update-question
elif [ $pc_date -eq 5 ]; then
echo "Friday"
setupact-update-question
else
setupact-no-update-info
fi
}
function setupact-get-f360exe {
wget https://dl.appstreaming.autodesk.com/production/installers/Fusion%20360%20Admin%20Install.exe -O Fusion360installer.exe wget https://dl.appstreaming.autodesk.com/production/installers/Fusion%20360%20Admin%20Install.exe -O Fusion360installer.exe
} }
function setupact-update { ###############################################################################################################################################################
function setupact-install-update {
WINEPREFIX="$HOME/.wineprefixes/fusion360" wine Fusion360installer.exe -p deploy -g -f log.txt --quiet WINEPREFIX="$HOME/.wineprefixes/fusion360" wine Fusion360installer.exe -p deploy -g -f log.txt --quiet
WINEPREFIX="$HOME/.wineprefixes/fusion360" wine Fusion360installer.exe -p deploy -g -f log.txt --quiet WINEPREFIX="$HOME/.wineprefixes/fusion360" wine Fusion360installer.exe -p deploy -g -f log.txt --quiet
} }
@@ -94,9 +83,19 @@ function setupact-no-update-info {
############################################################################################################################################################### ###############################################################################################################################################################
# The user will be informed that he is skipping the update!
function setupact-skip-info {
zenity --warning \
--text="The update was skipped! Please update your Autodesk Fusion 360 version soon!" \
--width=400 \
--height=100
}
###############################################################################################################################################################
# The user get a informationt that there is no connection to the server! # The user get a informationt that there is no connection to the server!
function setupact-no-connection-warning { function setupact-no-connection-warning {
zenity --warning \ zenity --error \
--text="The connection to the server could not be established! The search for new updates has been skipped! Please check your internet connection!" \ --text="The connection to the server could not be established! The search for new updates has been skipped! Please check your internet connection!" \
--width=400 \ --width=400 \
--height=100 --height=100
@@ -114,10 +113,10 @@ function setupact-update-question {
answer=$? answer=$?
if [ "$answer" -eq 0 ]; then if [ "$answer" -eq 0 ]; then
echo "Do nothing!" setupact-get-update
setupact-install-update
elif [ "$answer" -eq 1 ]; then elif [ "$answer" -eq 1 ]; then
setupact-get-f360exe setupact-skip-info
setupact-update
fi fi
} }
@@ -126,23 +125,22 @@ function setupact-update-question {
# A progress bar is displayed here. # A progress bar is displayed here.
function setupact-progressbar { function setupact-progressbar {
( (
echo "5" ; sleep 1 echo "30" ; sleep 2
echo "# Connecting to the server ..." ; sleep 5 echo "# Connecting to the server ..." ; sleep 3
setupact-check-connection setupact-check-connection
echo "25" ; sleep 1 echo "50" ; sleep 1
echo "# Check for updates ..." ; sleep 3 echo "# Check all files ..." ; sleep 1
setupact-check-update echo "100" ; sleep 3
echo "75" ; sleep 1
) | ) |
zenity --progress \ zenity --progress \
--title="$program_name" \ --title="$program_name" \
--text="Checking if there is a new version of Autodesk fusion 360 available ..." \ --text="Search for new updates ..." \
--width=400 \ --width=400 \
--height=100 \ --height=100 \
--percentage=0 --percentage=0
if [ "$?" = 0 ] ; then if [ "$?" = 0 ] ; then
setupact-update-solved setupact-check-info
elif [ "$?" = 1 ] ; then elif [ "$?" = 1 ] ; then
zenity --question \ zenity --question \
--title="$program_name" \ --title="$program_name" \