| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #################################################################################################### | 
					
						
							|  |  |  | # Name:         Autodesk Fusion 360 - Cronjob for Update (Linux)                                   # | 
					
						
							|  |  |  | # Description:  This file checks whether there is a newer version of Autodesk Fusion 360.          # | 
					
						
							|  |  |  | # Author:       Steve Zabka                                                                        # | 
					
						
							|  |  |  | # Author URI:   https://cryinkfly.com                                                              # | 
					
						
							|  |  |  | # License:      MIT                                                                                # | 
					
						
							|  |  |  | # Copyright (c) 2020-2022                                                                          # | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  | # Time/Date:    09:30/21.02.2022                                                                   # | 
					
						
							|  |  |  | # Version:      0.0.7                                                                              # | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | #################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Path: /$HOME/.config/fusion-360/bin/update.sh | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Window Title (Launcher) | 
					
						
							|  |  |  | program_name="Autodesk Fusion 360 for Linux - Launcher" | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # I will change this value as soon as a new version of Autodesk Fusion 360 is available.  | 
					
						
							|  |  |  | # 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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | # Domain Name: | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | domain="www.github.com" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | # Reset connection-value! | 
					
						
							|  |  |  | connection=0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | # ALL FUNCTIONS ARE ARRANGED HERE:                                                                                                                            # | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  | # Load the locale files ... | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-cs { | 
					
						
							|  |  |  |   profile_locale="cs-CZ" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/cs-CZ/locale-cs.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-de { | 
					
						
							|  |  |  |   profile_locale="de-DE" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/de-DE/locale-de.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-en { | 
					
						
							|  |  |  |   profile_locale="en-US" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/en-US/locale-en.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-es { | 
					
						
							|  |  |  |   profile_locale="es-ES" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/es-ES/locale-es.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-fr { | 
					
						
							|  |  |  |     profile_locale="fr-FR" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/fr-FR/locale-fr.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-it { | 
					
						
							|  |  |  |   profile_locale="it-IT" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/it-IT/locale-it.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-ja { | 
					
						
							|  |  |  |   profile_locale="ja-JP" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/ja-JP/locale-ja.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-ko { | 
					
						
							|  |  |  |   profile_locale="ko-KR" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/ko-KR/locale-ko.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function load-locale-zh { | 
					
						
							|  |  |  |   profile_locale="zh-CN" | 
					
						
							|  |  |  |   . $HOME/.config/fusion-360/locale/zh-CN/locale-zh.sh | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | # Check the connection to the server of GitHub. | 
					
						
							|  |  |  | function setupact-check-connection { | 
					
						
							|  |  |  |   ping -c 5 $domain 2>/dev/null 1>/dev/null | 
					
						
							|  |  |  |   if [ "$?" = 0 ]; then | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |     connection=1 | 
					
						
							|  |  |  |     echo "Connection to the domain worked!" | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |   else | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |     echo "No connection to the domain!" | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | fi | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | ############################################################################################################################################################### | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | # Checks if there is an update for Autodesk Fusion 360. | 
					
						
							|  |  |  | function setupact-check-info { | 
					
						
							|  |  |  |   if [ $connection -eq 1 ] && [ $get_update -eq 1 ]; then | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |     setupact-update-question | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |   elif [ $connection -eq 1 ] && [ $get_update -eq 0 ]; then | 
					
						
							|  |  |  |     setupact-no-update-info  | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  |   else     | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |     setupact-no-connection-error | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  |   fi | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function setupact-get-update { | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  |   wget https://dl.appstreaming.autodesk.com/production/installers/Fusion%20360%20Admin%20Install.exe -O Fusion360installer.exe | 
					
						
							| 
									
										
										
										
											2022-02-20 12:37:16 +01:00
										 |  |  |   mv "Fusion360installer.exe" "$HOME/.config/fusion-360/downloads/Fusion360installer.exe" | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function setupact-install-update { | 
					
						
							| 
									
										
										
										
											2022-02-20 12:37:16 +01:00
										 |  |  |   WINEPREFIX="$HOME/.wineprefixes/fusion360" wine $HOME/.config/fusion-360/downloads/Fusion360installer.exe -p deploy -g -f log.txt --quiet | 
					
						
							|  |  |  |   WINEPREFIX="$HOME/.wineprefixes/fusion360" wine $HOME/.config/fusion-360/downloads/Fusion360installer.exe -p deploy -g -f log.txt --quiet | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | # ALL DIALOGS ARE ARRANGED HERE:                                                                                                                              # | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | # The user get a informationt that no newer version of Autodesk Fusion 360 was found! | 
					
						
							|  |  |  | function setupact-no-update-info { | 
					
						
							|  |  |  |   zenity --info \
 | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  |   --text="$text_no_update_info" \
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |   --width=400 \
 | 
					
						
							|  |  |  |   --height=100 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | # The user will be informed that he is skipping the update! | 
					
						
							|  |  |  | function setupact-skip-info { | 
					
						
							|  |  |  |   zenity --warning \
 | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  |   --text="$text_skip_update_info" \
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |   --width=400 \
 | 
					
						
							|  |  |  |   --height=100 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | # The user get a informationt that there is no connection to the server! | 
					
						
							|  |  |  | function setupact-no-connection-warning { | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |   zenity --error \
 | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  |   --text="$text_no_connection_warning" \
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |   --width=400 \
 | 
					
						
							|  |  |  |   --height=100 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # The user will be asked if he wants to update or not. | 
					
						
							|  |  |  | function setupact-update-question { | 
					
						
							|  |  |  |   zenity --question \
 | 
					
						
							|  |  |  |   --title="$program_name" \
 | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  |   --text="$text_update_question" \
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |   --width=400 \
 | 
					
						
							|  |  |  |   --height=100 | 
					
						
							|  |  |  |   answer=$? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |   if [ "$answer" -eq 0 ]; then     | 
					
						
							|  |  |  |     setupact-get-update | 
					
						
							|  |  |  |     setupact-install-update | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |   elif [ "$answer" -eq 1 ]; then | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |     setupact-skip-info | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |   fi | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # A progress bar is displayed here. | 
					
						
							|  |  |  | function setupact-progressbar { | 
					
						
							|  |  |  |   ( | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | echo "30" ; sleep 2 | 
					
						
							|  |  |  | echo "# Connecting to the server ..." ; sleep 3 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | setupact-check-connection | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  | echo "50" ; sleep 1 | 
					
						
							|  |  |  | echo "# Check all files ..." ; sleep 1 | 
					
						
							|  |  |  | echo "100" ; sleep 3 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | ) | | 
					
						
							|  |  |  | zenity --progress \
 | 
					
						
							|  |  |  |   --title="$program_name" \
 | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |   --text="Search for new updates ..." \
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |   --width=400 \
 | 
					
						
							|  |  |  |   --height=100 \
 | 
					
						
							|  |  |  |   --percentage=0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ "$?" = 0 ] ; then | 
					
						
							| 
									
										
										
										
											2022-02-18 09:02:13 +01:00
										 |  |  |         setupact-check-info | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | elif [ "$?" = 1 ] ; then | 
					
						
							|  |  |  |         zenity --question \
 | 
					
						
							|  |  |  |                  --title="$program_name" \
 | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  |                  --text="$text_skip_update_question" \
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |                  --width=400 \
 | 
					
						
							|  |  |  |                  --height=100 | 
					
						
							|  |  |  |         answer=$? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if [ "$answer" -eq 0 ]; then | 
					
						
							|  |  |  |               echo "Do nothing!" | 
					
						
							|  |  |  |         elif [ "$answer" -eq 1 ]; then | 
					
						
							|  |  |  |               setupact-progressbar | 
					
						
							|  |  |  |         fi | 
					
						
							|  |  |  | elif [ "$?" = -1 ] ; then | 
					
						
							|  |  |  |         zenity --error \
 | 
					
						
							| 
									
										
										
										
											2022-02-21 09:50:08 +01:00
										 |  |  |           --text="$text_error" | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  |         exit; | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ############################################################################################################################################################### | 
					
						
							| 
									
										
										
										
											2022-02-18 11:44:23 +01:00
										 |  |  | # THE PROGRAM IS STARTED HERE:                                                                                                                                # | 
					
						
							| 
									
										
										
										
											2022-02-17 09:31:45 +01:00
										 |  |  | ############################################################################################################################################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-17 11:12:53 +01:00
										 |  |  | setupact-progressbar |