.
This commit is contained in:
parent
943d485ef1
commit
74b8e50393
@ -1,11 +1,14 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Categories=Graphics;3DGraphics;Engineering;
|
Categories=Graphics;3DGraphics;Engineering;
|
||||||
|
Comment[de_CH]=
|
||||||
Comment=
|
Comment=
|
||||||
Exec=/home/gruinelli/appImages/bambustudio
|
Exec=/home/gruinelli/appImages/bambustudio
|
||||||
|
GenericName[de_CH]=3D Printing Software
|
||||||
GenericName=3D Printing Software
|
GenericName=3D Printing Software
|
||||||
Icon=/home/gruinelli/appImages/bambustudio.png
|
Icon=/home/gruinelli/appImages/bambustudio.png
|
||||||
Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA
|
Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA
|
||||||
MimeType=model/stl;model/3mf;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;x-scheme-handler/bambustudio;
|
MimeType=model/stl;model/3mf;model/3mf;
|
||||||
|
Name[de_CH]=BambuStudio
|
||||||
Name=BambuStudio
|
Name=BambuStudio
|
||||||
NoDisplay=false
|
NoDisplay=false
|
||||||
Path=
|
Path=
|
26
update.py
26
update.py
@ -21,6 +21,9 @@ applications = {
|
|||||||
"assetRegex": "Bambu_Studio_linux_ubuntu_24.*AppImage$" },
|
"assetRegex": "Bambu_Studio_linux_ubuntu_24.*AppImage$" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get script path
|
||||||
|
scriptFolder = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
|
||||||
# Cortesy: https://gist.github.com/yanqd0/c13ed29e29432e3cf3e7c38467f42f51
|
# Cortesy: https://gist.github.com/yanqd0/c13ed29e29432e3cf3e7c38467f42f51
|
||||||
def download(url: str, fname: str, chunk_size=1024):
|
def download(url: str, fname: str, chunk_size=1024):
|
||||||
@ -67,29 +70,36 @@ def main(app):
|
|||||||
|
|
||||||
if assetName:
|
if assetName:
|
||||||
# if file exists
|
# if file exists
|
||||||
if os.path.isfile(assetName):
|
if os.path.isfile(scriptFolder + "/" + assetName):
|
||||||
log.info("Application " + app + " is already up-to-date (" + assetName + ")")
|
log.info("Application " + app + " is already up-to-date (" + assetName + ")")
|
||||||
else: # Download it
|
else: # Download it
|
||||||
# Eg. https://github.com/FreeCAD/FreeCAD-Bundle/releases/download/weekly-builds/FreeCAD_weekly-builds-38467-conda-Linux-x86_64-py311.AppImage
|
# Eg. https://github.com/FreeCAD/FreeCAD-Bundle/releases/download/weekly-builds/FreeCAD_weekly-builds-38467-conda-Linux-x86_64-py311.AppImage
|
||||||
log.debug("url: " + assetUrl)
|
log.debug("url: " + assetUrl)
|
||||||
|
|
||||||
# Download to file with progress bar
|
# Download to file with progress bar
|
||||||
download(assetUrl, assetName + ".tmp")
|
download(assetUrl, scriptFolder + "/" + assetName + ".tmp")
|
||||||
|
|
||||||
# Rename
|
# Rename
|
||||||
os.rename(assetName + ".tmp", assetName)
|
os.rename(scriptFolder + "/" + assetName + ".tmp", assetName)
|
||||||
|
|
||||||
# todo remove old appimages
|
# todo remove old appimages
|
||||||
|
|
||||||
# chmod
|
# chmod
|
||||||
os.chmod(assetName, 0o755)
|
os.chmod(scriptFolder + "/" + assetName, 0o755)
|
||||||
|
|
||||||
# rm link
|
# get user home directory
|
||||||
if os.path.isfile(app):
|
home = os.path.expanduser("~")
|
||||||
os.remove(app)
|
|
||||||
|
|
||||||
# link
|
# link
|
||||||
os.symlink(assetName, app)
|
if os.path.isfile(scriptFolder + "/" + app):
|
||||||
|
os.remove(scriptFolder + "/" + app)
|
||||||
|
os.symlink(scriptFolder + "/" + assetName, scriptFolder + "/" + app)
|
||||||
|
|
||||||
|
# Add link to start menu
|
||||||
|
desktopLink = home + "/.local/share/applications/" + app + ".desktop"
|
||||||
|
if os.path.isfile(desktopLink):
|
||||||
|
os.remove(desktopLink)
|
||||||
|
os.symlink(scriptFolder + "/" + app + ".desktop", desktopLink)
|
||||||
|
|
||||||
# log.info("Application " + app + " updated")
|
# log.info("Application " + app + " updated")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user