2024-07-31 22:56:01 +02:00
#!/usr/bin/env bash
#############################################################################
# Name: Autodesk Fusion 360 - Launcher (Linux) #
# Description: With this file you run Autodesk Fusion 360 on your system. #
# Author: Steve Zabka #
# Author URI: https://cryinkfly.com #
# License: MIT #
# Copyright (c) 2020-2024 #
2024-08-05 22:01:16 +02:00
# Time/Date: 22:00/05.08.2024 #
# Version: 2.0.0-Alpha #
2024-07-31 22:56:01 +02:00
#############################################################################
# Path: SELECTED__INSTALLATION_PATH/bin/autodesk_fusion_launcher.sh
#################################
# Open Autodesk Fusion 360 now! #
#################################
###############################################################################################################################################################
# ALL FUNCTIONS ARE ARRANGED HERE: #
###############################################################################################################################################################
# Check in which directory the autodesk_fusion_launcher.sh file is located.
2024-08-05 19:44:07 +02:00
WINEPREFIX_LOG_FILE = $HOME /.autodesk_fusion/logs/wineprefixes.log
AUTODESK_ROOT_DIRECTORY = $( awk 'NR == 2' " $WINEPREFIX_LOG_FILE " )
WINEPREFIX_DIRECTORY = $( awk 'NR == 3' " $WINEPREFIX_LOG_FILE " )
2024-07-31 22:56:01 +02:00
# This feature will check if there is a new version of Autodesk Fusion 360.
function check_autodesk_fusion_online_versions {
2024-08-05 19:44:07 +02:00
curl -o $HOME /.autodesk_fusion/logs/version.txt -L https://raw.githubusercontent.com/cryinkfly/Autodesk-Fusion-360-for-Linux/main/files/builds/stable-branch/bin/build-version.txt
ONLINE_BUILD_VERSION = $( awk 'NR == 1' $AUTODESK_ROOT_DIRECTORY /logs/version.txt)
ONLINE_INSIDER_BUILD_VERSION = $( awk 'NR == 2' $AUTODESK_ROOT_DIRECTORY /logs/version.txt)
echo " Online Build-Version: $ONLINE_BUILD_VERSION "
echo " Online Insider-Build-Version: $ONLINE_INSIDER_BUILD_VERSION "
2024-08-05 21:07:05 +02:00
#check_versions #Update function not work correctly at the moment!!!
run_autodesk_fusion
2024-07-31 22:56:01 +02:00
}
function check_version_file {
2024-07-31 22:58:50 +02:00
# Find the newest version.txt file from the Autodesk Fusion 360 installation.
2024-08-05 19:44:07 +02:00
AUTODESK_FUSION_API_VERSION = $( find " $WINEPREFIX_DIRECTORY " -name fusion_version.txt -printf "%T+ %p\n" | sort -r 2>& 1 | head -n 1 | sed -r 's/.+0000000000 (.+)/\1/' )
if [ -f " $AUTODESK_FUSION_API_VERSION " ] ; then
2024-07-31 22:58:50 +02:00
echo "The version.txt file exists!"
check_versions
else
echo "The version.txt file does not exist!"
run_autodesk_fusion
fi
2024-07-31 22:56:01 +02:00
}
function check_versions {
2024-07-31 22:58:50 +02:00
# Get the string from the version.txt file from FUSION360_API_VERSION
2024-08-05 19:44:07 +02:00
SYSTEM_BUILD_VERSION = $( cat " $AUTODESK_FUSION_API_VERSION " )
echo " System Build-Version: $SYSTEM_BUILD_VERSION "
if [ " $ONLINE_BUILD_VERSION " = " $SYSTEM_BUILD_VERSION " ] || [ " $ONLINE_INSIDER_BUILD_VERSION " = " $SYSTEM_BUILD_VERSION " ] ; then
2024-07-31 22:58:50 +02:00
echo "Do nothing!"
run_autodesk_fusion
else
backup_old_version
update
fi
2024-07-31 22:56:01 +02:00
}
function backup_old_version {
2024-07-31 22:58:50 +02:00
# Backup the old version of the Autodesk Fusion 360
echo "Backup the old version of the Autodesk Fusion 360!"
# Copy $wineprefix to $wineprefix-backup-$SYSTEM_BUILD_VERSION
2024-08-05 19:44:07 +02:00
cp -r " $WINEPREFIX_DIRECTORY " " $WINEPREFIX_DIRECTORY -backup- $SYSTEM_BUILD_VERSION "
2024-07-31 22:56:01 +02:00
}
function update {
2024-07-31 22:58:50 +02:00
echo "Update the Autodesk Fusion 360 version!"
# Download the newest version of the Autodesk Fusion 360
2024-08-05 19:44:07 +02:00
AUTODESK_FUSION_INSTALLER = " $AUTODESK_ROOT_DIRECTORY /downloads/Fusion360ClientInstaller.exe "
2024-07-31 22:58:50 +02:00
fusion360_installer_url = "https://dl.appstreaming.autodesk.com/production/installers/Fusion%20Client%20Downloader.exe"
2024-08-05 19:44:07 +02:00
curl -L " $fusion360_installer_url " -o $AUTODESK_FUSION_INSTALLER
cp " $AUTODESK_ROOT_DIRECTORY /downloads/Fusion360ClientInstaller.exe " " $SELECTED_DIRECTORY /wineprefixes/default/drive_c/users/ $USER /Downloads "
2024-07-31 22:58:50 +02:00
# Install the newest version of the Autodesk Fusion 360
2024-08-05 19:44:07 +02:00
WINEPREFIX = " $WINEPREFIX_DIRECTORY " timeout -k 2m 1m wine " $WINEPREFIX_DIRECTORY /drive_c/users/ $USER /Downloads/Fusion360installer.exe " --quiet
WINEPREFIX = " $WINEPREFIX_DIRECTORY " timeout -k 2m 1m wine " $WINEPREFIX_DIRECTORY /drive_c/users/ $USER /Downloads/Fusion360installer.exe " --quiet
2024-07-31 22:58:50 +02:00
run_autodesk_fusion
2024-07-31 22:56:01 +02:00
}
# You must change the first part ($HOME/.wineprefixes/fusion360) and the last part (WINEPREFIX="$HOME/.wineprefixes/fusion360") when you have installed Autodesk Fusion 360 into another directory!
function run_autodesk_fusion {
2024-08-05 21:07:05 +02:00
LAUNCHER = " $( find " $WINEPREFIX_DIRECTORY " -name Fusion360.exe -printf "%T+ %p\n" | sort -r 2>& 1 | head -n 1 | sed -r 's/.+0000000000 (.+)/\1/' ) " && echo $LAUNCHER && WINEPREFIX = " $WINEPREFIX_DIRECTORY " WINEDEBUG = -all WINEDEBUG = -d3d wine " $LAUNCHER "
2024-07-31 22:58:50 +02:00
# WINEDEBUG=-all = Logs everything, probably gives too much information in most cases, but may come in handy for subtle issues
# WINEDEBUG=-d3d = Will turn off all d3d messages, and additionally disable checking for GL errors after operations. This may improve performance.
2024-07-31 22:56:01 +02:00
}
###############################################################################################################################################################
# THE PROGRAM IS STARTED HERE: #
###############################################################################################################################################################
check_autodesk_fusion_online_versions