@fredlackey/devutils 0.0.1 → 0.0.3
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 +5 -5
- package/package.json +1 -1
- package/src/commands/install.js +374 -36
- package/src/installs/adobe-creative-cloud.js +527 -25
- package/src/installs/adobe-creative-cloud.md +605 -0
- package/src/installs/appcleaner.js +303 -26
- package/src/installs/appcleaner.md +699 -0
- package/src/installs/apt-transport-https.js +390 -0
- package/src/installs/apt-transport-https.md +678 -0
- package/src/installs/atomicparsley.js +624 -26
- package/src/installs/atomicparsley.md +795 -0
- package/src/installs/aws-cli.js +779 -26
- package/src/installs/aws-cli.md +727 -0
- package/src/installs/balena-etcher.js +688 -26
- package/src/installs/balena-etcher.md +761 -0
- package/src/installs/bambu-studio.js +912 -26
- package/src/installs/bambu-studio.md +780 -0
- package/src/installs/bash-completion.js +554 -23
- package/src/installs/bash-completion.md +833 -0
- package/src/installs/bash.js +399 -26
- package/src/installs/bash.md +993 -0
- package/src/installs/beyond-compare.js +585 -26
- package/src/installs/beyond-compare.md +813 -0
- package/src/installs/build-essential.js +511 -26
- package/src/installs/build-essential.md +977 -0
- package/src/installs/ca-certificates.js +618 -0
- package/src/installs/ca-certificates.md +937 -0
- package/src/installs/caffeine.js +490 -26
- package/src/installs/caffeine.md +839 -0
- package/src/installs/camtasia.js +577 -25
- package/src/installs/camtasia.md +762 -0
- package/src/installs/chatgpt.js +458 -26
- package/src/installs/chatgpt.md +814 -0
- package/src/installs/chocolatey.js +447 -0
- package/src/installs/chocolatey.md +661 -0
- package/src/installs/chrome-canary.js +472 -26
- package/src/installs/chrome-canary.md +641 -0
- package/src/installs/chromium.js +645 -26
- package/src/installs/chromium.md +838 -0
- package/src/installs/claude-code.js +558 -26
- package/src/installs/claude-code.md +1173 -0
- package/src/installs/curl.js +361 -26
- package/src/installs/curl.md +714 -0
- package/src/installs/cursor.js +561 -26
- package/src/installs/cursor.md +970 -0
- package/src/installs/dbschema.js +674 -26
- package/src/installs/dbschema.md +925 -0
- package/src/installs/dependencies.md +435 -0
- package/src/installs/development-tools.js +600 -0
- package/src/installs/development-tools.md +977 -0
- package/src/installs/docker.js +1010 -25
- package/src/installs/docker.md +1109 -0
- package/src/installs/drawio.js +1001 -26
- package/src/installs/drawio.md +795 -0
- package/src/installs/elmedia-player.js +328 -25
- package/src/installs/elmedia-player.md +556 -0
- package/src/installs/ffmpeg.js +870 -25
- package/src/installs/ffmpeg.md +852 -0
- package/src/installs/file.js +464 -0
- package/src/installs/file.md +987 -0
- package/src/installs/gemini-cli.js +793 -26
- package/src/installs/gemini-cli.md +1153 -0
- package/src/installs/git.js +382 -26
- package/src/installs/git.md +907 -0
- package/src/installs/gitego.js +931 -26
- package/src/installs/gitego.md +1172 -0
- package/src/installs/go.js +913 -26
- package/src/installs/go.md +958 -0
- package/src/installs/google-chrome.js +801 -25
- package/src/installs/google-chrome.md +862 -0
- package/src/installs/gpg.js +412 -73
- package/src/installs/gpg.md +1056 -0
- package/src/installs/homebrew.js +1015 -26
- package/src/installs/homebrew.md +988 -0
- package/src/installs/imageoptim.js +950 -26
- package/src/installs/imageoptim.md +1119 -0
- package/src/installs/installers.json +2297 -0
- package/src/installs/jq.js +382 -26
- package/src/installs/jq.md +809 -0
- package/src/installs/keyboard-maestro.js +701 -26
- package/src/installs/keyboard-maestro.md +825 -0
- package/src/installs/latex.js +771 -26
- package/src/installs/latex.md +1095 -0
- package/src/installs/lftp.js +338 -26
- package/src/installs/lftp.md +907 -0
- package/src/installs/lsb-release.js +346 -0
- package/src/installs/lsb-release.md +814 -0
- package/src/installs/messenger.js +829 -26
- package/src/installs/messenger.md +900 -0
- package/src/installs/microsoft-office.js +550 -26
- package/src/installs/microsoft-office.md +760 -0
- package/src/installs/microsoft-teams.js +782 -25
- package/src/installs/microsoft-teams.md +886 -0
- package/src/installs/node.js +886 -26
- package/src/installs/node.md +1153 -0
- package/src/installs/nordpass.js +698 -26
- package/src/installs/nordpass.md +921 -0
- package/src/installs/nvm.js +977 -26
- package/src/installs/nvm.md +1057 -0
- package/src/installs/openssh.js +734 -64
- package/src/installs/openssh.md +1056 -0
- package/src/installs/pandoc.js +644 -26
- package/src/installs/pandoc.md +1036 -0
- package/src/installs/pinentry.js +492 -26
- package/src/installs/pinentry.md +1142 -0
- package/src/installs/pngyu.js +851 -26
- package/src/installs/pngyu.md +896 -0
- package/src/installs/postman.js +781 -26
- package/src/installs/postman.md +940 -0
- package/src/installs/procps.js +425 -0
- package/src/installs/procps.md +851 -0
- package/src/installs/safari-tech-preview.js +355 -25
- package/src/installs/safari-tech-preview.md +533 -0
- package/src/installs/sfnt2woff.js +640 -26
- package/src/installs/sfnt2woff.md +795 -0
- package/src/installs/shellcheck.js +463 -26
- package/src/installs/shellcheck.md +1005 -0
- package/src/installs/slack.js +722 -25
- package/src/installs/slack.md +865 -0
- package/src/installs/snagit.js +566 -25
- package/src/installs/snagit.md +844 -0
- package/src/installs/software-properties-common.js +372 -0
- package/src/installs/software-properties-common.md +805 -0
- package/src/installs/spotify.js +858 -25
- package/src/installs/spotify.md +901 -0
- package/src/installs/studio-3t.js +803 -26
- package/src/installs/studio-3t.md +918 -0
- package/src/installs/sublime-text.js +780 -25
- package/src/installs/sublime-text.md +914 -0
- package/src/installs/superwhisper.js +687 -25
- package/src/installs/superwhisper.md +630 -0
- package/src/installs/tailscale.js +727 -26
- package/src/installs/tailscale.md +1100 -0
- package/src/installs/tar.js +389 -0
- package/src/installs/tar.md +946 -0
- package/src/installs/termius.js +780 -26
- package/src/installs/termius.md +844 -0
- package/src/installs/terraform.js +761 -26
- package/src/installs/terraform.md +899 -0
- package/src/installs/tidal.js +752 -25
- package/src/installs/tidal.md +864 -0
- package/src/installs/tmux.js +328 -26
- package/src/installs/tmux.md +1030 -0
- package/src/installs/tree.js +393 -26
- package/src/installs/tree.md +833 -0
- package/src/installs/unzip.js +460 -0
- package/src/installs/unzip.md +879 -0
- package/src/installs/vim.js +403 -26
- package/src/installs/vim.md +1040 -0
- package/src/installs/vlc.js +803 -26
- package/src/installs/vlc.md +927 -0
- package/src/installs/vscode.js +825 -26
- package/src/installs/vscode.md +1002 -0
- package/src/installs/wget.js +415 -0
- package/src/installs/wget.md +791 -0
- package/src/installs/whatsapp.js +710 -25
- package/src/installs/whatsapp.md +854 -0
- package/src/installs/winpty.js +352 -0
- package/src/installs/winpty.md +620 -0
- package/src/installs/woff2.js +535 -26
- package/src/installs/woff2.md +977 -0
- package/src/installs/wsl.js +572 -0
- package/src/installs/wsl.md +699 -0
- package/src/installs/xcode-clt.js +520 -0
- package/src/installs/xcode-clt.md +351 -0
- package/src/installs/xcode.js +542 -26
- package/src/installs/xcode.md +573 -0
- package/src/installs/yarn.js +806 -26
- package/src/installs/yarn.md +1074 -0
- package/src/installs/yq.js +636 -26
- package/src/installs/yq.md +944 -0
- package/src/installs/yt-dlp.js +683 -26
- package/src/installs/yt-dlp.md +946 -0
- package/src/installs/yum-utils.js +297 -0
- package/src/installs/yum-utils.md +648 -0
- package/src/installs/zoom.js +740 -25
- package/src/installs/zoom.md +884 -0
- package/src/scripts/README.md +567 -45
- package/src/scripts/STATUS.md +208 -0
- package/src/scripts/afk.js +395 -7
- package/src/scripts/backup-all.js +731 -9
- package/src/scripts/backup-source.js +711 -8
- package/src/scripts/brewd.js +373 -7
- package/src/scripts/brewi.js +505 -9
- package/src/scripts/brewr.js +512 -9
- package/src/scripts/brews.js +462 -9
- package/src/scripts/brewu.js +488 -7
- package/src/scripts/c.js +185 -7
- package/src/scripts/ccurl.js +325 -8
- package/src/scripts/certbot-crontab-init.js +488 -8
- package/src/scripts/certbot-init.js +641 -9
- package/src/scripts/ch.js +339 -7
- package/src/scripts/claude-danger.js +253 -8
- package/src/scripts/clean-dev.js +419 -8
- package/src/scripts/clear-dns-cache.js +525 -7
- package/src/scripts/clone.js +417 -7
- package/src/scripts/code-all.js +420 -7
- package/src/scripts/count-files.js +195 -8
- package/src/scripts/count-folders.js +195 -8
- package/src/scripts/count.js +248 -8
- package/src/scripts/d.js +203 -7
- package/src/scripts/datauri.js +373 -8
- package/src/scripts/delete-files.js +363 -7
- package/src/scripts/docker-clean.js +410 -8
- package/src/scripts/dp.js +426 -7
- package/src/scripts/e.js +375 -9
- package/src/scripts/empty-trash.js +497 -7
- package/src/scripts/evm.js +428 -9
- package/src/scripts/fetch-github-repos.js +441 -10
- package/src/scripts/get-channel.js +329 -8
- package/src/scripts/get-course.js +384 -11
- package/src/scripts/get-dependencies.js +290 -9
- package/src/scripts/get-folder.js +783 -10
- package/src/scripts/get-tunes.js +411 -10
- package/src/scripts/get-video.js +352 -9
- package/src/scripts/git-backup.js +561 -9
- package/src/scripts/git-clone.js +477 -9
- package/src/scripts/git-pup.js +303 -7
- package/src/scripts/git-push.js +380 -8
- package/src/scripts/h.js +607 -9
- package/src/scripts/hide-desktop-icons.js +483 -7
- package/src/scripts/hide-hidden-files.js +522 -7
- package/src/scripts/install-dependencies-from.js +440 -9
- package/src/scripts/ips.js +647 -10
- package/src/scripts/iso.js +354 -8
- package/src/scripts/killni.js +561 -7
- package/src/scripts/ll.js +451 -8
- package/src/scripts/local-ip.js +310 -8
- package/src/scripts/m.js +508 -8
- package/src/scripts/map.js +293 -8
- package/src/scripts/mkd.js +287 -7
- package/src/scripts/ncu-update-all.js +441 -8
- package/src/scripts/nginx-init.js +702 -12
- package/src/scripts/npmi.js +366 -7
- package/src/scripts/o.js +495 -8
- package/src/scripts/org-by-date.js +321 -7
- package/src/scripts/p.js +208 -7
- package/src/scripts/packages.js +313 -8
- package/src/scripts/path.js +209 -7
- package/src/scripts/ports.js +582 -8
- package/src/scripts/q.js +290 -8
- package/src/scripts/refresh-files.js +378 -10
- package/src/scripts/remove-smaller-files.js +500 -8
- package/src/scripts/rename-files-with-date.js +517 -9
- package/src/scripts/resize-image.js +523 -9
- package/src/scripts/rm-safe.js +653 -8
- package/src/scripts/s.js +525 -9
- package/src/scripts/set-git-public.js +349 -7
- package/src/scripts/show-desktop-icons.js +459 -7
- package/src/scripts/show-hidden-files.js +456 -7
- package/src/scripts/tpa.js +265 -8
- package/src/scripts/tpo.js +264 -7
- package/src/scripts/u.js +489 -7
- package/src/scripts/vpush.js +422 -8
- package/src/scripts/y.js +267 -7
- package/src/utils/common/os.js +94 -2
- package/src/utils/ubuntu/apt.js +13 -7
- package/src/utils/windows/choco.js +82 -26
- package/src/utils/windows/winget.js +89 -27
|
@@ -1,44 +1,930 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileoverview Install Bambu Studio.
|
|
4
|
+
* @fileoverview Install Bambu Studio - a feature-rich 3D printing slicer software.
|
|
5
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
|
|
6
23
|
*/
|
|
7
24
|
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
8
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
|
+
*/
|
|
53
|
+
const FLATPAK_APP_ID = 'com.bambulab.BambuStudio';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The Chocolatey package name for Bambu Studio on Windows.
|
|
57
|
+
*/
|
|
58
|
+
const CHOCOLATEY_PACKAGE_NAME = 'bambustudio';
|
|
9
59
|
|
|
10
60
|
/**
|
|
11
|
-
*
|
|
61
|
+
* The Windows installation path for Bambu Studio.
|
|
62
|
+
*/
|
|
63
|
+
const WINDOWS_INSTALL_PATH = 'C:\\Program Files\\Bambu Studio\\bambu-studio.exe';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Checks if Bambu Studio is already installed on macOS.
|
|
67
|
+
* Looks for the BambuStudio.app bundle in /Applications.
|
|
68
|
+
*
|
|
69
|
+
* @returns {boolean} True if Bambu Studio is installed on macOS
|
|
70
|
+
*/
|
|
71
|
+
function isInstalledOnMacOS() {
|
|
72
|
+
return macosApps.isAppInstalled(MACOS_APP_NAME);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Checks if Flatpak is available on the system.
|
|
77
|
+
* Flatpak is required for Linux installations (Ubuntu, WSL, Amazon Linux).
|
|
78
|
+
*
|
|
79
|
+
* @returns {boolean} True if the flatpak command exists in PATH
|
|
80
|
+
*/
|
|
81
|
+
function isFlatpakAvailable() {
|
|
82
|
+
return shell.commandExists('flatpak');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Checks if Bambu Studio is installed via Flatpak.
|
|
87
|
+
* Queries the Flatpak list for the Bambu Studio application ID.
|
|
88
|
+
*
|
|
89
|
+
* @returns {Promise<boolean>} True if Bambu Studio is installed via Flatpak
|
|
90
|
+
*/
|
|
91
|
+
async function isInstalledViaFlatpak() {
|
|
92
|
+
if (!isFlatpakAvailable()) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Check if the Flatpak app is installed by looking for it in the list
|
|
97
|
+
const result = await shell.exec(`flatpak list --app | grep -i "${FLATPAK_APP_ID}"`);
|
|
98
|
+
return result.code === 0 && result.stdout.includes(FLATPAK_APP_ID);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Checks if Bambu Studio is already installed on Windows.
|
|
103
|
+
* Looks for the executable in the standard Program Files location.
|
|
104
|
+
*
|
|
105
|
+
* @returns {Promise<boolean>} True if Bambu Studio is installed on Windows
|
|
106
|
+
*/
|
|
107
|
+
async function isInstalledOnWindows() {
|
|
108
|
+
// Check if the executable exists at the expected location
|
|
109
|
+
const result = await shell.exec(`powershell -NoProfile -Command "Test-Path '${WINDOWS_INSTALL_PATH}'"`);
|
|
110
|
+
return result.stdout.trim().toLowerCase() === 'true';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Checks if Bambu Studio is installed on Raspberry Pi via Pi-Apps.
|
|
115
|
+
* Pi-Apps installs Bambu Studio to a local binary location.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Promise<boolean>} True if Bambu Studio is installed
|
|
118
|
+
*/
|
|
119
|
+
async function isInstalledOnRaspbian() {
|
|
120
|
+
// Check for the bambu-studio command in PATH
|
|
121
|
+
if (shell.commandExists('bambu-studio')) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Check for desktop file created by Pi-Apps
|
|
126
|
+
const homeDir = os.getHomeDir();
|
|
127
|
+
const desktopFilePath = path.join(homeDir, '.local', 'share', 'applications');
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
const files = fs.readdirSync(desktopFilePath);
|
|
131
|
+
for (const file of files) {
|
|
132
|
+
if (file.toLowerCase().includes('bambu')) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
// Directory doesn't exist or can't be read - not installed
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Installs Flatpak if not already present on a Debian-based system.
|
|
145
|
+
* This is a prerequisite for installing Bambu Studio on Linux via Flatpak.
|
|
146
|
+
*
|
|
147
|
+
* @returns {Promise<boolean>} True if Flatpak is available after this function
|
|
148
|
+
*/
|
|
149
|
+
async function ensureFlatpakInstalled() {
|
|
150
|
+
if (isFlatpakAvailable()) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
console.log('Flatpak is not installed. Installing Flatpak...');
|
|
155
|
+
|
|
156
|
+
// Update apt cache first
|
|
157
|
+
const updateResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y');
|
|
158
|
+
if (updateResult.code !== 0) {
|
|
159
|
+
console.error('Failed to update apt cache:', updateResult.stderr);
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Install Flatpak
|
|
164
|
+
const installResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get install -y flatpak');
|
|
165
|
+
if (installResult.code !== 0) {
|
|
166
|
+
console.error('Failed to install Flatpak:', installResult.stderr);
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
console.log('Flatpak installed successfully.');
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Checks if the system has a display environment (not headless).
|
|
176
|
+
* Flatpak requires a display environment and D-Bus to function properly.
|
|
177
|
+
*
|
|
178
|
+
* @returns {boolean} True if a display environment is detected
|
|
179
|
+
*/
|
|
180
|
+
function hasDisplayEnvironment() {
|
|
181
|
+
// Check for common display environment variables
|
|
182
|
+
const hasDisplay = process.env.DISPLAY ||
|
|
183
|
+
process.env.WAYLAND_DISPLAY ||
|
|
184
|
+
process.env.XDG_CURRENT_DESKTOP;
|
|
185
|
+
return Boolean(hasDisplay);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Adds the Flathub repository if not already configured.
|
|
190
|
+
* Flathub is the source for the Bambu Studio Flatpak package.
|
|
191
|
+
*
|
|
192
|
+
* @returns {Promise<boolean>} True if Flathub is available after this function
|
|
193
|
+
*/
|
|
194
|
+
async function ensureFlathubConfigured() {
|
|
195
|
+
// Check if Flathub is already configured
|
|
196
|
+
const checkResult = await shell.exec('flatpak remote-list | grep -i flathub');
|
|
197
|
+
if (checkResult.code === 0 && checkResult.stdout.includes('flathub')) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
console.log('Adding Flathub repository...');
|
|
202
|
+
|
|
203
|
+
// Add Flathub repository (--if-not-exists prevents errors if already added)
|
|
204
|
+
const addResult = await shell.exec(
|
|
205
|
+
'flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo'
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
if (addResult.code !== 0) {
|
|
209
|
+
console.error('Failed to add Flathub repository:', addResult.stderr);
|
|
210
|
+
|
|
211
|
+
// Provide helpful context if this is likely a headless/Docker environment
|
|
212
|
+
if (addResult.stderr.includes('system bus') || addResult.stderr.includes('D-Bus')) {
|
|
213
|
+
console.log('');
|
|
214
|
+
console.log('This error typically occurs in headless or containerized environments.');
|
|
215
|
+
console.log('Bambu Studio is a GUI application and requires:');
|
|
216
|
+
console.log(' 1. A desktop environment (GNOME, KDE, XFCE, etc.)');
|
|
217
|
+
console.log(' 2. X11 or Wayland display server');
|
|
218
|
+
console.log(' 3. D-Bus system bus');
|
|
219
|
+
console.log('');
|
|
220
|
+
console.log('If you are in a Docker container or headless server, Bambu Studio');
|
|
221
|
+
console.log('cannot be installed or run. Use a desktop Linux system instead.');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
console.log('Flathub repository added successfully.');
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Installs Flatpak if not already present on Amazon Linux/RHEL.
|
|
233
|
+
* Uses dnf as the package manager.
|
|
234
|
+
*
|
|
235
|
+
* @returns {Promise<boolean>} True if Flatpak is available after this function
|
|
236
|
+
*/
|
|
237
|
+
async function ensureFlatpakInstalledRHEL() {
|
|
238
|
+
if (isFlatpakAvailable()) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
console.log('Flatpak is not installed. Installing Flatpak...');
|
|
243
|
+
|
|
244
|
+
// Determine which package manager to use (dnf preferred over yum)
|
|
245
|
+
const packageManager = shell.commandExists('dnf') ? 'dnf' : 'yum';
|
|
246
|
+
|
|
247
|
+
const installResult = await shell.exec(`sudo ${packageManager} install -y flatpak`);
|
|
248
|
+
if (installResult.code !== 0) {
|
|
249
|
+
console.error('Failed to install Flatpak:', installResult.stderr);
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
console.log('Flatpak installed successfully.');
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Install Bambu Studio on macOS using Homebrew Cask.
|
|
259
|
+
*
|
|
260
|
+
* Prerequisites:
|
|
261
|
+
* - macOS 11 (Big Sur) or later
|
|
262
|
+
* - Homebrew package manager installed
|
|
263
|
+
* - Terminal access
|
|
264
|
+
*
|
|
265
|
+
* The installation uses `brew install --cask bambu-studio` which downloads
|
|
266
|
+
* and installs the application to /Applications/BambuStudio.app.
|
|
267
|
+
*
|
|
268
|
+
* @returns {Promise<void>}
|
|
269
|
+
*/
|
|
270
|
+
async function install_macos() {
|
|
271
|
+
// Check if Homebrew is available before attempting installation
|
|
272
|
+
if (!brew.isInstalled()) {
|
|
273
|
+
console.log('Homebrew is not installed. Please install Homebrew first:');
|
|
274
|
+
console.log(' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Check if already installed (idempotency check)
|
|
279
|
+
if (isInstalledOnMacOS()) {
|
|
280
|
+
console.log('Bambu Studio is already installed.');
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
console.log('Installing Bambu Studio via Homebrew Cask...');
|
|
285
|
+
|
|
286
|
+
// Install using the brew cask command
|
|
287
|
+
const result = await brew.installCask(HOMEBREW_CASK_NAME);
|
|
288
|
+
|
|
289
|
+
if (!result.success) {
|
|
290
|
+
console.error('Failed to install Bambu Studio:', result.output);
|
|
291
|
+
console.log('');
|
|
292
|
+
console.log('Troubleshooting:');
|
|
293
|
+
console.log(' 1. Run "brew update" and retry');
|
|
294
|
+
console.log(' 2. If macOS blocks the app, go to System Settings > Privacy & Security');
|
|
295
|
+
console.log(' and click "Open Anyway"');
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Verify installation succeeded
|
|
300
|
+
if (isInstalledOnMacOS()) {
|
|
301
|
+
console.log('Bambu Studio installed successfully.');
|
|
302
|
+
console.log('Location: /Applications/BambuStudio.app');
|
|
303
|
+
console.log('');
|
|
304
|
+
console.log('Launch with: open /Applications/BambuStudio.app');
|
|
305
|
+
} else {
|
|
306
|
+
console.error('Installation completed but Bambu Studio was not found in /Applications.');
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Install Bambu Studio on Ubuntu/Debian using Flatpak from Flathub.
|
|
312
|
+
*
|
|
313
|
+
* IMPORTANT: There is no official APT or Snap package for Bambu Studio.
|
|
314
|
+
* Flatpak from Flathub is the recommended installation method for Linux.
|
|
315
|
+
*
|
|
316
|
+
* Prerequisites:
|
|
317
|
+
* - Ubuntu 20.04+ or Debian 11+ (64-bit)
|
|
318
|
+
* - X11 or Wayland display server
|
|
319
|
+
* - sudo privileges
|
|
320
|
+
*
|
|
321
|
+
* NOTE: A system restart (or logout/login) may be required after installing
|
|
322
|
+
* Flatpak for the first time before Bambu Studio can be launched.
|
|
323
|
+
*
|
|
324
|
+
* @returns {Promise<void>}
|
|
325
|
+
*/
|
|
326
|
+
async function install_ubuntu() {
|
|
327
|
+
// Check if already installed via Flatpak (idempotency check)
|
|
328
|
+
const alreadyInstalled = await isInstalledViaFlatpak();
|
|
329
|
+
if (alreadyInstalled) {
|
|
330
|
+
console.log('Bambu Studio is already installed.');
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Check for display environment before proceeding (Bambu Studio requires GUI)
|
|
335
|
+
if (!hasDisplayEnvironment()) {
|
|
336
|
+
console.log('Bambu Studio is a GUI application and requires a desktop environment.');
|
|
337
|
+
console.log('No display environment detected (DISPLAY, WAYLAND_DISPLAY, or XDG_CURRENT_DESKTOP).');
|
|
338
|
+
console.log('');
|
|
339
|
+
console.log('This application cannot be installed on:');
|
|
340
|
+
console.log(' - Headless servers');
|
|
341
|
+
console.log(' - Docker containers without display forwarding');
|
|
342
|
+
console.log(' - SSH sessions without X11 forwarding');
|
|
343
|
+
console.log('');
|
|
344
|
+
console.log('Please run this installer on a system with a desktop environment.');
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Ensure Flatpak is installed (required for Bambu Studio on Linux)
|
|
349
|
+
const flatpakReady = await ensureFlatpakInstalled();
|
|
350
|
+
if (!flatpakReady) {
|
|
351
|
+
console.error('Could not install Flatpak. Please install it manually:');
|
|
352
|
+
console.log(' sudo apt-get update && sudo apt-get install -y flatpak');
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Ensure Flathub repository is configured
|
|
357
|
+
const flathubReady = await ensureFlathubConfigured();
|
|
358
|
+
if (!flathubReady) {
|
|
359
|
+
console.error('Could not configure Flathub repository. Please add it manually:');
|
|
360
|
+
console.log(' flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo');
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
console.log('Installing Bambu Studio via Flatpak...');
|
|
365
|
+
console.log('Note: This may take several minutes on first install.');
|
|
366
|
+
|
|
367
|
+
// Install Bambu Studio from Flathub
|
|
368
|
+
// The -y flag automatically confirms the installation
|
|
369
|
+
const installResult = await shell.exec(`flatpak install -y flathub ${FLATPAK_APP_ID}`);
|
|
370
|
+
|
|
371
|
+
if (installResult.code !== 0) {
|
|
372
|
+
console.error('Failed to install Bambu Studio:', installResult.stderr);
|
|
373
|
+
console.log('');
|
|
374
|
+
console.log('Troubleshooting:');
|
|
375
|
+
console.log(' 1. Try restarting your system and running the install again');
|
|
376
|
+
console.log(' 2. Run: flatpak update -y');
|
|
377
|
+
console.log(' 3. If Flathub fails, try re-adding it:');
|
|
378
|
+
console.log(' flatpak remote-delete flathub');
|
|
379
|
+
console.log(' flatpak remote-add flathub https://dl.flathub.org/repo/flathub.flatpakrepo');
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Verify installation succeeded
|
|
384
|
+
const verifyInstalled = await isInstalledViaFlatpak();
|
|
385
|
+
if (verifyInstalled) {
|
|
386
|
+
console.log('Bambu Studio installed successfully.');
|
|
387
|
+
console.log('');
|
|
388
|
+
console.log('Launch with: flatpak run com.bambulab.BambuStudio');
|
|
389
|
+
console.log('');
|
|
390
|
+
console.log('Note: If this is your first Flatpak installation, you may need to');
|
|
391
|
+
console.log('restart your system or log out/in for the app to appear in menus.');
|
|
392
|
+
} else {
|
|
393
|
+
console.error('Installation completed but Bambu Studio was not found.');
|
|
394
|
+
console.log('Try running: flatpak list | grep -i bambu');
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Install Bambu Studio on Raspberry Pi OS using Pi-Apps.
|
|
400
|
+
*
|
|
401
|
+
* IMPORTANT: Bambu Studio requires 64-bit Raspberry Pi OS (aarch64).
|
|
402
|
+
* It will NOT work on 32-bit (armv7l) installations.
|
|
403
|
+
*
|
|
404
|
+
* Prerequisites:
|
|
405
|
+
* - Raspberry Pi OS (64-bit only) - Bookworm or later recommended
|
|
406
|
+
* - Raspberry Pi 3B+ or later (64-bit capable hardware)
|
|
407
|
+
* - Desktop environment (GUI required)
|
|
408
|
+
* - Pi-Apps package manager (installed automatically if missing)
|
|
409
|
+
*
|
|
410
|
+
* NOTE: The Pi-Apps installation compiles from source on ARM, which can
|
|
411
|
+
* take significant time and system resources.
|
|
412
|
+
*
|
|
413
|
+
* @returns {Promise<void>}
|
|
414
|
+
*/
|
|
415
|
+
async function install_raspbian() {
|
|
416
|
+
// Check if already installed (idempotency check)
|
|
417
|
+
const alreadyInstalled = await isInstalledOnRaspbian();
|
|
418
|
+
if (alreadyInstalled) {
|
|
419
|
+
console.log('Bambu Studio is already installed.');
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Verify we are running on 64-bit Raspberry Pi OS
|
|
424
|
+
// Bambu Studio ARM builds only support aarch64 architecture
|
|
425
|
+
const archResult = await shell.exec('uname -m');
|
|
426
|
+
const architecture = archResult.stdout.trim();
|
|
427
|
+
|
|
428
|
+
if (architecture !== 'aarch64') {
|
|
429
|
+
console.log('Bambu Studio requires 64-bit Raspberry Pi OS (aarch64).');
|
|
430
|
+
console.log(`Current architecture: ${architecture}`);
|
|
431
|
+
console.log('');
|
|
432
|
+
console.log('Please install 64-bit Raspberry Pi OS from:');
|
|
433
|
+
console.log(' https://www.raspberrypi.com/software/operating-systems/');
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Check if Pi-Apps is already installed
|
|
438
|
+
const homeDir = os.getHomeDir();
|
|
439
|
+
const piAppsPath = path.join(homeDir, 'pi-apps', 'manage');
|
|
440
|
+
const piAppsInstalled = fs.existsSync(piAppsPath);
|
|
441
|
+
|
|
442
|
+
if (!piAppsInstalled) {
|
|
443
|
+
console.log('Installing Pi-Apps (required for Bambu Studio on Raspberry Pi)...');
|
|
444
|
+
|
|
445
|
+
// Install Pi-Apps from the official repository
|
|
446
|
+
const piAppsResult = await shell.exec(
|
|
447
|
+
'wget -qO- https://raw.githubusercontent.com/Botspot/pi-apps/master/install | bash'
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
if (piAppsResult.code !== 0) {
|
|
451
|
+
console.error('Failed to install Pi-Apps:', piAppsResult.stderr);
|
|
452
|
+
console.log('');
|
|
453
|
+
console.log('You may need to install required dependencies first:');
|
|
454
|
+
console.log(' sudo apt-get update && sudo apt-get install -y yad curl wget');
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
console.log('Pi-Apps installed successfully.');
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
console.log('Installing Bambu Studio via Pi-Apps...');
|
|
462
|
+
console.log('Note: This may take a significant amount of time on Raspberry Pi hardware.');
|
|
463
|
+
|
|
464
|
+
// Install Bambu Studio using Pi-Apps CLI
|
|
465
|
+
// The app name in Pi-Apps is "Bambu Studio" (with space, case-sensitive)
|
|
466
|
+
const installResult = await shell.exec(`"${piAppsPath}" install "Bambu Studio"`);
|
|
467
|
+
|
|
468
|
+
if (installResult.code !== 0) {
|
|
469
|
+
console.error('Failed to install Bambu Studio via Pi-Apps:', installResult.stderr);
|
|
470
|
+
console.log('');
|
|
471
|
+
console.log('Troubleshooting:');
|
|
472
|
+
console.log(' 1. If you run out of memory, increase swap space:');
|
|
473
|
+
console.log(' sudo dphys-swapfile swapoff');
|
|
474
|
+
console.log(' sudo sed -i "s/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/" /etc/dphys-swapfile');
|
|
475
|
+
console.log(' sudo dphys-swapfile setup');
|
|
476
|
+
console.log(' sudo dphys-swapfile swapon');
|
|
477
|
+
console.log(' 2. Ensure you have at least 4GB RAM (Raspberry Pi 4/5 recommended)');
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Verify installation succeeded
|
|
482
|
+
const verifyInstalled = await isInstalledOnRaspbian();
|
|
483
|
+
if (verifyInstalled) {
|
|
484
|
+
console.log('Bambu Studio installed successfully.');
|
|
485
|
+
console.log('');
|
|
486
|
+
console.log('Launch from the desktop menu under Engineering, or via: bambu-studio');
|
|
487
|
+
} else {
|
|
488
|
+
console.error('Installation completed but Bambu Studio was not found.');
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Install Bambu Studio on Amazon Linux/RHEL using Flatpak.
|
|
494
|
+
*
|
|
495
|
+
* IMPORTANT: Amazon Linux is primarily a server OS without a desktop environment.
|
|
496
|
+
* Bambu Studio is a GUI application and requires a display. This platform is
|
|
497
|
+
* NOT recommended for Bambu Studio usage.
|
|
498
|
+
*
|
|
499
|
+
* Prerequisites:
|
|
500
|
+
* - Amazon Linux 2023, Amazon Linux 2, RHEL 8+, or Fedora 35+
|
|
501
|
+
* - Desktop environment with X11/Wayland support
|
|
502
|
+
* - Flatpak package manager
|
|
503
|
+
* - sudo privileges
|
|
504
|
+
*
|
|
505
|
+
* @returns {Promise<void>}
|
|
506
|
+
*/
|
|
507
|
+
async function install_amazon_linux() {
|
|
508
|
+
// Check if already installed via Flatpak (idempotency check)
|
|
509
|
+
const alreadyInstalled = await isInstalledViaFlatpak();
|
|
510
|
+
if (alreadyInstalled) {
|
|
511
|
+
console.log('Bambu Studio is already installed.');
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
console.log('Note: Amazon Linux is primarily a server OS. Bambu Studio requires');
|
|
516
|
+
console.log('a desktop environment with display capabilities.');
|
|
517
|
+
console.log('');
|
|
518
|
+
|
|
519
|
+
// Check for display environment before proceeding (Bambu Studio requires GUI)
|
|
520
|
+
if (!hasDisplayEnvironment()) {
|
|
521
|
+
console.log('Bambu Studio is a GUI application and requires a desktop environment.');
|
|
522
|
+
console.log('No display environment detected (DISPLAY, WAYLAND_DISPLAY, or XDG_CURRENT_DESKTOP).');
|
|
523
|
+
console.log('');
|
|
524
|
+
console.log('This application cannot be installed on:');
|
|
525
|
+
console.log(' - Headless servers');
|
|
526
|
+
console.log(' - Docker containers without display forwarding');
|
|
527
|
+
console.log(' - SSH sessions without X11 forwarding');
|
|
528
|
+
console.log('');
|
|
529
|
+
console.log('Please run this installer on a system with a desktop environment.');
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Ensure Flatpak is installed
|
|
534
|
+
const flatpakReady = await ensureFlatpakInstalledRHEL();
|
|
535
|
+
if (!flatpakReady) {
|
|
536
|
+
console.error('Could not install Flatpak. Please install it manually:');
|
|
537
|
+
console.log(' sudo dnf install -y flatpak');
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Ensure Flathub repository is configured
|
|
542
|
+
const flathubReady = await ensureFlathubConfigured();
|
|
543
|
+
if (!flathubReady) {
|
|
544
|
+
console.error('Could not configure Flathub repository. Please add it manually:');
|
|
545
|
+
console.log(' flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo');
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
console.log('Installing Bambu Studio via Flatpak...');
|
|
550
|
+
|
|
551
|
+
// Install Bambu Studio from Flathub
|
|
552
|
+
const installResult = await shell.exec(`flatpak install -y flathub ${FLATPAK_APP_ID}`);
|
|
553
|
+
|
|
554
|
+
if (installResult.code !== 0) {
|
|
555
|
+
console.error('Failed to install Bambu Studio:', installResult.stderr);
|
|
556
|
+
console.log('');
|
|
557
|
+
console.log('Troubleshooting:');
|
|
558
|
+
console.log(' 1. Ensure you have a desktop environment installed:');
|
|
559
|
+
console.log(' sudo dnf groupinstall -y "GNOME Desktop Environment"');
|
|
560
|
+
console.log(' 2. Install required graphics drivers:');
|
|
561
|
+
console.log(' sudo dnf install -y mesa-libGL mesa-libGLU mesa-dri-drivers');
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Verify installation succeeded
|
|
566
|
+
const verifyInstalled = await isInstalledViaFlatpak();
|
|
567
|
+
if (verifyInstalled) {
|
|
568
|
+
console.log('Bambu Studio installed successfully.');
|
|
569
|
+
console.log('');
|
|
570
|
+
console.log('Launch with: flatpak run com.bambulab.BambuStudio');
|
|
571
|
+
} else {
|
|
572
|
+
console.error('Installation completed but Bambu Studio was not found.');
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Install Bambu Studio on Windows using Chocolatey.
|
|
578
|
+
*
|
|
579
|
+
* Prerequisites:
|
|
580
|
+
* - Windows 10 or Windows 11 (64-bit)
|
|
581
|
+
* - Chocolatey package manager installed
|
|
582
|
+
* - Administrator PowerShell or Command Prompt
|
|
583
|
+
*
|
|
584
|
+
* NOTE: The Chocolatey package depends on vcredist140 (Visual C++ Redistributable),
|
|
585
|
+
* which will be installed automatically if not present.
|
|
586
|
+
*
|
|
587
|
+
* @returns {Promise<void>}
|
|
588
|
+
*/
|
|
589
|
+
async function install_windows() {
|
|
590
|
+
// Check if already installed (idempotency check)
|
|
591
|
+
const alreadyInstalled = await isInstalledOnWindows();
|
|
592
|
+
if (alreadyInstalled) {
|
|
593
|
+
console.log('Bambu Studio is already installed.');
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// Check if Chocolatey is available
|
|
598
|
+
if (!choco.isInstalled()) {
|
|
599
|
+
console.log('Chocolatey is not installed. Please install Chocolatey first:');
|
|
600
|
+
console.log('');
|
|
601
|
+
console.log('Run this command in an Administrator PowerShell:');
|
|
602
|
+
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\'))');
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
console.log('Installing Bambu Studio via Chocolatey...');
|
|
607
|
+
|
|
608
|
+
// Install using Chocolatey
|
|
609
|
+
// The -y flag automatically confirms the installation
|
|
610
|
+
const result = await choco.install(CHOCOLATEY_PACKAGE_NAME);
|
|
611
|
+
|
|
612
|
+
if (!result.success) {
|
|
613
|
+
console.error('Failed to install Bambu Studio:', result.output);
|
|
614
|
+
console.log('');
|
|
615
|
+
console.log('Troubleshooting:');
|
|
616
|
+
console.log(' 1. Ensure you are running as Administrator');
|
|
617
|
+
console.log(' 2. If Visual C++ Redistributable fails, install it manually:');
|
|
618
|
+
console.log(' choco install vcredist140 -y');
|
|
619
|
+
console.log(' 3. Update graphics drivers for OpenGL 2.0+ support');
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Verify installation succeeded
|
|
624
|
+
const verifyInstalled = await isInstalledOnWindows();
|
|
625
|
+
if (verifyInstalled) {
|
|
626
|
+
console.log('Bambu Studio installed successfully.');
|
|
627
|
+
console.log('Location: C:\\Program Files\\Bambu Studio\\bambu-studio.exe');
|
|
628
|
+
console.log('');
|
|
629
|
+
console.log('Launch from the Start Menu or via:');
|
|
630
|
+
console.log(' Start-Process "C:\\Program Files\\Bambu Studio\\bambu-studio.exe"');
|
|
631
|
+
} else {
|
|
632
|
+
console.error('Installation completed but Bambu Studio was not found.');
|
|
633
|
+
console.log('You may need to close and reopen your terminal for PATH updates.');
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Install Bambu Studio on Ubuntu running in WSL (Windows Subsystem for Linux).
|
|
639
|
+
*
|
|
640
|
+
* Uses Flatpak with WSLg for GUI support. WSLg enables Linux GUI applications
|
|
641
|
+
* to run with native Windows integration, appearing as regular Windows windows.
|
|
642
|
+
*
|
|
643
|
+
* Prerequisites:
|
|
644
|
+
* - Windows 10 Build 19044+ or Windows 11
|
|
645
|
+
* - WSL 2 with Ubuntu installed
|
|
646
|
+
* - WSLg enabled (default on Windows 11 and recent Windows 10 updates)
|
|
647
|
+
* - GPU drivers installed on Windows host
|
|
648
|
+
*
|
|
649
|
+
* @returns {Promise<void>}
|
|
650
|
+
*/
|
|
651
|
+
async function install_ubuntu_wsl() {
|
|
652
|
+
// Check if already installed via Flatpak (idempotency check)
|
|
653
|
+
const alreadyInstalled = await isInstalledViaFlatpak();
|
|
654
|
+
if (alreadyInstalled) {
|
|
655
|
+
console.log('Bambu Studio is already installed.');
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
console.log('Note: Bambu Studio in WSL requires WSLg for GUI support.');
|
|
660
|
+
console.log('If you encounter display issues, run "wsl --update" from Windows PowerShell.');
|
|
661
|
+
console.log('');
|
|
662
|
+
|
|
663
|
+
// Check for display environment before proceeding (Bambu Studio requires GUI)
|
|
664
|
+
if (!hasDisplayEnvironment()) {
|
|
665
|
+
console.log('Bambu Studio is a GUI application and requires a desktop environment.');
|
|
666
|
+
console.log('No display environment detected (DISPLAY, WAYLAND_DISPLAY, or XDG_CURRENT_DESKTOP).');
|
|
667
|
+
console.log('');
|
|
668
|
+
console.log('WSLg is required for GUI applications in WSL. Ensure:');
|
|
669
|
+
console.log(' 1. You are running Windows 10 Build 19044+ or Windows 11');
|
|
670
|
+
console.log(' 2. WSL is up to date: wsl --update (from Windows PowerShell)');
|
|
671
|
+
console.log(' 3. WSL 2 is being used: wsl --set-default-version 2');
|
|
672
|
+
console.log('');
|
|
673
|
+
console.log('After updating WSL, restart your WSL session and try again.');
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// Ensure Flatpak is installed
|
|
678
|
+
const flatpakReady = await ensureFlatpakInstalled();
|
|
679
|
+
if (!flatpakReady) {
|
|
680
|
+
console.error('Could not install Flatpak. Please install it manually:');
|
|
681
|
+
console.log(' sudo apt-get update && sudo apt-get install -y flatpak');
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// Ensure Flathub repository is configured
|
|
686
|
+
const flathubReady = await ensureFlathubConfigured();
|
|
687
|
+
if (!flathubReady) {
|
|
688
|
+
console.error('Could not configure Flathub repository. Please add it manually:');
|
|
689
|
+
console.log(' flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo');
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
console.log('Installing Bambu Studio via Flatpak...');
|
|
694
|
+
console.log('Note: This may take several minutes on first install.');
|
|
695
|
+
|
|
696
|
+
// Install Bambu Studio from Flathub
|
|
697
|
+
const installResult = await shell.exec(`flatpak install -y flathub ${FLATPAK_APP_ID}`);
|
|
698
|
+
|
|
699
|
+
if (installResult.code !== 0) {
|
|
700
|
+
console.error('Failed to install Bambu Studio:', installResult.stderr);
|
|
701
|
+
console.log('');
|
|
702
|
+
console.log('Troubleshooting:');
|
|
703
|
+
console.log(' 1. Restart WSL: wsl --shutdown (from Windows PowerShell)');
|
|
704
|
+
console.log(' 2. Update WSL: wsl --update (from Windows PowerShell)');
|
|
705
|
+
console.log(' 3. If network issues, try:');
|
|
706
|
+
console.log(' wsl --shutdown && netsh winsock reset (Admin PowerShell)');
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// Verify installation succeeded
|
|
711
|
+
const verifyInstalled = await isInstalledViaFlatpak();
|
|
712
|
+
if (verifyInstalled) {
|
|
713
|
+
console.log('Bambu Studio installed successfully.');
|
|
714
|
+
console.log('');
|
|
715
|
+
console.log('Launch with: flatpak run com.bambulab.BambuStudio');
|
|
716
|
+
console.log('');
|
|
717
|
+
console.log('If the application window does not appear:');
|
|
718
|
+
console.log(' 1. Verify WSLg is enabled: wsl --version (from Windows PowerShell)');
|
|
719
|
+
console.log(' 2. Update GPU drivers on the Windows host');
|
|
720
|
+
console.log(' 3. For best performance, consider using the native Windows installation');
|
|
721
|
+
} else {
|
|
722
|
+
console.error('Installation completed but Bambu Studio was not found.');
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Install Bambu Studio from Git Bash on Windows.
|
|
728
|
+
*
|
|
729
|
+
* Git Bash runs on Windows and can access Windows package managers.
|
|
730
|
+
* This function installs Bambu Studio using Chocolatey on the Windows host.
|
|
731
|
+
*
|
|
732
|
+
* Prerequisites:
|
|
733
|
+
* - Git Bash installed (comes with Git for Windows)
|
|
734
|
+
* - Chocolatey installed on Windows
|
|
735
|
+
* - Administrator privileges (run Git Bash as Administrator)
|
|
736
|
+
*
|
|
737
|
+
* @returns {Promise<void>}
|
|
738
|
+
*/
|
|
739
|
+
async function install_gitbash() {
|
|
740
|
+
// Git Bash runs on Windows and can access Windows package managers
|
|
741
|
+
// Delegate to the Windows installation function
|
|
742
|
+
console.log('Installing Bambu Studio for Windows from Git Bash...');
|
|
743
|
+
|
|
744
|
+
// Check if already installed (idempotency check)
|
|
745
|
+
// Use a simple file existence check that works from Git Bash
|
|
746
|
+
const checkResult = await shell.exec('ls "/c/Program Files/Bambu Studio/bambu-studio.exe" 2>/dev/null');
|
|
747
|
+
if (checkResult.code === 0) {
|
|
748
|
+
console.log('Bambu Studio is already installed.');
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// Check if Chocolatey is available (might need to use full path in Git Bash)
|
|
753
|
+
const chocoPath = '/c/ProgramData/chocolatey/bin/choco.exe';
|
|
754
|
+
const chocoAvailable = shell.commandExists('choco') || fs.existsSync(chocoPath);
|
|
755
|
+
|
|
756
|
+
if (!chocoAvailable) {
|
|
757
|
+
console.log('Chocolatey is not installed. Please install Chocolatey first:');
|
|
758
|
+
console.log('');
|
|
759
|
+
console.log('Run this command in an Administrator PowerShell:');
|
|
760
|
+
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\'))');
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
console.log('Installing Bambu Studio via Chocolatey...');
|
|
765
|
+
|
|
766
|
+
// Try to use choco from PATH first, fall back to full path
|
|
767
|
+
const chocoCommand = shell.commandExists('choco') ? 'choco' : chocoPath;
|
|
768
|
+
const installResult = await shell.exec(`${chocoCommand} install ${CHOCOLATEY_PACKAGE_NAME} -y`);
|
|
769
|
+
|
|
770
|
+
if (installResult.code !== 0) {
|
|
771
|
+
console.error('Failed to install Bambu Studio:', installResult.stderr);
|
|
772
|
+
console.log('');
|
|
773
|
+
console.log('Troubleshooting:');
|
|
774
|
+
console.log(' 1. Run Git Bash as Administrator (right-click > Run as administrator)');
|
|
775
|
+
console.log(' 2. Try using the full Chocolatey path:');
|
|
776
|
+
console.log(` ${chocoPath} install ${CHOCOLATEY_PACKAGE_NAME} -y`);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// Verify installation succeeded
|
|
781
|
+
const verifyResult = await shell.exec('ls "/c/Program Files/Bambu Studio/bambu-studio.exe" 2>/dev/null');
|
|
782
|
+
if (verifyResult.code === 0) {
|
|
783
|
+
console.log('Bambu Studio installed successfully.');
|
|
784
|
+
console.log('Location: C:\\Program Files\\Bambu Studio\\bambu-studio.exe');
|
|
785
|
+
console.log('');
|
|
786
|
+
console.log('Launch with: "/c/Program Files/Bambu Studio/bambu-studio.exe" &');
|
|
787
|
+
} else {
|
|
788
|
+
console.error('Installation completed but Bambu Studio was not found.');
|
|
789
|
+
console.log('Close and reopen Git Bash for PATH updates to take effect.');
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Check if Bambu Studio is installed on the current platform.
|
|
795
|
+
*
|
|
796
|
+
* This function performs platform-specific checks to determine if Bambu Studio
|
|
797
|
+
* is already installed:
|
|
798
|
+
* - macOS: Checks for the app bundle in /Applications
|
|
799
|
+
* - Windows: Checks for the executable in Program Files
|
|
800
|
+
* - Linux: Checks for Flatpak installation
|
|
801
|
+
* - Raspberry Pi: Checks for Pi-Apps installation
|
|
802
|
+
*
|
|
803
|
+
* @returns {Promise<boolean>} True if Bambu Studio is installed
|
|
804
|
+
*/
|
|
805
|
+
async function isInstalled() {
|
|
806
|
+
const platform = os.detect();
|
|
807
|
+
|
|
808
|
+
// macOS: Check for the app bundle
|
|
809
|
+
if (platform.type === 'macos') {
|
|
810
|
+
return isInstalledOnMacOS();
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// Windows: Check for the executable
|
|
814
|
+
if (platform.type === 'windows') {
|
|
815
|
+
return await isInstalledOnWindows();
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// Git Bash: Check for Windows installation
|
|
819
|
+
if (platform.type === 'gitbash') {
|
|
820
|
+
const checkResult = await shell.exec('ls "/c/Program Files/Bambu Studio/bambu-studio.exe" 2>/dev/null');
|
|
821
|
+
return checkResult.code === 0;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// Raspberry Pi: Check via Pi-Apps
|
|
825
|
+
if (platform.type === 'raspbian') {
|
|
826
|
+
return await isInstalledOnRaspbian();
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// Linux platforms (Ubuntu, Debian, WSL, Amazon Linux, Fedora, RHEL): Check Flatpak
|
|
830
|
+
if (['ubuntu', 'debian', 'wsl', 'amazon_linux', 'fedora', 'rhel'].includes(platform.type)) {
|
|
831
|
+
return await isInstalledViaFlatpak();
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Check if this installer is supported on the current platform.
|
|
839
|
+
*
|
|
840
|
+
* Bambu Studio can be installed on all supported platforms:
|
|
841
|
+
* - macOS (via Homebrew cask)
|
|
842
|
+
* - Ubuntu/Debian (via Flatpak from Flathub)
|
|
843
|
+
* - Raspberry Pi OS (via Pi-Apps, 64-bit only)
|
|
844
|
+
* - Amazon Linux/RHEL/Fedora (via Flatpak from Flathub)
|
|
845
|
+
* - Windows (via Chocolatey)
|
|
846
|
+
* - WSL (via Flatpak with WSLg)
|
|
847
|
+
* - Git Bash (via Windows Chocolatey)
|
|
848
|
+
*
|
|
849
|
+
* @returns {boolean} True if installation is supported on this platform
|
|
850
|
+
*/
|
|
851
|
+
function isEligible() {
|
|
852
|
+
const platform = os.detect();
|
|
853
|
+
const supportedPlatforms = ['macos', 'ubuntu', 'debian', 'wsl', 'raspbian', 'amazon_linux', 'fedora', 'rhel', 'windows', 'gitbash'];
|
|
854
|
+
if (!supportedPlatforms.includes(platform.type)) {
|
|
855
|
+
return false;
|
|
856
|
+
}
|
|
857
|
+
if (REQUIRES_DESKTOP && !os.isDesktopAvailable()) {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Main installation entry point - detects platform and runs appropriate installer.
|
|
865
|
+
*
|
|
866
|
+
* This function automatically determines the current operating system and
|
|
867
|
+
* invokes the correct platform-specific installation function.
|
|
868
|
+
*
|
|
869
|
+
* Supported platforms:
|
|
870
|
+
* - macOS: Homebrew cask
|
|
871
|
+
* - Ubuntu/Debian: Flatpak from Flathub
|
|
872
|
+
* - Raspberry Pi OS: Pi-Apps (64-bit only)
|
|
873
|
+
* - Amazon Linux/RHEL: Flatpak from Flathub
|
|
874
|
+
* - Windows: Chocolatey
|
|
875
|
+
* - WSL: Flatpak with WSLg
|
|
876
|
+
* - Git Bash: Windows Chocolatey
|
|
12
877
|
*
|
|
13
878
|
* @returns {Promise<void>}
|
|
14
879
|
*/
|
|
15
880
|
async function install() {
|
|
16
881
|
const platform = os.detect();
|
|
17
882
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
883
|
+
// Map platform types to their respective installer functions
|
|
884
|
+
// This mapping handles aliases (e.g., debian maps to ubuntu)
|
|
885
|
+
const installers = {
|
|
886
|
+
'macos': install_macos,
|
|
887
|
+
'ubuntu': install_ubuntu,
|
|
888
|
+
'debian': install_ubuntu,
|
|
889
|
+
'wsl': install_ubuntu_wsl,
|
|
890
|
+
'raspbian': install_raspbian,
|
|
891
|
+
'amazon_linux': install_amazon_linux,
|
|
892
|
+
'fedora': install_amazon_linux,
|
|
893
|
+
'rhel': install_amazon_linux,
|
|
894
|
+
'windows': install_windows,
|
|
895
|
+
'gitbash': install_gitbash
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
const installer = installers[platform.type];
|
|
899
|
+
|
|
900
|
+
// Handle unsupported platforms gracefully (no errors, no alternatives)
|
|
901
|
+
if (!installer) {
|
|
902
|
+
console.log(`Bambu Studio is not available for ${platform.type}.`);
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
await installer();
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// Export all functions for use as a module and for testing
|
|
910
|
+
module.exports = {
|
|
911
|
+
REQUIRES_DESKTOP,
|
|
912
|
+
install,
|
|
913
|
+
isInstalled,
|
|
914
|
+
isEligible,
|
|
915
|
+
install_macos,
|
|
916
|
+
install_ubuntu,
|
|
917
|
+
install_ubuntu_wsl,
|
|
918
|
+
install_raspbian,
|
|
919
|
+
install_amazon_linux,
|
|
920
|
+
install_windows,
|
|
921
|
+
install_gitbash
|
|
922
|
+
};
|
|
41
923
|
|
|
924
|
+
// Allow direct execution of this script: node bambu-studio.js
|
|
42
925
|
if (require.main === module) {
|
|
43
|
-
install()
|
|
926
|
+
install().catch(err => {
|
|
927
|
+
console.error(err.message);
|
|
928
|
+
process.exit(1);
|
|
929
|
+
});
|
|
44
930
|
}
|