@fredlackey/devutils 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -150
- package/package.json +5 -82
- package/bin/dev.js +0 -16
- package/files/README.md +0 -0
- package/files/claude/.claude/commands/setup-context.md +0 -3
- package/files/monorepos/_archive/README.md +0 -36
- package/files/monorepos/_legacy/README.md +0 -36
- package/files/monorepos/ai-docs/README.md +0 -33
- package/files/monorepos/apps/README.md +0 -24
- package/files/monorepos/docs/README.md +0 -40
- package/files/monorepos/packages/README.md +0 -25
- package/files/monorepos/research/README.md +0 -29
- package/files/monorepos/scripts/README.md +0 -24
- package/src/cli.js +0 -72
- package/src/commands/README.md +0 -41
- package/src/commands/configure.js +0 -199
- package/src/commands/identity.js +0 -1630
- package/src/commands/ignore.js +0 -247
- package/src/commands/install.js +0 -526
- package/src/commands/setup.js +0 -246
- package/src/commands/status.js +0 -223
- package/src/commands/update.js +0 -142
- package/src/commands/version.js +0 -100
- package/src/completion.js +0 -284
- package/src/constants.js +0 -45
- package/src/ignore/claude-code.txt +0 -10
- package/src/ignore/docker.txt +0 -18
- package/src/ignore/linux.txt +0 -23
- package/src/ignore/macos.txt +0 -36
- package/src/ignore/node.txt +0 -55
- package/src/ignore/terraform.txt +0 -37
- package/src/ignore/vscode.txt +0 -18
- package/src/ignore/windows.txt +0 -35
- package/src/index.js +0 -0
- package/src/installs/README.md +0 -399
- package/src/installs/adobe-creative-cloud.js +0 -546
- package/src/installs/adobe-creative-cloud.md +0 -605
- package/src/installs/appcleaner.js +0 -321
- package/src/installs/appcleaner.md +0 -699
- package/src/installs/apt-transport-https.js +0 -390
- package/src/installs/apt-transport-https.md +0 -678
- package/src/installs/atomicparsley.js +0 -642
- package/src/installs/atomicparsley.md +0 -795
- package/src/installs/aws-cli.js +0 -797
- package/src/installs/aws-cli.md +0 -727
- package/src/installs/balena-etcher.js +0 -710
- package/src/installs/balena-etcher.md +0 -761
- package/src/installs/bambu-studio.js +0 -1143
- package/src/installs/bambu-studio.md +0 -780
- package/src/installs/bash-completion.js +0 -575
- package/src/installs/bash-completion.md +0 -833
- package/src/installs/bash.js +0 -417
- package/src/installs/bash.md +0 -993
- package/src/installs/beyond-compare.js +0 -603
- package/src/installs/beyond-compare.md +0 -813
- package/src/installs/brave-browser.js +0 -968
- package/src/installs/brave-browser.md +0 -650
- package/src/installs/build-essential.js +0 -529
- package/src/installs/build-essential.md +0 -977
- package/src/installs/ca-certificates.js +0 -618
- package/src/installs/ca-certificates.md +0 -937
- package/src/installs/caffeine.js +0 -508
- package/src/installs/caffeine.md +0 -839
- package/src/installs/camtasia.js +0 -596
- package/src/installs/camtasia.md +0 -762
- package/src/installs/chatgpt.js +0 -476
- package/src/installs/chatgpt.md +0 -814
- package/src/installs/chocolatey.js +0 -456
- package/src/installs/chocolatey.md +0 -661
- package/src/installs/chrome-canary.js +0 -419
- package/src/installs/chrome-canary.md +0 -641
- package/src/installs/chromium.js +0 -667
- package/src/installs/chromium.md +0 -838
- package/src/installs/claude-code.js +0 -576
- package/src/installs/claude-code.md +0 -1173
- package/src/installs/cloudflare-warp.js +0 -900
- package/src/installs/cloudflare-warp.md +0 -1047
- package/src/installs/comet-browser.js +0 -588
- package/src/installs/comet-browser.md +0 -731
- package/src/installs/curl.js +0 -379
- package/src/installs/curl.md +0 -714
- package/src/installs/cursor.js +0 -579
- package/src/installs/cursor.md +0 -970
- package/src/installs/dbeaver.js +0 -924
- package/src/installs/dbeaver.md +0 -939
- package/src/installs/dbschema.js +0 -692
- package/src/installs/dbschema.md +0 -925
- package/src/installs/dependencies.md +0 -453
- package/src/installs/development-tools.js +0 -600
- package/src/installs/development-tools.md +0 -977
- package/src/installs/docker.js +0 -1029
- package/src/installs/docker.md +0 -1109
- package/src/installs/drawio.js +0 -1019
- package/src/installs/drawio.md +0 -795
- package/src/installs/elmedia-player.js +0 -347
- package/src/installs/elmedia-player.md +0 -556
- package/src/installs/ffmpeg.js +0 -889
- package/src/installs/ffmpeg.md +0 -852
- package/src/installs/file.js +0 -464
- package/src/installs/file.md +0 -987
- package/src/installs/gemini-cli.js +0 -811
- package/src/installs/gemini-cli.md +0 -1153
- package/src/installs/git.js +0 -400
- package/src/installs/git.md +0 -907
- package/src/installs/gitego.js +0 -949
- package/src/installs/gitego.md +0 -1172
- package/src/installs/go.js +0 -931
- package/src/installs/go.md +0 -958
- package/src/installs/google-antigravity.js +0 -913
- package/src/installs/google-antigravity.md +0 -1075
- package/src/installs/google-chrome.js +0 -833
- package/src/installs/google-chrome.md +0 -862
- package/src/installs/gpg.js +0 -480
- package/src/installs/gpg.md +0 -1056
- package/src/installs/homebrew.js +0 -1028
- package/src/installs/homebrew.md +0 -988
- package/src/installs/imageoptim.js +0 -968
- package/src/installs/imageoptim.md +0 -1119
- package/src/installs/installers.json +0 -4032
- package/src/installs/installers.json.tmp +0 -3953
- package/src/installs/jq.js +0 -400
- package/src/installs/jq.md +0 -809
- package/src/installs/keyboard-maestro.js +0 -719
- package/src/installs/keyboard-maestro.md +0 -825
- package/src/installs/kiro.js +0 -864
- package/src/installs/kiro.md +0 -1015
- package/src/installs/latex.js +0 -789
- package/src/installs/latex.md +0 -1095
- package/src/installs/lftp.js +0 -356
- package/src/installs/lftp.md +0 -907
- package/src/installs/lsb-release.js +0 -346
- package/src/installs/lsb-release.md +0 -814
- package/src/installs/messenger.js +0 -847
- package/src/installs/messenger.md +0 -900
- package/src/installs/microsoft-office.js +0 -568
- package/src/installs/microsoft-office.md +0 -760
- package/src/installs/microsoft-teams.js +0 -801
- package/src/installs/microsoft-teams.md +0 -886
- package/src/installs/moom.js +0 -326
- package/src/installs/moom.md +0 -570
- package/src/installs/node.js +0 -904
- package/src/installs/node.md +0 -1153
- package/src/installs/nordpass.js +0 -716
- package/src/installs/nordpass.md +0 -921
- package/src/installs/nordvpn.js +0 -892
- package/src/installs/nordvpn.md +0 -1052
- package/src/installs/nvm.js +0 -995
- package/src/installs/nvm.md +0 -1057
- package/src/installs/ohmyzsh.js +0 -529
- package/src/installs/ohmyzsh.md +0 -1094
- package/src/installs/openssh.js +0 -804
- package/src/installs/openssh.md +0 -1056
- package/src/installs/pandoc.js +0 -662
- package/src/installs/pandoc.md +0 -1036
- package/src/installs/parallels-desktop.js +0 -431
- package/src/installs/parallels-desktop.md +0 -446
- package/src/installs/pinentry.js +0 -510
- package/src/installs/pinentry.md +0 -1142
- package/src/installs/pngyu.js +0 -869
- package/src/installs/pngyu.md +0 -896
- package/src/installs/postman.js +0 -799
- package/src/installs/postman.md +0 -940
- package/src/installs/procps.js +0 -425
- package/src/installs/procps.md +0 -851
- package/src/installs/safari-tech-preview.js +0 -374
- package/src/installs/safari-tech-preview.md +0 -533
- package/src/installs/sfnt2woff.js +0 -658
- package/src/installs/sfnt2woff.md +0 -795
- package/src/installs/shellcheck.js +0 -481
- package/src/installs/shellcheck.md +0 -1005
- package/src/installs/slack.js +0 -741
- package/src/installs/slack.md +0 -865
- package/src/installs/snagit.js +0 -585
- package/src/installs/snagit.md +0 -844
- package/src/installs/software-properties-common.js +0 -372
- package/src/installs/software-properties-common.md +0 -805
- package/src/installs/spotify.js +0 -877
- package/src/installs/spotify.md +0 -901
- package/src/installs/studio-3t.js +0 -823
- package/src/installs/studio-3t.md +0 -918
- package/src/installs/sublime-text.js +0 -804
- package/src/installs/sublime-text.md +0 -914
- package/src/installs/superwhisper.js +0 -706
- package/src/installs/superwhisper.md +0 -630
- package/src/installs/tailscale.js +0 -745
- package/src/installs/tailscale.md +0 -1100
- package/src/installs/tar.js +0 -389
- package/src/installs/tar.md +0 -946
- package/src/installs/termius.js +0 -798
- package/src/installs/termius.md +0 -844
- package/src/installs/terraform.js +0 -779
- package/src/installs/terraform.md +0 -899
- package/src/installs/tfenv.js +0 -778
- package/src/installs/tfenv.md +0 -1091
- package/src/installs/tidal.js +0 -771
- package/src/installs/tidal.md +0 -864
- package/src/installs/tmux.js +0 -346
- package/src/installs/tmux.md +0 -1030
- package/src/installs/tree.js +0 -411
- package/src/installs/tree.md +0 -833
- package/src/installs/unzip.js +0 -460
- package/src/installs/unzip.md +0 -879
- package/src/installs/vim.js +0 -421
- package/src/installs/vim.md +0 -1040
- package/src/installs/vlc.js +0 -821
- package/src/installs/vlc.md +0 -927
- package/src/installs/vscode.js +0 -843
- package/src/installs/vscode.md +0 -1002
- package/src/installs/wget.js +0 -420
- package/src/installs/wget.md +0 -791
- package/src/installs/whatsapp.js +0 -729
- package/src/installs/whatsapp.md +0 -854
- package/src/installs/winpty.js +0 -352
- package/src/installs/winpty.md +0 -620
- package/src/installs/woff2.js +0 -553
- package/src/installs/woff2.md +0 -977
- package/src/installs/wsl.js +0 -572
- package/src/installs/wsl.md +0 -699
- package/src/installs/xcode-clt.js +0 -520
- package/src/installs/xcode-clt.md +0 -351
- package/src/installs/xcode.js +0 -560
- package/src/installs/xcode.md +0 -573
- package/src/installs/yarn.js +0 -824
- package/src/installs/yarn.md +0 -1074
- package/src/installs/yq.js +0 -654
- package/src/installs/yq.md +0 -944
- package/src/installs/yt-dlp.js +0 -701
- package/src/installs/yt-dlp.md +0 -946
- package/src/installs/yum-utils.js +0 -297
- package/src/installs/yum-utils.md +0 -648
- package/src/installs/zoom.js +0 -759
- package/src/installs/zoom.md +0 -884
- package/src/installs/zsh.js +0 -455
- package/src/installs/zsh.md +0 -1008
- package/src/scripts/README.md +0 -617
- package/src/scripts/STATUS.md +0 -208
- package/src/scripts/afk.js +0 -411
- package/src/scripts/backup-all.js +0 -746
- package/src/scripts/backup-source.js +0 -727
- package/src/scripts/brewd.js +0 -389
- package/src/scripts/brewi.js +0 -520
- package/src/scripts/brewr.js +0 -527
- package/src/scripts/brews.js +0 -477
- package/src/scripts/brewu.js +0 -504
- package/src/scripts/c.js +0 -201
- package/src/scripts/ccurl.js +0 -341
- package/src/scripts/certbot-crontab-init.js +0 -504
- package/src/scripts/certbot-init.js +0 -657
- package/src/scripts/ch.js +0 -355
- package/src/scripts/claude-danger.js +0 -268
- package/src/scripts/clean-dev.js +0 -435
- package/src/scripts/clear-dns-cache.js +0 -541
- package/src/scripts/clone.js +0 -435
- package/src/scripts/code-all.js +0 -437
- package/src/scripts/count-files.js +0 -211
- package/src/scripts/count-folders.js +0 -211
- package/src/scripts/count.js +0 -264
- package/src/scripts/d.js +0 -219
- package/src/scripts/datauri.js +0 -389
- package/src/scripts/delete-files.js +0 -380
- package/src/scripts/docker-clean.js +0 -426
- package/src/scripts/dp.js +0 -442
- package/src/scripts/e.js +0 -390
- package/src/scripts/empty-trash.js +0 -513
- package/src/scripts/evm.js +0 -444
- package/src/scripts/fetch-github-repos.js +0 -456
- package/src/scripts/get-channel.js +0 -345
- package/src/scripts/get-course.js +0 -399
- package/src/scripts/get-dependencies.js +0 -306
- package/src/scripts/get-folder.js +0 -799
- package/src/scripts/get-tunes.js +0 -426
- package/src/scripts/get-video.js +0 -367
- package/src/scripts/git-backup.js +0 -577
- package/src/scripts/git-clone.js +0 -493
- package/src/scripts/git-pup.js +0 -319
- package/src/scripts/git-push.js +0 -396
- package/src/scripts/h.js +0 -622
- package/src/scripts/hide-desktop-icons.js +0 -499
- package/src/scripts/hide-hidden-files.js +0 -538
- package/src/scripts/install-dependencies-from.js +0 -456
- package/src/scripts/ips.js +0 -663
- package/src/scripts/iso.js +0 -370
- package/src/scripts/killni.js +0 -577
- package/src/scripts/ll.js +0 -467
- package/src/scripts/local-ip.js +0 -325
- package/src/scripts/m.js +0 -524
- package/src/scripts/map.js +0 -309
- package/src/scripts/mkd.js +0 -351
- package/src/scripts/ncu-update-all.js +0 -457
- package/src/scripts/nginx-init.js +0 -718
- package/src/scripts/npmi.js +0 -382
- package/src/scripts/o.js +0 -511
- package/src/scripts/org-by-date.js +0 -338
- package/src/scripts/p.js +0 -224
- package/src/scripts/packages.js +0 -330
- package/src/scripts/path.js +0 -225
- package/src/scripts/ports.js +0 -597
- package/src/scripts/q.js +0 -305
- package/src/scripts/refresh-files.js +0 -394
- package/src/scripts/remove-smaller-files.js +0 -516
- package/src/scripts/rename-files-with-date.js +0 -533
- package/src/scripts/resize-image.js +0 -539
- package/src/scripts/rm-safe.js +0 -669
- package/src/scripts/s.js +0 -540
- package/src/scripts/set-git-public.js +0 -365
- package/src/scripts/show-desktop-icons.js +0 -475
- package/src/scripts/show-hidden-files.js +0 -472
- package/src/scripts/tpa.js +0 -280
- package/src/scripts/tpo.js +0 -280
- package/src/scripts/u.js +0 -505
- package/src/scripts/vpush.js +0 -437
- package/src/scripts/y.js +0 -283
- package/src/utils/README.md +0 -95
- package/src/utils/common/apps.js +0 -143
- package/src/utils/common/display.js +0 -157
- package/src/utils/common/network.js +0 -185
- package/src/utils/common/os.js +0 -294
- package/src/utils/common/package-manager.js +0 -301
- package/src/utils/common/privileges.js +0 -138
- package/src/utils/common/shell.js +0 -261
- package/src/utils/macos/apps.js +0 -228
- package/src/utils/macos/brew.js +0 -315
- package/src/utils/ubuntu/apt.js +0 -307
- package/src/utils/ubuntu/desktop.js +0 -292
- package/src/utils/ubuntu/snap.js +0 -344
- package/src/utils/ubuntu/systemd.js +0 -286
- package/src/utils/windows/choco.js +0 -465
- package/src/utils/windows/env.js +0 -246
- package/src/utils/windows/registry.js +0 -269
- package/src/utils/windows/shell.js +0 -240
- package/src/utils/windows/winget.js +0 -489
|
@@ -1,1143 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview Install Bambu Studio - a feature-rich 3D printing slicer software.
|
|
5
|
-
* @module installs/bambu-studio
|
|
6
|
-
*
|
|
7
|
-
* Bambu Studio is an open-source 3D printing slicer developed by Bambu Lab.
|
|
8
|
-
* It converts 3D model files (STL, OBJ, 3MF, AMF) into G-code for 3D printers.
|
|
9
|
-
* Built upon PrusaSlicer, it provides project-based workflows, optimized slicing,
|
|
10
|
-
* and native AMS (Automatic Material System) integration for multi-color printing.
|
|
11
|
-
*
|
|
12
|
-
* IMPORTANT: Bambu Studio is a GUI application. It requires a desktop environment
|
|
13
|
-
* with OpenGL 2.0+ support and will not work on headless servers.
|
|
14
|
-
*
|
|
15
|
-
* Supported platforms:
|
|
16
|
-
* - macOS: Homebrew cask (brew install --cask bambu-studio)
|
|
17
|
-
* - Ubuntu/Debian: Flatpak from Flathub (com.bambulab.BambuStudio)
|
|
18
|
-
* - Raspberry Pi OS: Pi-Apps (64-bit only, requires aarch64)
|
|
19
|
-
* - Amazon Linux/RHEL: Flatpak from Flathub (not officially supported)
|
|
20
|
-
* - Windows: Chocolatey (choco install bambustudio)
|
|
21
|
-
* - WSL: Flatpak with WSLg for GUI support
|
|
22
|
-
* - Git Bash: Uses Windows Chocolatey
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const fs = require('fs');
|
|
26
|
-
const path = require('path');
|
|
27
|
-
const os = require('../utils/common/os');
|
|
28
|
-
const shell = require('../utils/common/shell');
|
|
29
|
-
const brew = require('../utils/macos/brew');
|
|
30
|
-
const choco = require('../utils/windows/choco');
|
|
31
|
-
const macosApps = require('../utils/macos/apps');
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Whether this installer requires a desktop environment to function.
|
|
35
|
-
* Bambu Studio is a GUI 3D printing slicer requiring OpenGL 2.0+.
|
|
36
|
-
*/
|
|
37
|
-
const REQUIRES_DESKTOP = true;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The macOS application bundle name for Bambu Studio.
|
|
41
|
-
* Used to verify installation via the standard /Applications directory.
|
|
42
|
-
*/
|
|
43
|
-
const MACOS_APP_NAME = 'BambuStudio';
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The Homebrew cask name for Bambu Studio.
|
|
47
|
-
*/
|
|
48
|
-
const HOMEBREW_CASK_NAME = 'bambu-studio';
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The Flatpak application ID for Bambu Studio on Flathub.
|
|
52
|
-
* Note: AppImage is now preferred over Flatpak for Linux installations.
|
|
53
|
-
*/
|
|
54
|
-
const FLATPAK_APP_ID = 'com.bambulab.BambuStudio';
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The GitHub repository for Bambu Studio releases.
|
|
58
|
-
*/
|
|
59
|
-
const GITHUB_REPO = 'bambulab/BambuStudio';
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The installation directory for AppImage executables.
|
|
63
|
-
*/
|
|
64
|
-
const APPIMAGE_INSTALL_DIR = '/usr/local/bin';
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The desktop entry installation directory.
|
|
68
|
-
*/
|
|
69
|
-
const DESKTOP_ENTRY_DIR = '/usr/share/applications';
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The Chocolatey package name for Bambu Studio on Windows.
|
|
73
|
-
*/
|
|
74
|
-
const CHOCOLATEY_PACKAGE_NAME = 'bambustudio';
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The Windows installation path for Bambu Studio.
|
|
78
|
-
*/
|
|
79
|
-
const WINDOWS_INSTALL_PATH = 'C:\\Program Files\\Bambu Studio\\bambu-studio.exe';
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Checks if Bambu Studio is already installed on macOS.
|
|
83
|
-
* Looks for the BambuStudio.app bundle in /Applications.
|
|
84
|
-
*
|
|
85
|
-
* @returns {boolean} True if Bambu Studio is installed on macOS
|
|
86
|
-
*/
|
|
87
|
-
function isInstalledOnMacOS() {
|
|
88
|
-
return macosApps.isAppInstalled(MACOS_APP_NAME);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Checks if Bambu Studio AppImage is installed in the system.
|
|
93
|
-
* Looks for the executable in common installation paths.
|
|
94
|
-
*
|
|
95
|
-
* @returns {boolean} True if Bambu Studio AppImage is installed
|
|
96
|
-
*/
|
|
97
|
-
function isAppImageInstalled() {
|
|
98
|
-
// Check common installation paths
|
|
99
|
-
const commonPaths = [
|
|
100
|
-
'/usr/local/bin/bambu-studio',
|
|
101
|
-
'/usr/local/bin/BambuStudio',
|
|
102
|
-
'/opt/bambu-studio/bambu-studio'
|
|
103
|
-
];
|
|
104
|
-
|
|
105
|
-
for (const path of commonPaths) {
|
|
106
|
-
if (fs.existsSync(path)) {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Check if bambu-studio or BambuStudio command exists in PATH
|
|
112
|
-
return shell.commandExists('bambu-studio') || shell.commandExists('BambuStudio');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Checks if Flatpak is available on the system.
|
|
117
|
-
* Flatpak is required for Linux installations (Ubuntu, WSL, Amazon Linux).
|
|
118
|
-
*
|
|
119
|
-
* @returns {boolean} True if the flatpak command exists in PATH
|
|
120
|
-
*/
|
|
121
|
-
function isFlatpakAvailable() {
|
|
122
|
-
return shell.commandExists('flatpak');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Checks if Bambu Studio is installed via Flatpak.
|
|
127
|
-
* Queries the Flatpak list for the Bambu Studio application ID.
|
|
128
|
-
* Checks both system-level and user-level installations.
|
|
129
|
-
*
|
|
130
|
-
* @returns {Promise<boolean>} True if Bambu Studio is installed via Flatpak
|
|
131
|
-
*/
|
|
132
|
-
async function isInstalledViaFlatpak() {
|
|
133
|
-
if (!isFlatpakAvailable()) {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Check system-level installation
|
|
138
|
-
let result = await shell.exec(`flatpak list --app | grep -i "${FLATPAK_APP_ID}"`);
|
|
139
|
-
if (result.code === 0 && result.stdout.includes(FLATPAK_APP_ID)) {
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Check user-level installation
|
|
144
|
-
result = await shell.exec(`flatpak list --app --user | grep -i "${FLATPAK_APP_ID}"`);
|
|
145
|
-
return result.code === 0 && result.stdout.includes(FLATPAK_APP_ID);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Checks if Bambu Studio is already installed on Windows.
|
|
150
|
-
* Looks for the executable in the standard Program Files location.
|
|
151
|
-
*
|
|
152
|
-
* @returns {Promise<boolean>} True if Bambu Studio is installed on Windows
|
|
153
|
-
*/
|
|
154
|
-
async function isInstalledOnWindows() {
|
|
155
|
-
// Check if the executable exists at the expected location
|
|
156
|
-
const result = await shell.exec(`powershell -NoProfile -Command "Test-Path '${WINDOWS_INSTALL_PATH}'"`);
|
|
157
|
-
return result.stdout.trim().toLowerCase() === 'true';
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Checks if Bambu Studio is installed on Raspberry Pi via Pi-Apps.
|
|
162
|
-
* Pi-Apps installs Bambu Studio to a local binary location.
|
|
163
|
-
*
|
|
164
|
-
* @returns {Promise<boolean>} True if Bambu Studio is installed
|
|
165
|
-
*/
|
|
166
|
-
async function isInstalledOnRaspbian() {
|
|
167
|
-
// Check for the bambu-studio command in PATH
|
|
168
|
-
if (shell.commandExists('bambu-studio')) {
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Check for desktop file created by Pi-Apps
|
|
173
|
-
const homeDir = os.getHomeDir();
|
|
174
|
-
const desktopFilePath = path.join(homeDir, '.local', 'share', 'applications');
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
const files = fs.readdirSync(desktopFilePath);
|
|
178
|
-
for (const file of files) {
|
|
179
|
-
if (file.toLowerCase().includes('bambu')) {
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
} catch {
|
|
184
|
-
// Directory doesn't exist or can't be read - not installed
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Gets the latest AppImage download URL from GitHub releases.
|
|
192
|
-
* Detects the system architecture and chooses the appropriate AppImage variant.
|
|
193
|
-
*
|
|
194
|
-
* @returns {Promise<{url: string, filename: string} | null>} Download URL and filename, or null if not found
|
|
195
|
-
*/
|
|
196
|
-
async function getLatestAppImageUrl() {
|
|
197
|
-
try {
|
|
198
|
-
// Fetch the latest release info from GitHub API
|
|
199
|
-
const apiUrl = `https://api.github.com/repos/${GITHUB_REPO}/releases/latest`;
|
|
200
|
-
const result = await shell.exec(`curl -s "${apiUrl}"`);
|
|
201
|
-
|
|
202
|
-
if (result.code !== 0 || !result.stdout) {
|
|
203
|
-
console.error('Failed to fetch latest release information from GitHub.');
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const release = JSON.parse(result.stdout);
|
|
208
|
-
const assets = release.assets || [];
|
|
209
|
-
|
|
210
|
-
// Determine which AppImage to download based on Ubuntu version or distribution
|
|
211
|
-
// Prefer ubuntu-22.04 for broader compatibility, unless on a newer system
|
|
212
|
-
let preferredVariant = 'ubuntu-22.04';
|
|
213
|
-
|
|
214
|
-
// Check if running Ubuntu 24.04 or newer
|
|
215
|
-
if (fs.existsSync('/etc/os-release')) {
|
|
216
|
-
const osReleaseResult = await shell.exec('cat /etc/os-release | grep VERSION_ID');
|
|
217
|
-
if (osReleaseResult.code === 0 && osReleaseResult.stdout.includes('24.04')) {
|
|
218
|
-
preferredVariant = 'ubuntu-24.04';
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// Look for AppImage assets (prioritize preferred variant, then Fedora, then any Ubuntu)
|
|
223
|
-
let selectedAsset = null;
|
|
224
|
-
|
|
225
|
-
// First try: preferred Ubuntu variant
|
|
226
|
-
selectedAsset = assets.find(asset =>
|
|
227
|
-
asset.name.endsWith('.AppImage') &&
|
|
228
|
-
asset.name.includes(preferredVariant)
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
// Second try: Fedora variant (good for RHEL-based systems)
|
|
232
|
-
if (!selectedAsset) {
|
|
233
|
-
selectedAsset = assets.find(asset =>
|
|
234
|
-
asset.name.endsWith('.AppImage') &&
|
|
235
|
-
asset.name.includes('fedora')
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Third try: any Ubuntu variant
|
|
240
|
-
if (!selectedAsset) {
|
|
241
|
-
selectedAsset = assets.find(asset =>
|
|
242
|
-
asset.name.endsWith('.AppImage') &&
|
|
243
|
-
asset.name.includes('ubuntu')
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Last resort: any AppImage
|
|
248
|
-
if (!selectedAsset) {
|
|
249
|
-
selectedAsset = assets.find(asset => asset.name.endsWith('.AppImage'));
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (!selectedAsset) {
|
|
253
|
-
console.error('No AppImage found in the latest release.');
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return {
|
|
258
|
-
url: selectedAsset.browser_download_url,
|
|
259
|
-
filename: selectedAsset.name
|
|
260
|
-
};
|
|
261
|
-
} catch (error) {
|
|
262
|
-
console.error('Error fetching AppImage URL:', error.message);
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Creates a desktop entry file for Bambu Studio AppImage.
|
|
269
|
-
* This allows the application to appear in desktop menus.
|
|
270
|
-
*
|
|
271
|
-
* @param {string} execPath - The full path to the AppImage executable
|
|
272
|
-
* @returns {Promise<boolean>} True if desktop entry was created successfully
|
|
273
|
-
*/
|
|
274
|
-
async function createDesktopEntry(execPath) {
|
|
275
|
-
const desktopEntry = `[Desktop Entry]
|
|
276
|
-
Name=Bambu Studio
|
|
277
|
-
Comment=3D printing slicer for Bambu Lab printers
|
|
278
|
-
Exec=${execPath}
|
|
279
|
-
Icon=bambu-studio
|
|
280
|
-
Terminal=false
|
|
281
|
-
Type=Application
|
|
282
|
-
Categories=Graphics;3DGraphics;Engineering;
|
|
283
|
-
MimeType=model/stl;application/x-3mf;model/x.stl-binary;model/x.stl-ascii;application/sla;
|
|
284
|
-
`;
|
|
285
|
-
|
|
286
|
-
const desktopFilePath = path.join(DESKTOP_ENTRY_DIR, 'bambu-studio.desktop');
|
|
287
|
-
|
|
288
|
-
try {
|
|
289
|
-
// Create desktop entry directory if it doesn't exist
|
|
290
|
-
await shell.exec(`sudo mkdir -p ${DESKTOP_ENTRY_DIR}`);
|
|
291
|
-
|
|
292
|
-
// Write desktop entry file
|
|
293
|
-
const tempFile = `/tmp/bambu-studio.desktop`;
|
|
294
|
-
fs.writeFileSync(tempFile, desktopEntry);
|
|
295
|
-
|
|
296
|
-
const copyResult = await shell.exec(`sudo mv ${tempFile} ${desktopFilePath}`);
|
|
297
|
-
if (copyResult.code !== 0) {
|
|
298
|
-
console.error('Failed to create desktop entry:', copyResult.stderr);
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// Make desktop entry executable
|
|
303
|
-
await shell.exec(`sudo chmod 644 ${desktopFilePath}`);
|
|
304
|
-
|
|
305
|
-
// Update desktop database
|
|
306
|
-
await shell.exec('sudo update-desktop-database 2>/dev/null || true');
|
|
307
|
-
|
|
308
|
-
return true;
|
|
309
|
-
} catch (error) {
|
|
310
|
-
console.error('Error creating desktop entry:', error.message);
|
|
311
|
-
return false;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Downloads and installs Bambu Studio AppImage.
|
|
317
|
-
* AppImages are self-contained executables that work across Linux distributions.
|
|
318
|
-
*
|
|
319
|
-
* @returns {Promise<boolean>} True if installation succeeded
|
|
320
|
-
*/
|
|
321
|
-
async function installAppImage() {
|
|
322
|
-
console.log('Fetching latest Bambu Studio AppImage from GitHub...');
|
|
323
|
-
|
|
324
|
-
// Get the download URL
|
|
325
|
-
const downloadInfo = await getLatestAppImageUrl();
|
|
326
|
-
if (!downloadInfo) {
|
|
327
|
-
console.error('Could not determine AppImage download URL.');
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
console.log(`Found AppImage: ${downloadInfo.filename}`);
|
|
332
|
-
console.log('Downloading Bambu Studio AppImage...');
|
|
333
|
-
console.log('Note: This may take several minutes depending on your connection.');
|
|
334
|
-
|
|
335
|
-
// Download the AppImage to /tmp
|
|
336
|
-
const tempPath = `/tmp/${downloadInfo.filename}`;
|
|
337
|
-
const downloadResult = await shell.exec(`curl -L -o "${tempPath}" "${downloadInfo.url}"`);
|
|
338
|
-
|
|
339
|
-
if (downloadResult.code !== 0) {
|
|
340
|
-
console.error('Failed to download AppImage:', downloadResult.stderr);
|
|
341
|
-
return false;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
console.log('AppImage downloaded successfully.');
|
|
345
|
-
|
|
346
|
-
// Make the AppImage executable
|
|
347
|
-
console.log('Installing AppImage...');
|
|
348
|
-
const chmodResult = await shell.exec(`chmod +x "${tempPath}"`);
|
|
349
|
-
if (chmodResult.code !== 0) {
|
|
350
|
-
console.error('Failed to make AppImage executable:', chmodResult.stderr);
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// Install to /usr/local/bin with a simplified name
|
|
355
|
-
const installPath = `${APPIMAGE_INSTALL_DIR}/bambu-studio`;
|
|
356
|
-
const installResult = await shell.exec(`sudo mv "${tempPath}" "${installPath}"`);
|
|
357
|
-
|
|
358
|
-
if (installResult.code !== 0) {
|
|
359
|
-
console.error('Failed to install AppImage:', installResult.stderr);
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
console.log(`Bambu Studio installed to ${installPath}`);
|
|
364
|
-
|
|
365
|
-
// Create desktop entry
|
|
366
|
-
console.log('Creating desktop entry...');
|
|
367
|
-
const desktopCreated = await createDesktopEntry(installPath);
|
|
368
|
-
if (!desktopCreated) {
|
|
369
|
-
console.log('Warning: Desktop entry creation failed. You can still launch from command line.');
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
return true;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Installs Flatpak if not already present on a Debian-based system.
|
|
377
|
-
* This is a prerequisite for installing Bambu Studio on Linux via Flatpak.
|
|
378
|
-
*
|
|
379
|
-
* @returns {Promise<boolean>} True if Flatpak is available after this function
|
|
380
|
-
*/
|
|
381
|
-
async function ensureFlatpakInstalled() {
|
|
382
|
-
if (isFlatpakAvailable()) {
|
|
383
|
-
return true;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
console.log('Flatpak is not installed. Installing Flatpak...');
|
|
387
|
-
|
|
388
|
-
// Update apt cache first
|
|
389
|
-
const updateResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y');
|
|
390
|
-
if (updateResult.code !== 0) {
|
|
391
|
-
console.error('Failed to update apt cache:', updateResult.stderr);
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// Install Flatpak
|
|
396
|
-
const installResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get install -y flatpak');
|
|
397
|
-
if (installResult.code !== 0) {
|
|
398
|
-
console.error('Failed to install Flatpak:', installResult.stderr);
|
|
399
|
-
return false;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
console.log('Flatpak installed successfully.');
|
|
403
|
-
return true;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Checks if the system has a display environment (not headless).
|
|
408
|
-
* Flatpak requires a display environment and D-Bus to function properly.
|
|
409
|
-
*
|
|
410
|
-
* @returns {boolean} True if a display environment is detected
|
|
411
|
-
*/
|
|
412
|
-
function hasDisplayEnvironment() {
|
|
413
|
-
// Check for common display environment variables
|
|
414
|
-
const hasDisplay = process.env.DISPLAY ||
|
|
415
|
-
process.env.WAYLAND_DISPLAY ||
|
|
416
|
-
process.env.XDG_CURRENT_DESKTOP;
|
|
417
|
-
return Boolean(hasDisplay);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Adds the Flathub repository if not already configured.
|
|
422
|
-
* Flathub is the source for the Bambu Studio Flatpak package.
|
|
423
|
-
*
|
|
424
|
-
* Tries system-level installation first, falls back to user-level if system bus unavailable.
|
|
425
|
-
* This enables installation in Docker/containerized environments with limited D-Bus access.
|
|
426
|
-
*
|
|
427
|
-
* @returns {Promise<{success: boolean, userLevel: boolean}>} Result object with success status and whether user-level was used
|
|
428
|
-
*/
|
|
429
|
-
async function ensureFlathubConfigured() {
|
|
430
|
-
// Check if Flathub is already configured (system-level)
|
|
431
|
-
let checkResult = await shell.exec('flatpak remote-list | grep -i flathub');
|
|
432
|
-
if (checkResult.code === 0 && checkResult.stdout.includes('flathub')) {
|
|
433
|
-
return { success: true, userLevel: false };
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// Check if Flathub is already configured (user-level)
|
|
437
|
-
checkResult = await shell.exec('flatpak remote-list --user | grep -i flathub');
|
|
438
|
-
if (checkResult.code === 0 && checkResult.stdout.includes('flathub')) {
|
|
439
|
-
return { success: true, userLevel: true };
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
console.log('Adding Flathub repository...');
|
|
443
|
-
|
|
444
|
-
// Try system-level first (preferred for desktop systems)
|
|
445
|
-
let addResult = await shell.exec(
|
|
446
|
-
'flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo'
|
|
447
|
-
);
|
|
448
|
-
|
|
449
|
-
if (addResult.code === 0) {
|
|
450
|
-
console.log('Flathub repository added successfully.');
|
|
451
|
-
return { success: true, userLevel: false };
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// If system-level fails due to D-Bus issues, try user-level installation
|
|
455
|
-
if (addResult.stderr.includes('system bus') || addResult.stderr.includes('D-Bus')) {
|
|
456
|
-
console.log('System-level Flatpak unavailable (no system D-Bus). Trying user-level installation...');
|
|
457
|
-
|
|
458
|
-
addResult = await shell.exec(
|
|
459
|
-
'flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo'
|
|
460
|
-
);
|
|
461
|
-
|
|
462
|
-
if (addResult.code === 0) {
|
|
463
|
-
console.log('Flathub repository added successfully (user-level).');
|
|
464
|
-
return { success: true, userLevel: true };
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
// Both system and user-level failed
|
|
469
|
-
console.error('Failed to add Flathub repository:', addResult.stderr);
|
|
470
|
-
console.log('');
|
|
471
|
-
console.log('Troubleshooting:');
|
|
472
|
-
console.log(' 1. Ensure D-Bus is running (for GUI applications)');
|
|
473
|
-
console.log(' 2. Try manually: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo');
|
|
474
|
-
console.log(' 3. If in Docker, ensure the container has proper D-Bus configuration');
|
|
475
|
-
|
|
476
|
-
return { success: false, userLevel: false };
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Installs Flatpak if not already present on Amazon Linux/RHEL.
|
|
481
|
-
* Uses dnf as the package manager.
|
|
482
|
-
*
|
|
483
|
-
* @returns {Promise<boolean>} True if Flatpak is available after this function
|
|
484
|
-
*/
|
|
485
|
-
async function ensureFlatpakInstalledRHEL() {
|
|
486
|
-
if (isFlatpakAvailable()) {
|
|
487
|
-
return true;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
console.log('Flatpak is not installed. Installing Flatpak...');
|
|
491
|
-
|
|
492
|
-
// Determine which package manager to use (dnf preferred over yum)
|
|
493
|
-
const packageManager = shell.commandExists('dnf') ? 'dnf' : 'yum';
|
|
494
|
-
|
|
495
|
-
const installResult = await shell.exec(`sudo ${packageManager} install -y flatpak`);
|
|
496
|
-
if (installResult.code !== 0) {
|
|
497
|
-
console.error('Failed to install Flatpak:', installResult.stderr);
|
|
498
|
-
return false;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
console.log('Flatpak installed successfully.');
|
|
502
|
-
return true;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Install Bambu Studio on macOS using Homebrew Cask.
|
|
507
|
-
*
|
|
508
|
-
* Prerequisites:
|
|
509
|
-
* - macOS 11 (Big Sur) or later
|
|
510
|
-
* - Homebrew package manager installed
|
|
511
|
-
* - Terminal access
|
|
512
|
-
*
|
|
513
|
-
* The installation uses `brew install --cask bambu-studio` which downloads
|
|
514
|
-
* and installs the application to /Applications/BambuStudio.app.
|
|
515
|
-
*
|
|
516
|
-
* @returns {Promise<void>}
|
|
517
|
-
*/
|
|
518
|
-
async function install_macos() {
|
|
519
|
-
// Check if Homebrew is available before attempting installation
|
|
520
|
-
if (!brew.isInstalled()) {
|
|
521
|
-
console.log('Homebrew is not installed. Please install Homebrew first:');
|
|
522
|
-
console.log(' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
// Check if already installed (idempotency check)
|
|
527
|
-
if (isInstalledOnMacOS()) {
|
|
528
|
-
console.log('Bambu Studio is already installed.');
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
console.log('Installing Bambu Studio via Homebrew Cask...');
|
|
533
|
-
|
|
534
|
-
// Install using the brew cask command
|
|
535
|
-
const result = await brew.installCask(HOMEBREW_CASK_NAME);
|
|
536
|
-
|
|
537
|
-
if (!result.success) {
|
|
538
|
-
console.error('Failed to install Bambu Studio:', result.output);
|
|
539
|
-
console.log('');
|
|
540
|
-
console.log('Troubleshooting:');
|
|
541
|
-
console.log(' 1. Run "brew update" and retry');
|
|
542
|
-
console.log(' 2. If macOS blocks the app, go to System Settings > Privacy & Security');
|
|
543
|
-
console.log(' and click "Open Anyway"');
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
// Verify installation succeeded
|
|
548
|
-
if (isInstalledOnMacOS()) {
|
|
549
|
-
console.log('Bambu Studio installed successfully.');
|
|
550
|
-
console.log('Location: /Applications/BambuStudio.app');
|
|
551
|
-
console.log('');
|
|
552
|
-
console.log('Launch with: open /Applications/BambuStudio.app');
|
|
553
|
-
} else {
|
|
554
|
-
console.error('Installation completed but Bambu Studio was not found in /Applications.');
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* Install Bambu Studio on Ubuntu/Debian using AppImage from GitHub.
|
|
560
|
-
*
|
|
561
|
-
* IMPORTANT: AppImage is now the preferred installation method for Linux.
|
|
562
|
-
* AppImages are self-contained executables that work in Docker containers
|
|
563
|
-
* and don't require user namespaces or D-Bus configuration.
|
|
564
|
-
*
|
|
565
|
-
* Prerequisites:
|
|
566
|
-
* - Ubuntu 20.04+ or Debian 11+ (64-bit)
|
|
567
|
-
* - X11 or Wayland display server (for GUI applications)
|
|
568
|
-
* - sudo privileges
|
|
569
|
-
* - curl installed
|
|
570
|
-
*
|
|
571
|
-
* @returns {Promise<void>}
|
|
572
|
-
*/
|
|
573
|
-
async function install_ubuntu() {
|
|
574
|
-
// Check if already installed via AppImage (idempotency check)
|
|
575
|
-
if (isAppImageInstalled()) {
|
|
576
|
-
console.log('Bambu Studio is already installed.');
|
|
577
|
-
return;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
// Check for display environment before proceeding (Bambu Studio requires GUI)
|
|
581
|
-
if (!hasDisplayEnvironment()) {
|
|
582
|
-
console.log('Bambu Studio is a GUI application and requires a desktop environment.');
|
|
583
|
-
console.log('No display environment detected (DISPLAY, WAYLAND_DISPLAY, or XDG_CURRENT_DESKTOP).');
|
|
584
|
-
console.log('');
|
|
585
|
-
console.log('This application cannot be installed on:');
|
|
586
|
-
console.log(' - Headless servers');
|
|
587
|
-
console.log(' - Docker containers without display forwarding');
|
|
588
|
-
console.log(' - SSH sessions without X11 forwarding');
|
|
589
|
-
console.log('');
|
|
590
|
-
console.log('Please run this installer on a system with a desktop environment.');
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// Install using AppImage
|
|
595
|
-
console.log('Installing Bambu Studio via AppImage from GitHub...');
|
|
596
|
-
const success = await installAppImage();
|
|
597
|
-
|
|
598
|
-
if (!success) {
|
|
599
|
-
console.error('Failed to install Bambu Studio AppImage.');
|
|
600
|
-
console.log('');
|
|
601
|
-
console.log('Troubleshooting:');
|
|
602
|
-
console.log(' 1. Ensure curl is installed: sudo apt-get install -y curl');
|
|
603
|
-
console.log(' 2. Check your internet connection');
|
|
604
|
-
console.log(' 3. Visit https://github.com/bambulab/BambuStudio/releases for manual download');
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// Verify installation succeeded
|
|
609
|
-
if (isAppImageInstalled()) {
|
|
610
|
-
console.log('');
|
|
611
|
-
console.log('Bambu Studio installed successfully.');
|
|
612
|
-
console.log('');
|
|
613
|
-
console.log('Launch with: bambu-studio');
|
|
614
|
-
console.log('Location: /usr/local/bin/bambu-studio');
|
|
615
|
-
} else {
|
|
616
|
-
console.error('Installation completed but Bambu Studio was not found.');
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
* Install Bambu Studio on Raspberry Pi OS using Pi-Apps.
|
|
622
|
-
*
|
|
623
|
-
* IMPORTANT: Bambu Studio requires 64-bit Raspberry Pi OS (aarch64).
|
|
624
|
-
* It will NOT work on 32-bit (armv7l) installations.
|
|
625
|
-
*
|
|
626
|
-
* Prerequisites:
|
|
627
|
-
* - Raspberry Pi OS (64-bit only) - Bookworm or later recommended
|
|
628
|
-
* - Raspberry Pi 3B+ or later (64-bit capable hardware)
|
|
629
|
-
* - Desktop environment (GUI required)
|
|
630
|
-
* - Pi-Apps package manager (installed automatically if missing)
|
|
631
|
-
*
|
|
632
|
-
* NOTE: The Pi-Apps installation compiles from source on ARM, which can
|
|
633
|
-
* take significant time and system resources.
|
|
634
|
-
*
|
|
635
|
-
* @returns {Promise<void>}
|
|
636
|
-
*/
|
|
637
|
-
async function install_raspbian() {
|
|
638
|
-
// Check if already installed (idempotency check)
|
|
639
|
-
const alreadyInstalled = await isInstalledOnRaspbian();
|
|
640
|
-
if (alreadyInstalled) {
|
|
641
|
-
console.log('Bambu Studio is already installed.');
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
// Verify we are running on 64-bit Raspberry Pi OS
|
|
646
|
-
// Bambu Studio ARM builds only support aarch64 architecture
|
|
647
|
-
const archResult = await shell.exec('uname -m');
|
|
648
|
-
const architecture = archResult.stdout.trim();
|
|
649
|
-
|
|
650
|
-
if (architecture !== 'aarch64') {
|
|
651
|
-
console.log('Bambu Studio requires 64-bit Raspberry Pi OS (aarch64).');
|
|
652
|
-
console.log(`Current architecture: ${architecture}`);
|
|
653
|
-
console.log('');
|
|
654
|
-
console.log('Please install 64-bit Raspberry Pi OS from:');
|
|
655
|
-
console.log(' https://www.raspberrypi.com/software/operating-systems/');
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
// Check if Pi-Apps is already installed
|
|
660
|
-
const homeDir = os.getHomeDir();
|
|
661
|
-
const piAppsPath = path.join(homeDir, 'pi-apps', 'manage');
|
|
662
|
-
const piAppsInstalled = fs.existsSync(piAppsPath);
|
|
663
|
-
|
|
664
|
-
if (!piAppsInstalled) {
|
|
665
|
-
console.log('Installing Pi-Apps (required for Bambu Studio on Raspberry Pi)...');
|
|
666
|
-
|
|
667
|
-
// Install Pi-Apps from the official repository
|
|
668
|
-
const piAppsResult = await shell.exec(
|
|
669
|
-
'wget -qO- https://raw.githubusercontent.com/Botspot/pi-apps/master/install | bash'
|
|
670
|
-
);
|
|
671
|
-
|
|
672
|
-
if (piAppsResult.code !== 0) {
|
|
673
|
-
console.error('Failed to install Pi-Apps:', piAppsResult.stderr);
|
|
674
|
-
console.log('');
|
|
675
|
-
console.log('You may need to install required dependencies first:');
|
|
676
|
-
console.log(' sudo apt-get update && sudo apt-get install -y yad curl wget');
|
|
677
|
-
return;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
console.log('Pi-Apps installed successfully.');
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
console.log('Installing Bambu Studio via Pi-Apps...');
|
|
684
|
-
console.log('Note: This may take a significant amount of time on Raspberry Pi hardware.');
|
|
685
|
-
|
|
686
|
-
// Install Bambu Studio using Pi-Apps CLI
|
|
687
|
-
// The app name in Pi-Apps is "Bambu Studio" (with space, case-sensitive)
|
|
688
|
-
const installResult = await shell.exec(`"${piAppsPath}" install "Bambu Studio"`);
|
|
689
|
-
|
|
690
|
-
if (installResult.code !== 0) {
|
|
691
|
-
console.error('Failed to install Bambu Studio via Pi-Apps:', installResult.stderr);
|
|
692
|
-
console.log('');
|
|
693
|
-
console.log('Troubleshooting:');
|
|
694
|
-
console.log(' 1. If you run out of memory, increase swap space:');
|
|
695
|
-
console.log(' sudo dphys-swapfile swapoff');
|
|
696
|
-
console.log(' sudo sed -i "s/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/" /etc/dphys-swapfile');
|
|
697
|
-
console.log(' sudo dphys-swapfile setup');
|
|
698
|
-
console.log(' sudo dphys-swapfile swapon');
|
|
699
|
-
console.log(' 2. Ensure you have at least 4GB RAM (Raspberry Pi 4/5 recommended)');
|
|
700
|
-
return;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
// Verify installation succeeded
|
|
704
|
-
const verifyInstalled = await isInstalledOnRaspbian();
|
|
705
|
-
if (verifyInstalled) {
|
|
706
|
-
console.log('Bambu Studio installed successfully.');
|
|
707
|
-
console.log('');
|
|
708
|
-
console.log('Launch from the desktop menu under Engineering, or via: bambu-studio');
|
|
709
|
-
} else {
|
|
710
|
-
console.error('Installation completed but Bambu Studio was not found.');
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Install Bambu Studio on Amazon Linux/RHEL using AppImage.
|
|
716
|
-
*
|
|
717
|
-
* IMPORTANT: Amazon Linux is primarily a server OS without a desktop environment.
|
|
718
|
-
* Bambu Studio is a GUI application and requires a display. This platform is
|
|
719
|
-
* NOT recommended for Bambu Studio usage.
|
|
720
|
-
*
|
|
721
|
-
* Prerequisites:
|
|
722
|
-
* - Amazon Linux 2023, Amazon Linux 2, RHEL 8+, or Fedora 35+
|
|
723
|
-
* - Desktop environment with X11/Wayland support
|
|
724
|
-
* - sudo privileges
|
|
725
|
-
* - curl installed
|
|
726
|
-
*
|
|
727
|
-
* @returns {Promise<void>}
|
|
728
|
-
*/
|
|
729
|
-
async function install_amazon_linux() {
|
|
730
|
-
// Check if already installed via AppImage (idempotency check)
|
|
731
|
-
if (isAppImageInstalled()) {
|
|
732
|
-
console.log('Bambu Studio is already installed.');
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
console.log('Note: Amazon Linux is primarily a server OS. Bambu Studio requires');
|
|
737
|
-
console.log('a desktop environment with display capabilities.');
|
|
738
|
-
console.log('');
|
|
739
|
-
|
|
740
|
-
// Check for display environment before proceeding (Bambu Studio requires GUI)
|
|
741
|
-
if (!hasDisplayEnvironment()) {
|
|
742
|
-
console.log('Bambu Studio is a GUI application and requires a desktop environment.');
|
|
743
|
-
console.log('No display environment detected (DISPLAY, WAYLAND_DISPLAY, or XDG_CURRENT_DESKTOP).');
|
|
744
|
-
console.log('');
|
|
745
|
-
console.log('This application cannot be installed on:');
|
|
746
|
-
console.log(' - Headless servers');
|
|
747
|
-
console.log(' - Docker containers without display forwarding');
|
|
748
|
-
console.log(' - SSH sessions without X11 forwarding');
|
|
749
|
-
console.log('');
|
|
750
|
-
console.log('Please run this installer on a system with a desktop environment.');
|
|
751
|
-
return;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
// Install using AppImage
|
|
755
|
-
console.log('Installing Bambu Studio via AppImage from GitHub...');
|
|
756
|
-
const success = await installAppImage();
|
|
757
|
-
|
|
758
|
-
if (!success) {
|
|
759
|
-
console.error('Failed to install Bambu Studio AppImage.');
|
|
760
|
-
console.log('');
|
|
761
|
-
console.log('Troubleshooting:');
|
|
762
|
-
console.log(' 1. Ensure curl is installed: sudo dnf install -y curl');
|
|
763
|
-
console.log(' 2. Check your internet connection');
|
|
764
|
-
console.log(' 3. Ensure you have a desktop environment installed:');
|
|
765
|
-
console.log(' sudo dnf groupinstall -y "GNOME Desktop Environment"');
|
|
766
|
-
console.log(' 4. Visit https://github.com/bambulab/BambuStudio/releases for manual download');
|
|
767
|
-
return;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
// Verify installation succeeded
|
|
771
|
-
if (isAppImageInstalled()) {
|
|
772
|
-
console.log('');
|
|
773
|
-
console.log('Bambu Studio installed successfully.');
|
|
774
|
-
console.log('');
|
|
775
|
-
console.log('Launch with: bambu-studio');
|
|
776
|
-
console.log('Location: /usr/local/bin/bambu-studio');
|
|
777
|
-
} else {
|
|
778
|
-
console.error('Installation completed but Bambu Studio was not found.');
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
/**
|
|
783
|
-
* Install Bambu Studio on Windows using Chocolatey.
|
|
784
|
-
*
|
|
785
|
-
* Prerequisites:
|
|
786
|
-
* - Windows 10 or Windows 11 (64-bit)
|
|
787
|
-
* - Chocolatey package manager installed
|
|
788
|
-
* - Administrator PowerShell or Command Prompt
|
|
789
|
-
*
|
|
790
|
-
* NOTE: The Chocolatey package depends on vcredist140 (Visual C++ Redistributable),
|
|
791
|
-
* which will be installed automatically if not present.
|
|
792
|
-
*
|
|
793
|
-
* @returns {Promise<void>}
|
|
794
|
-
*/
|
|
795
|
-
async function install_windows() {
|
|
796
|
-
// Check if already installed (idempotency check)
|
|
797
|
-
const alreadyInstalled = await isInstalledOnWindows();
|
|
798
|
-
if (alreadyInstalled) {
|
|
799
|
-
console.log('Bambu Studio is already installed.');
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
// Check if Chocolatey is available
|
|
804
|
-
if (!choco.isInstalled()) {
|
|
805
|
-
console.log('Chocolatey is not installed. Please install Chocolatey first:');
|
|
806
|
-
console.log('');
|
|
807
|
-
console.log('Run this command in an Administrator PowerShell:');
|
|
808
|
-
console.log(' Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(\'https://community.chocolatey.org/install.ps1\'))');
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
console.log('Installing Bambu Studio via Chocolatey...');
|
|
813
|
-
|
|
814
|
-
// Install using Chocolatey
|
|
815
|
-
// The -y flag automatically confirms the installation
|
|
816
|
-
const result = await choco.install(CHOCOLATEY_PACKAGE_NAME);
|
|
817
|
-
|
|
818
|
-
if (!result.success) {
|
|
819
|
-
console.error('Failed to install Bambu Studio:', result.output);
|
|
820
|
-
console.log('');
|
|
821
|
-
console.log('Troubleshooting:');
|
|
822
|
-
console.log(' 1. Ensure you are running as Administrator');
|
|
823
|
-
console.log(' 2. If Visual C++ Redistributable fails, install it manually:');
|
|
824
|
-
console.log(' choco install vcredist140 -y');
|
|
825
|
-
console.log(' 3. Update graphics drivers for OpenGL 2.0+ support');
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
// Verify installation succeeded
|
|
830
|
-
const verifyInstalled = await isInstalledOnWindows();
|
|
831
|
-
if (verifyInstalled) {
|
|
832
|
-
console.log('Bambu Studio installed successfully.');
|
|
833
|
-
console.log('Location: C:\\Program Files\\Bambu Studio\\bambu-studio.exe');
|
|
834
|
-
console.log('');
|
|
835
|
-
console.log('Launch from the Start Menu or via:');
|
|
836
|
-
console.log(' Start-Process "C:\\Program Files\\Bambu Studio\\bambu-studio.exe"');
|
|
837
|
-
} else {
|
|
838
|
-
console.error('Installation completed but Bambu Studio was not found.');
|
|
839
|
-
console.log('You may need to close and reopen your terminal for PATH updates.');
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* Install Bambu Studio on Ubuntu running in WSL (Windows Subsystem for Linux).
|
|
845
|
-
*
|
|
846
|
-
* Uses Flatpak with WSLg for GUI support. WSLg enables Linux GUI applications
|
|
847
|
-
* to run with native Windows integration, appearing as regular Windows windows.
|
|
848
|
-
*
|
|
849
|
-
* Prerequisites:
|
|
850
|
-
* - Windows 10 Build 19044+ or Windows 11
|
|
851
|
-
* - WSL 2 with Ubuntu installed
|
|
852
|
-
* - WSLg enabled (default on Windows 11 and recent Windows 10 updates)
|
|
853
|
-
* - GPU drivers installed on Windows host
|
|
854
|
-
*
|
|
855
|
-
* @returns {Promise<void>}
|
|
856
|
-
*/
|
|
857
|
-
async function install_ubuntu_wsl() {
|
|
858
|
-
// Check if already installed via Flatpak (idempotency check)
|
|
859
|
-
const alreadyInstalled = await isInstalledViaFlatpak();
|
|
860
|
-
if (alreadyInstalled) {
|
|
861
|
-
console.log('Bambu Studio is already installed.');
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
console.log('Note: Bambu Studio in WSL requires WSLg for GUI support.');
|
|
866
|
-
console.log('If you encounter display issues, run "wsl --update" from Windows PowerShell.');
|
|
867
|
-
console.log('');
|
|
868
|
-
|
|
869
|
-
// Check for display environment before proceeding (Bambu Studio requires GUI)
|
|
870
|
-
if (!hasDisplayEnvironment()) {
|
|
871
|
-
console.log('Bambu Studio is a GUI application and requires a desktop environment.');
|
|
872
|
-
console.log('No display environment detected (DISPLAY, WAYLAND_DISPLAY, or XDG_CURRENT_DESKTOP).');
|
|
873
|
-
console.log('');
|
|
874
|
-
console.log('WSLg is required for GUI applications in WSL. Ensure:');
|
|
875
|
-
console.log(' 1. You are running Windows 10 Build 19044+ or Windows 11');
|
|
876
|
-
console.log(' 2. WSL is up to date: wsl --update (from Windows PowerShell)');
|
|
877
|
-
console.log(' 3. WSL 2 is being used: wsl --set-default-version 2');
|
|
878
|
-
console.log('');
|
|
879
|
-
console.log('After updating WSL, restart your WSL session and try again.');
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
// Ensure Flatpak is installed
|
|
884
|
-
const flatpakReady = await ensureFlatpakInstalled();
|
|
885
|
-
if (!flatpakReady) {
|
|
886
|
-
console.error('Could not install Flatpak. Please install it manually:');
|
|
887
|
-
console.log(' sudo apt-get update && sudo apt-get install -y flatpak');
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
// Ensure Flathub repository is configured
|
|
892
|
-
const flathubResult = await ensureFlathubConfigured();
|
|
893
|
-
if (!flathubResult.success) {
|
|
894
|
-
console.error('Could not configure Flathub repository. Please add it manually:');
|
|
895
|
-
console.log(' flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo');
|
|
896
|
-
return;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
console.log('Installing Bambu Studio via Flatpak...');
|
|
900
|
-
console.log('Note: This may take several minutes on first install.');
|
|
901
|
-
|
|
902
|
-
// Install Bambu Studio from Flathub
|
|
903
|
-
// Use --user flag if we're using user-level Flatpak (no system D-Bus)
|
|
904
|
-
const userFlag = flathubResult.userLevel ? '--user' : '';
|
|
905
|
-
const installResult = await shell.exec(`flatpak install -y ${userFlag} flathub ${FLATPAK_APP_ID}`);
|
|
906
|
-
|
|
907
|
-
if (installResult.code !== 0) {
|
|
908
|
-
console.error('Failed to install Bambu Studio:', installResult.stderr);
|
|
909
|
-
console.log('');
|
|
910
|
-
console.log('Troubleshooting:');
|
|
911
|
-
console.log(' 1. Restart WSL: wsl --shutdown (from Windows PowerShell)');
|
|
912
|
-
console.log(' 2. Update WSL: wsl --update (from Windows PowerShell)');
|
|
913
|
-
console.log(' 3. If network issues, try:');
|
|
914
|
-
console.log(' wsl --shutdown && netsh winsock reset (Admin PowerShell)');
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
// Verify installation succeeded
|
|
919
|
-
const verifyInstalled = await isInstalledViaFlatpak();
|
|
920
|
-
if (verifyInstalled) {
|
|
921
|
-
console.log('Bambu Studio installed successfully.');
|
|
922
|
-
console.log('');
|
|
923
|
-
console.log('Launch with: flatpak run com.bambulab.BambuStudio');
|
|
924
|
-
console.log('');
|
|
925
|
-
console.log('If the application window does not appear:');
|
|
926
|
-
console.log(' 1. Verify WSLg is enabled: wsl --version (from Windows PowerShell)');
|
|
927
|
-
console.log(' 2. Update GPU drivers on the Windows host');
|
|
928
|
-
console.log(' 3. For best performance, consider using the native Windows installation');
|
|
929
|
-
} else {
|
|
930
|
-
console.error('Installation completed but Bambu Studio was not found.');
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
/**
|
|
935
|
-
* Install Bambu Studio from Git Bash on Windows.
|
|
936
|
-
*
|
|
937
|
-
* Git Bash runs on Windows and can access Windows package managers.
|
|
938
|
-
* This function installs Bambu Studio using Chocolatey on the Windows host.
|
|
939
|
-
*
|
|
940
|
-
* Prerequisites:
|
|
941
|
-
* - Git Bash installed (comes with Git for Windows)
|
|
942
|
-
* - Chocolatey installed on Windows
|
|
943
|
-
* - Administrator privileges (run Git Bash as Administrator)
|
|
944
|
-
*
|
|
945
|
-
* @returns {Promise<void>}
|
|
946
|
-
*/
|
|
947
|
-
async function install_gitbash() {
|
|
948
|
-
// Git Bash runs on Windows and can access Windows package managers
|
|
949
|
-
// Delegate to the Windows installation function
|
|
950
|
-
console.log('Installing Bambu Studio for Windows from Git Bash...');
|
|
951
|
-
|
|
952
|
-
// Check if already installed (idempotency check)
|
|
953
|
-
// Use a simple file existence check that works from Git Bash
|
|
954
|
-
const checkResult = await shell.exec('ls "/c/Program Files/Bambu Studio/bambu-studio.exe" 2>/dev/null');
|
|
955
|
-
if (checkResult.code === 0) {
|
|
956
|
-
console.log('Bambu Studio is already installed.');
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
// Check if Chocolatey is available (might need to use full path in Git Bash)
|
|
961
|
-
const chocoPath = '/c/ProgramData/chocolatey/bin/choco.exe';
|
|
962
|
-
const chocoAvailable = shell.commandExists('choco') || fs.existsSync(chocoPath);
|
|
963
|
-
|
|
964
|
-
if (!chocoAvailable) {
|
|
965
|
-
console.log('Chocolatey is not installed. Please install Chocolatey first:');
|
|
966
|
-
console.log('');
|
|
967
|
-
console.log('Run this command in an Administrator PowerShell:');
|
|
968
|
-
console.log(' Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(\'https://community.chocolatey.org/install.ps1\'))');
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
console.log('Installing Bambu Studio via Chocolatey...');
|
|
973
|
-
|
|
974
|
-
// Try to use choco from PATH first, fall back to full path
|
|
975
|
-
const chocoCommand = shell.commandExists('choco') ? 'choco' : chocoPath;
|
|
976
|
-
const installResult = await shell.exec(`${chocoCommand} install ${CHOCOLATEY_PACKAGE_NAME} -y`);
|
|
977
|
-
|
|
978
|
-
if (installResult.code !== 0) {
|
|
979
|
-
console.error('Failed to install Bambu Studio:', installResult.stderr);
|
|
980
|
-
console.log('');
|
|
981
|
-
console.log('Troubleshooting:');
|
|
982
|
-
console.log(' 1. Run Git Bash as Administrator (right-click > Run as administrator)');
|
|
983
|
-
console.log(' 2. Try using the full Chocolatey path:');
|
|
984
|
-
console.log(` ${chocoPath} install ${CHOCOLATEY_PACKAGE_NAME} -y`);
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
// Verify installation succeeded
|
|
989
|
-
const verifyResult = await shell.exec('ls "/c/Program Files/Bambu Studio/bambu-studio.exe" 2>/dev/null');
|
|
990
|
-
if (verifyResult.code === 0) {
|
|
991
|
-
console.log('Bambu Studio installed successfully.');
|
|
992
|
-
console.log('Location: C:\\Program Files\\Bambu Studio\\bambu-studio.exe');
|
|
993
|
-
console.log('');
|
|
994
|
-
console.log('Launch with: "/c/Program Files/Bambu Studio/bambu-studio.exe" &');
|
|
995
|
-
} else {
|
|
996
|
-
console.error('Installation completed but Bambu Studio was not found.');
|
|
997
|
-
console.log('Close and reopen Git Bash for PATH updates to take effect.');
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Check if Bambu Studio is installed on the current platform.
|
|
1003
|
-
*
|
|
1004
|
-
* This function performs platform-specific checks to determine if Bambu Studio
|
|
1005
|
-
* is already installed:
|
|
1006
|
-
* - macOS: Checks for the app bundle in /Applications
|
|
1007
|
-
* - Windows: Checks for the executable in Program Files
|
|
1008
|
-
* - Linux: Checks for Flatpak installation
|
|
1009
|
-
* - Raspberry Pi: Checks for Pi-Apps installation
|
|
1010
|
-
*
|
|
1011
|
-
* @returns {Promise<boolean>} True if Bambu Studio is installed
|
|
1012
|
-
*/
|
|
1013
|
-
async function isInstalled() {
|
|
1014
|
-
const platform = os.detect();
|
|
1015
|
-
|
|
1016
|
-
// macOS: Check for the app bundle
|
|
1017
|
-
if (platform.type === 'macos') {
|
|
1018
|
-
return isInstalledOnMacOS();
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
// Windows: Check for the executable
|
|
1022
|
-
if (platform.type === 'windows') {
|
|
1023
|
-
return await isInstalledOnWindows();
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
// Git Bash: Check for Windows installation
|
|
1027
|
-
if (platform.type === 'gitbash') {
|
|
1028
|
-
const checkResult = await shell.exec('ls "/c/Program Files/Bambu Studio/bambu-studio.exe" 2>/dev/null');
|
|
1029
|
-
return checkResult.code === 0;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
// Raspberry Pi: Check via Pi-Apps
|
|
1033
|
-
if (platform.type === 'raspbian') {
|
|
1034
|
-
return await isInstalledOnRaspbian();
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
// Linux platforms (Ubuntu, Debian, WSL, Amazon Linux, Fedora, RHEL): Check AppImage first, then Flatpak
|
|
1038
|
-
if (['ubuntu', 'debian', 'wsl', 'amazon_linux', 'fedora', 'rhel'].includes(platform.type)) {
|
|
1039
|
-
// Check AppImage installation (preferred)
|
|
1040
|
-
if (isAppImageInstalled()) {
|
|
1041
|
-
return true;
|
|
1042
|
-
}
|
|
1043
|
-
// Fallback to Flatpak check (for legacy installations)
|
|
1044
|
-
return await isInstalledViaFlatpak();
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
return false;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
/**
|
|
1051
|
-
* Check if this installer is supported on the current platform.
|
|
1052
|
-
*
|
|
1053
|
-
* Bambu Studio can be installed on all supported platforms:
|
|
1054
|
-
* - macOS (via Homebrew cask)
|
|
1055
|
-
* - Ubuntu/Debian (via Flatpak from Flathub)
|
|
1056
|
-
* - Raspberry Pi OS (via Pi-Apps, 64-bit only)
|
|
1057
|
-
* - Amazon Linux/RHEL/Fedora (via Flatpak from Flathub)
|
|
1058
|
-
* - Windows (via Chocolatey)
|
|
1059
|
-
* - WSL (via Flatpak with WSLg)
|
|
1060
|
-
* - Git Bash (via Windows Chocolatey)
|
|
1061
|
-
*
|
|
1062
|
-
* @returns {boolean} True if installation is supported on this platform
|
|
1063
|
-
*/
|
|
1064
|
-
function isEligible() {
|
|
1065
|
-
const platform = os.detect();
|
|
1066
|
-
const supportedPlatforms = ['macos', 'ubuntu', 'debian', 'wsl', 'raspbian', 'amazon_linux', 'fedora', 'rhel', 'windows', 'gitbash'];
|
|
1067
|
-
if (!supportedPlatforms.includes(platform.type)) {
|
|
1068
|
-
return false;
|
|
1069
|
-
}
|
|
1070
|
-
if (REQUIRES_DESKTOP && !os.isDesktopAvailable()) {
|
|
1071
|
-
return false;
|
|
1072
|
-
}
|
|
1073
|
-
return true;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
/**
|
|
1077
|
-
* Main installation entry point - detects platform and runs appropriate installer.
|
|
1078
|
-
*
|
|
1079
|
-
* This function automatically determines the current operating system and
|
|
1080
|
-
* invokes the correct platform-specific installation function.
|
|
1081
|
-
*
|
|
1082
|
-
* Supported platforms:
|
|
1083
|
-
* - macOS: Homebrew cask
|
|
1084
|
-
* - Ubuntu/Debian: Flatpak from Flathub
|
|
1085
|
-
* - Raspberry Pi OS: Pi-Apps (64-bit only)
|
|
1086
|
-
* - Amazon Linux/RHEL: Flatpak from Flathub
|
|
1087
|
-
* - Windows: Chocolatey
|
|
1088
|
-
* - WSL: Flatpak with WSLg
|
|
1089
|
-
* - Git Bash: Windows Chocolatey
|
|
1090
|
-
*
|
|
1091
|
-
* @returns {Promise<void>}
|
|
1092
|
-
*/
|
|
1093
|
-
async function install() {
|
|
1094
|
-
const platform = os.detect();
|
|
1095
|
-
|
|
1096
|
-
// Map platform types to their respective installer functions
|
|
1097
|
-
// This mapping handles aliases (e.g., debian maps to ubuntu)
|
|
1098
|
-
const installers = {
|
|
1099
|
-
'macos': install_macos,
|
|
1100
|
-
'ubuntu': install_ubuntu,
|
|
1101
|
-
'debian': install_ubuntu,
|
|
1102
|
-
'wsl': install_ubuntu_wsl,
|
|
1103
|
-
'raspbian': install_raspbian,
|
|
1104
|
-
'amazon_linux': install_amazon_linux,
|
|
1105
|
-
'fedora': install_amazon_linux,
|
|
1106
|
-
'rhel': install_amazon_linux,
|
|
1107
|
-
'windows': install_windows,
|
|
1108
|
-
'gitbash': install_gitbash
|
|
1109
|
-
};
|
|
1110
|
-
|
|
1111
|
-
const installer = installers[platform.type];
|
|
1112
|
-
|
|
1113
|
-
// Handle unsupported platforms gracefully (no errors, no alternatives)
|
|
1114
|
-
if (!installer) {
|
|
1115
|
-
console.log(`Bambu Studio is not available for ${platform.type}.`);
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
await installer();
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
// Export all functions for use as a module and for testing
|
|
1123
|
-
module.exports = {
|
|
1124
|
-
REQUIRES_DESKTOP,
|
|
1125
|
-
install,
|
|
1126
|
-
isInstalled,
|
|
1127
|
-
isEligible,
|
|
1128
|
-
install_macos,
|
|
1129
|
-
install_ubuntu,
|
|
1130
|
-
install_ubuntu_wsl,
|
|
1131
|
-
install_raspbian,
|
|
1132
|
-
install_amazon_linux,
|
|
1133
|
-
install_windows,
|
|
1134
|
-
install_gitbash
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
// Allow direct execution of this script: node bambu-studio.js
|
|
1138
|
-
if (require.main === module) {
|
|
1139
|
-
install().catch(err => {
|
|
1140
|
-
console.error(err.message);
|
|
1141
|
-
process.exit(1);
|
|
1142
|
-
});
|
|
1143
|
-
}
|