From 869a4ce6345b20563e5fc16a09d77e2688557f45 Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Sun, 4 Dec 2022 12:56:32 -0500 Subject: [PATCH] SuperSlicer installer --- scripts/installers/superslicer-install.sh | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 scripts/installers/superslicer-install.sh diff --git a/scripts/installers/superslicer-install.sh b/scripts/installers/superslicer-install.sh new file mode 100755 index 0000000..2276e26 --- /dev/null +++ b/scripts/installers/superslicer-install.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Automatic install script for SuperSlicer. + +# Import library +source $(dirname ${BASH_SOURCE[0]})/install-lib.sh + +function desktopFile() { + echo 'Creating desktop file' + echo '[Desktop Entry]' > $1 + echo "Name=${2}" >> $1 + echo 'Comment=3D printing slicer' >> $1 + echo "Exec=${3}" >> $1 + echo 'Icon=' >> $1 + echo 'Type=Application' >> $1 + echo 'Terminal=false' >> $1 +} + +program='SuperSlicer' +programPath="${HOME}/.local/bin/${program}.AppImage" +programVersion=$($programPath --help | grep SuperSlicer | filterVersion) +url=$(curl -s https://api.github.com/repos/supermerill/SuperSlicer/releases) +urlVersion=$(echo $url | grep tag_name | filterVersion | head -n 1) +url=$(echo "$url" | grep browser_download | grep ubuntu | head -n 1 | \ + tr -d '"'| awk '{print $2}') + +# Check if installed to the most recent version +checkUptoDate $program $programVersion $urlVersion +echo Installing $program $urlVersion + +# Setting up and downloading package +cd $(dirname $programPath) +rm $programPath +wget $url -O $program.AppImage +chmod +x $programPath + +# Create desktop file +desktopPath="${HOME}/.local/share/applications/${program}.desktop" +if [ ! -f $desktopPath ]; then + desktopFile $desktopPath $program $programPath +fi