@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
package/src/installs/slack.js
CHANGED
|
@@ -3,42 +3,739 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @fileoverview Install Slack.
|
|
5
5
|
* @module installs/slack
|
|
6
|
+
*
|
|
7
|
+
* Slack is a team communication and collaboration platform that provides
|
|
8
|
+
* messaging, file sharing, and integrations with thousands of productivity tools.
|
|
9
|
+
* It enables teams to communicate through channels, direct messages, and huddles
|
|
10
|
+
* (audio/video calls).
|
|
11
|
+
*
|
|
12
|
+
* This installer provides:
|
|
13
|
+
* - Slack Desktop App for macOS via Homebrew cask
|
|
14
|
+
* - Slack Desktop App for Windows via Chocolatey
|
|
15
|
+
* - Slack Desktop App for Ubuntu/Debian via Snap (x86_64 only)
|
|
16
|
+
* - Slack Desktop App for Amazon Linux/RHEL via RPM repository
|
|
17
|
+
* - Instructions to launch Windows Slack from WSL/Git Bash
|
|
18
|
+
*
|
|
19
|
+
* IMPORTANT PLATFORM NOTES:
|
|
20
|
+
* - Raspberry Pi OS: Slack does not provide native ARM packages. Users should
|
|
21
|
+
* use the Slack web application at https://app.slack.com instead.
|
|
22
|
+
* - Linux is officially in beta and requires 64-bit x86_64 architecture.
|
|
6
23
|
*/
|
|
7
24
|
|
|
8
25
|
const os = require('../utils/common/os');
|
|
26
|
+
const shell = require('../utils/common/shell');
|
|
27
|
+
const brew = require('../utils/macos/brew');
|
|
28
|
+
const macosApps = require('../utils/macos/apps');
|
|
29
|
+
const snap = require('../utils/ubuntu/snap');
|
|
30
|
+
const choco = require('../utils/windows/choco');
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Indicates whether this installer requires a desktop environment.
|
|
34
|
+
* Slack is a GUI application and requires a display.
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
*/
|
|
37
|
+
const REQUIRES_DESKTOP = true;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The Homebrew cask name for Slack on macOS.
|
|
41
|
+
* This installs the full desktop application to /Applications.
|
|
42
|
+
*/
|
|
43
|
+
const HOMEBREW_CASK_NAME = 'slack';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The Chocolatey package name for Slack on Windows.
|
|
47
|
+
*/
|
|
48
|
+
const CHOCO_PACKAGE_NAME = 'slack';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The Snap package name for Slack on Ubuntu/Debian.
|
|
52
|
+
*/
|
|
53
|
+
const SNAP_PACKAGE_NAME = 'slack';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Check if Slack Desktop application is installed on macOS.
|
|
57
|
+
*
|
|
58
|
+
* Looks for Slack.app in /Applications or ~/Applications.
|
|
59
|
+
*
|
|
60
|
+
* @returns {boolean} True if Slack.app exists, false otherwise
|
|
61
|
+
*/
|
|
62
|
+
function isSlackInstalledMacOS() {
|
|
63
|
+
return macosApps.isAppInstalled('Slack');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Check if the Slack command is available in PATH on Linux systems.
|
|
68
|
+
*
|
|
69
|
+
* After Snap installation, the 'slack' command should be available.
|
|
70
|
+
*
|
|
71
|
+
* @returns {boolean} True if slack command exists, false otherwise
|
|
72
|
+
*/
|
|
73
|
+
function isSlackCommandAvailable() {
|
|
74
|
+
return shell.commandExists('slack');
|
|
75
|
+
}
|
|
9
76
|
|
|
10
77
|
/**
|
|
11
|
-
* Install Slack
|
|
78
|
+
* Install Slack Desktop on macOS using Homebrew cask.
|
|
79
|
+
*
|
|
80
|
+
* Prerequisites:
|
|
81
|
+
* - macOS 11 (Big Sur) or later
|
|
82
|
+
* - Homebrew package manager installed
|
|
83
|
+
* - At least 500 MB free disk space
|
|
84
|
+
* - Apple Silicon (M1/M2/M3/M4) or Intel processor
|
|
85
|
+
*
|
|
86
|
+
* The installation uses the Homebrew cask 'slack' which downloads and installs
|
|
87
|
+
* the Slack desktop application to /Applications/Slack.app.
|
|
88
|
+
*
|
|
89
|
+
* NOTE: After installation, Slack must be launched manually. On first launch,
|
|
90
|
+
* it will prompt you to sign in with your workspace URL or email address.
|
|
91
|
+
*
|
|
92
|
+
* @returns {Promise<void>}
|
|
93
|
+
* @throws {Error} If Homebrew is not installed or installation fails
|
|
94
|
+
*/
|
|
95
|
+
async function install_macos() {
|
|
96
|
+
console.log('Checking if Slack is already installed...');
|
|
97
|
+
|
|
98
|
+
// Check if Slack.app already exists in Applications
|
|
99
|
+
if (isSlackInstalledMacOS()) {
|
|
100
|
+
console.log('Slack is already installed, skipping installation.');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Also check if the cask is installed via Homebrew
|
|
105
|
+
const caskInstalled = await brew.isCaskInstalled(HOMEBREW_CASK_NAME);
|
|
106
|
+
if (caskInstalled) {
|
|
107
|
+
console.log('Slack is already installed via Homebrew, skipping installation.');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Verify Homebrew is available
|
|
112
|
+
if (!brew.isInstalled()) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
'Homebrew is not installed. Please install Homebrew first using:\n' +
|
|
115
|
+
' dev install homebrew\n' +
|
|
116
|
+
'Then retry installing Slack.'
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
console.log('Installing Slack via Homebrew...');
|
|
121
|
+
|
|
122
|
+
// Install Slack cask with quiet flag for cleaner output
|
|
123
|
+
const result = await shell.exec('brew install --quiet --cask slack');
|
|
124
|
+
|
|
125
|
+
if (result.code !== 0) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`Failed to install Slack via Homebrew.\n` +
|
|
128
|
+
`Output: ${result.stderr || result.stdout}\n\n` +
|
|
129
|
+
`Troubleshooting:\n` +
|
|
130
|
+
` 1. Run 'brew update && brew cleanup' and retry\n` +
|
|
131
|
+
` 2. Check if macOS version is 11 (Big Sur) or later\n` +
|
|
132
|
+
` 3. Try manual installation: brew reinstall --cask slack`
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Verify installation succeeded
|
|
137
|
+
if (!isSlackInstalledMacOS()) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
'Installation command completed but Slack.app was not found in Applications.\n\n' +
|
|
140
|
+
'Please try:\n' +
|
|
141
|
+
' 1. Check /Applications for Slack.app\n' +
|
|
142
|
+
' 2. Run: brew reinstall --cask slack'
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.log('Slack installed successfully.');
|
|
147
|
+
console.log('');
|
|
148
|
+
console.log('To launch Slack:');
|
|
149
|
+
console.log(' - Open from Applications folder, or');
|
|
150
|
+
console.log(' - Run: open -a Slack');
|
|
151
|
+
console.log('');
|
|
152
|
+
console.log('On first launch, you will be prompted to sign in with your');
|
|
153
|
+
console.log('workspace URL or email address.');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Install Slack on Ubuntu/Debian using Snap.
|
|
158
|
+
*
|
|
159
|
+
* Prerequisites:
|
|
160
|
+
* - Ubuntu 16.04 LTS or later, or Debian 10 (Buster) or later
|
|
161
|
+
* - 64-bit x86_64 architecture (ARM is not supported)
|
|
162
|
+
* - sudo privileges
|
|
163
|
+
* - Snap package manager (pre-installed on Ubuntu 16.04+)
|
|
164
|
+
* - At least 500 MB free disk space
|
|
165
|
+
*
|
|
166
|
+
* The installation uses the Snap package which provides automatic updates
|
|
167
|
+
* and sandboxed execution. The --classic flag is required to allow Slack
|
|
168
|
+
* access to system resources for features like file access and system tray.
|
|
169
|
+
*
|
|
170
|
+
* IMPORTANT: Slack Snap is only available for x86_64 architecture. ARM-based
|
|
171
|
+
* systems (including Raspberry Pi) are not supported.
|
|
172
|
+
*
|
|
173
|
+
* @returns {Promise<void>}
|
|
174
|
+
* @throws {Error} If architecture is not supported or installation fails
|
|
175
|
+
*/
|
|
176
|
+
async function install_ubuntu() {
|
|
177
|
+
console.log('Checking if Slack is already installed...');
|
|
178
|
+
|
|
179
|
+
// Check if Slack is already installed via Snap
|
|
180
|
+
const isInstalled = await snap.isSnapInstalled(SNAP_PACKAGE_NAME);
|
|
181
|
+
if (isInstalled) {
|
|
182
|
+
console.log('Slack is already installed, skipping installation.');
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Also check if slack command exists (could be installed another way)
|
|
187
|
+
if (isSlackCommandAvailable()) {
|
|
188
|
+
console.log('Slack is already installed, skipping installation.');
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Verify architecture - Slack Snap only supports x86_64
|
|
193
|
+
const archResult = await shell.exec('uname -m');
|
|
194
|
+
const arch = archResult.stdout.trim();
|
|
195
|
+
if (arch !== 'x86_64') {
|
|
196
|
+
console.log(`Slack is not available for ${arch} architecture.`);
|
|
197
|
+
console.log('');
|
|
198
|
+
console.log('Slack requires 64-bit x86_64 architecture for the native desktop app.');
|
|
199
|
+
console.log('You can use the Slack web application at https://app.slack.com instead.');
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Verify Snap is available
|
|
204
|
+
if (!snap.isInstalled()) {
|
|
205
|
+
throw new Error(
|
|
206
|
+
'Snap package manager is not installed.\n\n' +
|
|
207
|
+
'On Ubuntu, Snap should be pre-installed. If not, install it with:\n' +
|
|
208
|
+
' sudo apt-get update && sudo apt-get install -y snapd\n' +
|
|
209
|
+
' sudo systemctl enable --now snapd.socket\n\n' +
|
|
210
|
+
'Then log out and back in, and retry installing Slack.'
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
console.log('Installing Slack via Snap...');
|
|
215
|
+
console.log('This may take a few minutes...');
|
|
216
|
+
|
|
217
|
+
// Install Slack with classic confinement for full system access
|
|
218
|
+
const result = await snap.install(SNAP_PACKAGE_NAME, { classic: true });
|
|
219
|
+
|
|
220
|
+
if (!result.success) {
|
|
221
|
+
throw new Error(
|
|
222
|
+
`Failed to install Slack via Snap.\n` +
|
|
223
|
+
`Output: ${result.output}\n\n` +
|
|
224
|
+
`Troubleshooting:\n` +
|
|
225
|
+
` 1. Ensure snapd is running: sudo systemctl start snapd\n` +
|
|
226
|
+
` 2. Check architecture: uname -m (must be x86_64)\n` +
|
|
227
|
+
` 3. Try manual installation: sudo snap install slack --classic`
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Verify installation succeeded
|
|
232
|
+
const verifyInstalled = await snap.isSnapInstalled(SNAP_PACKAGE_NAME);
|
|
233
|
+
if (!verifyInstalled) {
|
|
234
|
+
throw new Error(
|
|
235
|
+
'Installation command completed but Slack was not found.\n\n' +
|
|
236
|
+
'Please try:\n' +
|
|
237
|
+
' 1. Run: snap list slack\n' +
|
|
238
|
+
' 2. Retry: sudo snap install slack --classic'
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
console.log('Slack installed successfully.');
|
|
243
|
+
console.log('');
|
|
244
|
+
console.log('To launch Slack:');
|
|
245
|
+
console.log(' - Run: slack &');
|
|
246
|
+
console.log(' - Or find Slack in your application menu');
|
|
247
|
+
console.log('');
|
|
248
|
+
console.log('On first launch, you will be prompted to sign in with your');
|
|
249
|
+
console.log('workspace URL or email address.');
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Install Slack on Raspberry Pi OS.
|
|
254
|
+
*
|
|
255
|
+
* PLATFORM LIMITATION: Slack does not provide native ARM packages. The official
|
|
256
|
+
* Slack desktop application and Snap package are only available for x86_64
|
|
257
|
+
* architecture. Raspberry Pi devices use ARM processors, which are not supported.
|
|
258
|
+
*
|
|
259
|
+
* This function gracefully informs the user that Slack is not available for
|
|
260
|
+
* Raspberry Pi and suggests using the web application instead.
|
|
261
|
+
*
|
|
262
|
+
* @returns {Promise<void>}
|
|
263
|
+
*/
|
|
264
|
+
async function install_raspbian() {
|
|
265
|
+
console.log('Slack is not available for Raspberry Pi OS.');
|
|
266
|
+
console.log('');
|
|
267
|
+
console.log('The Slack desktop application requires x86_64 architecture.');
|
|
268
|
+
console.log('Raspberry Pi uses ARM processors which are not supported.');
|
|
269
|
+
console.log('');
|
|
270
|
+
console.log('You can access Slack via the web application at:');
|
|
271
|
+
console.log(' https://app.slack.com');
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Install Slack on Amazon Linux/RHEL using the official RPM repository.
|
|
277
|
+
*
|
|
278
|
+
* Prerequisites:
|
|
279
|
+
* - Amazon Linux 2023, Amazon Linux 2, RHEL 8/9, or Fedora (64-bit x86_64)
|
|
280
|
+
* - sudo privileges
|
|
281
|
+
* - Graphical desktop environment (required for Slack GUI)
|
|
282
|
+
* - At least 500 MB free disk space
|
|
283
|
+
*
|
|
284
|
+
* IMPORTANT: Amazon Linux EC2 instances typically run headless (no GUI).
|
|
285
|
+
* If you are running a headless server, use the Slack web application at
|
|
286
|
+
* https://app.slack.com or the Slack API for automation.
|
|
287
|
+
*
|
|
288
|
+
* This function:
|
|
289
|
+
* 1. Imports the Slack GPG key for package verification
|
|
290
|
+
* 2. Creates the Slack YUM/DNF repository configuration
|
|
291
|
+
* 3. Installs Slack via the package manager
|
|
292
|
+
*
|
|
293
|
+
* @returns {Promise<void>}
|
|
294
|
+
* @throws {Error} If installation fails
|
|
295
|
+
*/
|
|
296
|
+
async function install_amazon_linux() {
|
|
297
|
+
console.log('Checking if Slack is already installed...');
|
|
298
|
+
|
|
299
|
+
// Check if Slack is already installed
|
|
300
|
+
if (isSlackCommandAvailable()) {
|
|
301
|
+
console.log('Slack is already installed, skipping installation.');
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Also check via rpm
|
|
306
|
+
const rpmCheck = await shell.exec('rpm -qa | grep -i "^slack"');
|
|
307
|
+
if (rpmCheck.code === 0 && rpmCheck.stdout.trim()) {
|
|
308
|
+
console.log('Slack is already installed, skipping installation.');
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Verify architecture - Slack only supports x86_64
|
|
313
|
+
const archResult = await shell.exec('uname -m');
|
|
314
|
+
const arch = archResult.stdout.trim();
|
|
315
|
+
if (arch !== 'x86_64') {
|
|
316
|
+
console.log(`Slack is not available for ${arch} architecture.`);
|
|
317
|
+
console.log('');
|
|
318
|
+
console.log('Slack requires 64-bit x86_64 architecture for the native desktop app.');
|
|
319
|
+
console.log('You can use the Slack web application at https://app.slack.com instead.');
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Detect package manager (dnf for AL2023/RHEL8+, yum for AL2)
|
|
324
|
+
const hasDnf = shell.commandExists('dnf');
|
|
325
|
+
const hasYum = shell.commandExists('yum');
|
|
326
|
+
const packageManager = hasDnf ? 'dnf' : (hasYum ? 'yum' : null);
|
|
327
|
+
|
|
328
|
+
if (!packageManager) {
|
|
329
|
+
throw new Error(
|
|
330
|
+
'Neither dnf nor yum package manager found.\n' +
|
|
331
|
+
'This installer supports Amazon Linux 2023 (dnf) and Amazon Linux 2 (yum).'
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
console.log(`Detected package manager: ${packageManager}`);
|
|
336
|
+
|
|
337
|
+
// Step 1: Import the Slack GPG key
|
|
338
|
+
console.log('Importing Slack GPG key...');
|
|
339
|
+
const gpgResult = await shell.exec(
|
|
340
|
+
'sudo rpm --import https://packagecloud.io/slacktechnologies/slack/gpgkey'
|
|
341
|
+
);
|
|
342
|
+
if (gpgResult.code !== 0) {
|
|
343
|
+
throw new Error(
|
|
344
|
+
`Failed to import Slack GPG key.\n` +
|
|
345
|
+
`Output: ${gpgResult.stderr}\n\n` +
|
|
346
|
+
`Troubleshooting:\n` +
|
|
347
|
+
` 1. Ensure curl is installed: sudo ${packageManager} install -y curl ca-certificates\n` +
|
|
348
|
+
` 2. Check network connectivity\n` +
|
|
349
|
+
` 3. Retry: sudo rpm --import https://packagecloud.io/slacktechnologies/slack/gpgkey`
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Step 2: Create the Slack repository configuration
|
|
354
|
+
console.log('Adding Slack repository...');
|
|
355
|
+
const repoContent = `[slack]
|
|
356
|
+
name=Slack
|
|
357
|
+
baseurl=https://packagecloud.io/slacktechnologies/slack/fedora/21/x86_64
|
|
358
|
+
enabled=1
|
|
359
|
+
gpgcheck=1
|
|
360
|
+
gpgkey=https://packagecloud.io/slacktechnologies/slack/gpgkey
|
|
361
|
+
sslverify=1
|
|
362
|
+
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|
|
363
|
+
metadata_expire=300
|
|
364
|
+
`;
|
|
365
|
+
|
|
366
|
+
// Write the repository file using tee to handle sudo
|
|
367
|
+
const repoResult = await shell.exec(
|
|
368
|
+
`echo '${repoContent}' | sudo tee /etc/yum.repos.d/slack.repo > /dev/null`
|
|
369
|
+
);
|
|
370
|
+
if (repoResult.code !== 0) {
|
|
371
|
+
throw new Error(
|
|
372
|
+
`Failed to create Slack repository file.\n` +
|
|
373
|
+
`Output: ${repoResult.stderr}\n\n` +
|
|
374
|
+
`Troubleshooting:\n` +
|
|
375
|
+
` 1. Check sudo permissions\n` +
|
|
376
|
+
` 2. Verify /etc/yum.repos.d/ exists and is writable`
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Step 3: Install Slack
|
|
381
|
+
console.log('Installing Slack...');
|
|
382
|
+
console.log('This may take a few minutes...');
|
|
383
|
+
|
|
384
|
+
const installResult = await shell.exec(`sudo ${packageManager} install -y slack`);
|
|
385
|
+
|
|
386
|
+
if (installResult.code !== 0) {
|
|
387
|
+
throw new Error(
|
|
388
|
+
`Failed to install Slack.\n` +
|
|
389
|
+
`Output: ${installResult.stderr}\n\n` +
|
|
390
|
+
`Troubleshooting:\n` +
|
|
391
|
+
` 1. Verify the repository file: cat /etc/yum.repos.d/slack.repo\n` +
|
|
392
|
+
` 2. Update package cache: sudo ${packageManager} clean all && sudo ${packageManager} makecache\n` +
|
|
393
|
+
` 3. Retry: sudo ${packageManager} install -y slack`
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Verify installation
|
|
398
|
+
if (!isSlackCommandAvailable()) {
|
|
399
|
+
throw new Error(
|
|
400
|
+
'Installation command completed but Slack was not found.\n\n' +
|
|
401
|
+
'Please try:\n' +
|
|
402
|
+
' 1. Check: rpm -qa | grep slack\n' +
|
|
403
|
+
' 2. Retry: sudo ' + packageManager + ' install -y slack'
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
console.log('Slack installed successfully.');
|
|
408
|
+
console.log('');
|
|
409
|
+
console.log('To launch Slack:');
|
|
410
|
+
console.log(' - Run: slack &');
|
|
411
|
+
console.log(' - Or find Slack in your application menu');
|
|
412
|
+
console.log('');
|
|
413
|
+
console.log('NOTE: Slack requires a graphical desktop environment.');
|
|
414
|
+
console.log('If running on a headless server, use the web application at:');
|
|
415
|
+
console.log(' https://app.slack.com');
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Install Slack on Windows using Chocolatey.
|
|
420
|
+
*
|
|
421
|
+
* Prerequisites:
|
|
422
|
+
* - Windows 10 version 1903 or later, or Windows 11 (64-bit)
|
|
423
|
+
* - At least 500 MB free disk space
|
|
424
|
+
* - Administrator PowerShell or Command Prompt
|
|
425
|
+
* - Chocolatey package manager installed
|
|
426
|
+
*
|
|
427
|
+
* The installation uses Chocolatey's 'slack' package which downloads and
|
|
428
|
+
* installs the official Slack desktop application.
|
|
429
|
+
*
|
|
430
|
+
* NOTE: After installation, Slack can be launched from the Start Menu or
|
|
431
|
+
* via the 'slack:' protocol handler.
|
|
432
|
+
*
|
|
433
|
+
* @returns {Promise<void>}
|
|
434
|
+
* @throws {Error} If Chocolatey is not installed or installation fails
|
|
435
|
+
*/
|
|
436
|
+
async function install_windows() {
|
|
437
|
+
console.log('Checking if Slack is already installed...');
|
|
438
|
+
|
|
439
|
+
// Check if Slack is already installed via Chocolatey
|
|
440
|
+
const isInstalled = await choco.isPackageInstalled(CHOCO_PACKAGE_NAME);
|
|
441
|
+
if (isInstalled) {
|
|
442
|
+
console.log('Slack is already installed, skipping installation.');
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Verify Chocolatey is available
|
|
447
|
+
if (!choco.isInstalled()) {
|
|
448
|
+
throw new Error(
|
|
449
|
+
'Chocolatey is not installed. Please install Chocolatey first:\n\n' +
|
|
450
|
+
'Run the following in an Administrator PowerShell:\n' +
|
|
451
|
+
' Set-ExecutionPolicy Bypass -Scope Process -Force; ' +
|
|
452
|
+
'[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ' +
|
|
453
|
+
'iex ((New-Object System.Net.WebClient).DownloadString(\'https://community.chocolatey.org/install.ps1\'))\n\n' +
|
|
454
|
+
'Then retry installing Slack.'
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
console.log('Installing Slack via Chocolatey...');
|
|
459
|
+
console.log('This may take a few minutes...');
|
|
460
|
+
|
|
461
|
+
// Install Slack
|
|
462
|
+
const result = await choco.install(CHOCO_PACKAGE_NAME);
|
|
463
|
+
|
|
464
|
+
if (!result.success) {
|
|
465
|
+
throw new Error(
|
|
466
|
+
`Failed to install Slack via Chocolatey.\n` +
|
|
467
|
+
`Output: ${result.output}\n\n` +
|
|
468
|
+
`Troubleshooting:\n` +
|
|
469
|
+
` 1. Ensure you are running as Administrator\n` +
|
|
470
|
+
` 2. Run 'choco list slack' to check availability\n` +
|
|
471
|
+
` 3. Try manual installation: choco install slack -y --force`
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// Verify installation
|
|
476
|
+
const verifyInstalled = await choco.isPackageInstalled(CHOCO_PACKAGE_NAME);
|
|
477
|
+
if (!verifyInstalled) {
|
|
478
|
+
throw new Error(
|
|
479
|
+
'Installation command completed but Slack was not found.\n\n' +
|
|
480
|
+
'Please try:\n' +
|
|
481
|
+
' 1. Run: choco list slack\n' +
|
|
482
|
+
' 2. Retry: choco install slack -y'
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
console.log('Slack installed successfully.');
|
|
487
|
+
console.log('');
|
|
488
|
+
console.log('To launch Slack:');
|
|
489
|
+
console.log(' - Open from Start Menu, or');
|
|
490
|
+
console.log(' - Run: Start-Process slack:');
|
|
491
|
+
console.log('');
|
|
492
|
+
console.log('On first launch, you will be prompted to sign in with your');
|
|
493
|
+
console.log('workspace URL or email address.');
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Install Slack when running from Ubuntu on WSL (Windows Subsystem for Linux).
|
|
498
|
+
*
|
|
499
|
+
* PLATFORM APPROACH: Slack is installed on the Windows host and accessed from
|
|
500
|
+
* WSL. While WSL with WSLg can technically run Linux GUI applications, the
|
|
501
|
+
* recommended approach is to install Slack on Windows and launch it from WSL
|
|
502
|
+
* using Windows interoperability.
|
|
503
|
+
*
|
|
504
|
+
* Prerequisites:
|
|
505
|
+
* - Windows 10 version 2004 or higher, or Windows 11
|
|
506
|
+
* - WSL 2 enabled with Ubuntu distribution installed
|
|
507
|
+
* - Chocolatey installed on Windows for Slack installation
|
|
508
|
+
*
|
|
509
|
+
* This function installs Slack on the Windows host via PowerShell/Chocolatey.
|
|
510
|
+
*
|
|
511
|
+
* @returns {Promise<void>}
|
|
512
|
+
* @throws {Error} If installation on Windows host fails
|
|
513
|
+
*/
|
|
514
|
+
async function install_ubuntu_wsl() {
|
|
515
|
+
console.log('Detected Ubuntu running in WSL (Windows Subsystem for Linux).');
|
|
516
|
+
console.log('');
|
|
517
|
+
console.log('Installing Slack on the Windows host...');
|
|
518
|
+
console.log('');
|
|
519
|
+
|
|
520
|
+
// Check if Slack is already available (can test via Windows interop)
|
|
521
|
+
const slackCheck = await shell.exec('cmd.exe /c "choco list slack --local-only" 2>/dev/null');
|
|
522
|
+
if (slackCheck.code === 0 && slackCheck.stdout.toLowerCase().includes('slack')) {
|
|
523
|
+
console.log('Slack is already installed on Windows, skipping installation.');
|
|
524
|
+
console.log('');
|
|
525
|
+
console.log('To launch Slack from WSL:');
|
|
526
|
+
console.log(' cmd.exe /c start slack:');
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
console.log('Installing Slack via Chocolatey on Windows...');
|
|
531
|
+
console.log('This may take a few minutes...');
|
|
532
|
+
|
|
533
|
+
// Install via PowerShell using Chocolatey
|
|
534
|
+
const installResult = await shell.exec(
|
|
535
|
+
'powershell.exe -NoProfile -Command "choco install slack -y"'
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
if (installResult.code !== 0) {
|
|
539
|
+
throw new Error(
|
|
540
|
+
`Failed to install Slack on Windows host.\n` +
|
|
541
|
+
`Output: ${installResult.stdout || installResult.stderr}\n\n` +
|
|
542
|
+
`Troubleshooting:\n` +
|
|
543
|
+
` 1. Ensure Chocolatey is installed on Windows\n` +
|
|
544
|
+
` 2. Open an Administrator PowerShell on Windows and run:\n` +
|
|
545
|
+
` choco install slack -y\n` +
|
|
546
|
+
` 3. Then launch from WSL with: cmd.exe /c start slack:`
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
console.log('Slack installed successfully on Windows.');
|
|
551
|
+
console.log('');
|
|
552
|
+
console.log('To launch Slack from WSL:');
|
|
553
|
+
console.log(' cmd.exe /c start slack:');
|
|
554
|
+
console.log('');
|
|
555
|
+
console.log('Alternative - open Slack web in browser:');
|
|
556
|
+
console.log(' cmd.exe /c start https://app.slack.com');
|
|
557
|
+
console.log('');
|
|
558
|
+
console.log('TIP: Add an alias to ~/.bashrc for convenience:');
|
|
559
|
+
console.log(' echo \'alias slack="cmd.exe /c start slack:"\' >> ~/.bashrc');
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Install Slack from Git Bash on Windows.
|
|
564
|
+
*
|
|
565
|
+
* Git Bash runs within Windows, so this function installs Slack on the
|
|
566
|
+
* Windows host using Chocolatey via PowerShell interop.
|
|
567
|
+
*
|
|
568
|
+
* Prerequisites:
|
|
569
|
+
* - Windows 10 or Windows 11 (64-bit)
|
|
570
|
+
* - Git Bash installed (comes with Git for Windows)
|
|
571
|
+
* - Chocolatey package manager installed on Windows
|
|
572
|
+
* - Administrator privileges
|
|
573
|
+
*
|
|
574
|
+
* @returns {Promise<void>}
|
|
575
|
+
* @throws {Error} If installation fails
|
|
576
|
+
*/
|
|
577
|
+
async function install_gitbash() {
|
|
578
|
+
console.log('Detected Git Bash on Windows.');
|
|
579
|
+
console.log('Installing Slack on the Windows host...');
|
|
580
|
+
console.log('');
|
|
581
|
+
|
|
582
|
+
// Check if Slack is already installed
|
|
583
|
+
const slackCheck = await shell.exec('choco list slack --local-only 2>/dev/null');
|
|
584
|
+
if (slackCheck.code === 0 && slackCheck.stdout.toLowerCase().includes('slack')) {
|
|
585
|
+
console.log('Slack is already installed, skipping installation.');
|
|
586
|
+
console.log('');
|
|
587
|
+
console.log('To launch Slack:');
|
|
588
|
+
console.log(' start slack:');
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
console.log('Installing Slack via Chocolatey...');
|
|
593
|
+
console.log('This may take a few minutes...');
|
|
594
|
+
|
|
595
|
+
// Install via PowerShell using Chocolatey
|
|
596
|
+
const installResult = await shell.exec(
|
|
597
|
+
'powershell.exe -NoProfile -Command "choco install slack -y"'
|
|
598
|
+
);
|
|
599
|
+
|
|
600
|
+
if (installResult.code !== 0) {
|
|
601
|
+
throw new Error(
|
|
602
|
+
`Failed to install Slack.\n` +
|
|
603
|
+
`Output: ${installResult.stdout || installResult.stderr}\n\n` +
|
|
604
|
+
`Troubleshooting:\n` +
|
|
605
|
+
` 1. Ensure Chocolatey is installed on Windows\n` +
|
|
606
|
+
` 2. Run Git Bash as Administrator and retry\n` +
|
|
607
|
+
` 3. Try installing directly from PowerShell:\n` +
|
|
608
|
+
` choco install slack -y`
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
console.log('Slack installed successfully.');
|
|
613
|
+
console.log('');
|
|
614
|
+
console.log('To launch Slack from Git Bash:');
|
|
615
|
+
console.log(' start slack:');
|
|
616
|
+
console.log('');
|
|
617
|
+
console.log('Or use the explicit Windows command:');
|
|
618
|
+
console.log(' cmd //c "start slack:"');
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Check if Slack is installed on the current platform.
|
|
623
|
+
*
|
|
624
|
+
* This function performs platform-specific checks to determine if Slack
|
|
625
|
+
* is already installed on the system.
|
|
626
|
+
*
|
|
627
|
+
* @returns {Promise<boolean>} True if Slack is installed, false otherwise
|
|
628
|
+
*/
|
|
629
|
+
async function isInstalled() {
|
|
630
|
+
const platform = os.detect();
|
|
631
|
+
|
|
632
|
+
if (platform.type === 'macos') {
|
|
633
|
+
return isSlackInstalledMacOS();
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
if (platform.type === 'windows' || platform.type === 'gitbash') {
|
|
637
|
+
return choco.isPackageInstalled(CHOCO_PACKAGE_NAME);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (['ubuntu', 'debian', 'wsl'].includes(platform.type)) {
|
|
641
|
+
return snap.isSnapInstalled(SNAP_PACKAGE_NAME);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// For other platforms (Amazon Linux, etc.), check for command
|
|
645
|
+
return isSlackCommandAvailable();
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Check if this installer is supported on the current platform.
|
|
650
|
+
*
|
|
651
|
+
* Slack is NOT available on ARM platforms (Raspberry Pi) and requires
|
|
652
|
+
* a desktop environment since it is a GUI application.
|
|
653
|
+
*
|
|
654
|
+
* @returns {boolean} True if installation is supported on this platform
|
|
655
|
+
*/
|
|
656
|
+
function isEligible() {
|
|
657
|
+
const platform = os.detect();
|
|
658
|
+
|
|
659
|
+
// First check if the platform is supported
|
|
660
|
+
// Slack does NOT provide native ARM packages for Raspberry Pi
|
|
661
|
+
const supportedPlatforms = ['macos', 'ubuntu', 'debian', 'wsl', 'amazon_linux', 'rhel', 'fedora', 'windows', 'gitbash'];
|
|
662
|
+
if (!supportedPlatforms.includes(platform.type)) {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// This installer requires a desktop environment
|
|
667
|
+
if (REQUIRES_DESKTOP && !os.isDesktopAvailable()) {
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Main installation entry point.
|
|
676
|
+
*
|
|
677
|
+
* Detects the current platform and runs the appropriate installer function.
|
|
678
|
+
* Handles platform-specific mappings to ensure all supported platforms
|
|
679
|
+
* have appropriate installation logic.
|
|
680
|
+
*
|
|
681
|
+
* Supported platforms:
|
|
682
|
+
* - macOS: Slack Desktop via Homebrew cask
|
|
683
|
+
* - Ubuntu/Debian: Slack Desktop via Snap (x86_64 only)
|
|
684
|
+
* - Raspberry Pi OS: Not supported (graceful message with web app alternative)
|
|
685
|
+
* - Amazon Linux/RHEL: Slack Desktop via RPM repository (x86_64 only)
|
|
686
|
+
* - Windows: Slack Desktop via Chocolatey
|
|
687
|
+
* - WSL (Ubuntu): Installs Slack on Windows host
|
|
688
|
+
* - Git Bash: Installs Slack on Windows host
|
|
12
689
|
*
|
|
13
690
|
* @returns {Promise<void>}
|
|
14
691
|
*/
|
|
15
692
|
async function install() {
|
|
16
693
|
const platform = os.detect();
|
|
17
694
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
695
|
+
// Map platform types to their installer functions
|
|
696
|
+
// This mapping handles aliases and variations
|
|
697
|
+
const installers = {
|
|
698
|
+
'macos': install_macos,
|
|
699
|
+
'ubuntu': install_ubuntu,
|
|
700
|
+
'debian': install_ubuntu,
|
|
701
|
+
'wsl': install_ubuntu_wsl,
|
|
702
|
+
'raspbian': install_raspbian,
|
|
703
|
+
'amazon_linux': install_amazon_linux,
|
|
704
|
+
'rhel': install_amazon_linux,
|
|
705
|
+
'fedora': install_amazon_linux,
|
|
706
|
+
'windows': install_windows,
|
|
707
|
+
'gitbash': install_gitbash
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
const installer = installers[platform.type];
|
|
711
|
+
|
|
712
|
+
if (!installer) {
|
|
713
|
+
console.log(`Slack is not available for ${platform.type}.`);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
await installer();
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// Export all functions for use as a module and for testing
|
|
721
|
+
module.exports = {
|
|
722
|
+
REQUIRES_DESKTOP,
|
|
723
|
+
install,
|
|
724
|
+
isInstalled,
|
|
725
|
+
isEligible,
|
|
726
|
+
install_macos,
|
|
727
|
+
install_ubuntu,
|
|
728
|
+
install_ubuntu_wsl,
|
|
729
|
+
install_raspbian,
|
|
730
|
+
install_amazon_linux,
|
|
731
|
+
install_windows,
|
|
732
|
+
install_gitbash
|
|
733
|
+
};
|
|
41
734
|
|
|
735
|
+
// Allow direct execution: node slack.js
|
|
42
736
|
if (require.main === module) {
|
|
43
|
-
install()
|
|
737
|
+
install().catch(err => {
|
|
738
|
+
console.error(err.message);
|
|
739
|
+
process.exit(1);
|
|
740
|
+
});
|
|
44
741
|
}
|