@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/chromium.js
CHANGED
|
@@ -1,44 +1,663 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileoverview Install Chromium.
|
|
4
|
+
* @fileoverview Install Chromium - the open-source web browser.
|
|
5
|
+
*
|
|
6
|
+
* Chromium is the free and open-source browser project that forms the
|
|
7
|
+
* foundation for Google Chrome and many other browsers. This installer
|
|
8
|
+
* provides idempotent installation across macOS, Ubuntu/Debian, Raspberry Pi OS,
|
|
9
|
+
* Amazon Linux, Windows, WSL, and Git Bash.
|
|
10
|
+
*
|
|
5
11
|
* @module installs/chromium
|
|
6
12
|
*/
|
|
7
13
|
|
|
8
14
|
const os = require('../utils/common/os');
|
|
15
|
+
const shell = require('../utils/common/shell');
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Whether this installer requires a desktop environment to function.
|
|
21
|
+
* Chromium is a GUI web browser.
|
|
22
|
+
*/
|
|
23
|
+
const REQUIRES_DESKTOP = true;
|
|
24
|
+
|
|
25
|
+
// Platform-specific utilities are loaded dynamically to avoid loading
|
|
26
|
+
// unnecessary modules on platforms where they are not needed
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Checks if Chromium is already installed on macOS by looking for the
|
|
30
|
+
* application bundle in /Applications or ~/Applications.
|
|
31
|
+
*
|
|
32
|
+
* @returns {boolean} True if Chromium.app exists, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
function isChromiumInstalledOnMacOS() {
|
|
35
|
+
const appPaths = [
|
|
36
|
+
'/Applications/Chromium.app',
|
|
37
|
+
path.join(os.getHomeDir(), 'Applications', 'Chromium.app')
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
for (const appPath of appPaths) {
|
|
41
|
+
if (fs.existsSync(appPath)) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Install Chromium on macOS using Homebrew.
|
|
51
|
+
*
|
|
52
|
+
* Chromium is installed as a cask (GUI application) via Homebrew.
|
|
53
|
+
* The --no-quarantine flag is used to prevent macOS Gatekeeper from
|
|
54
|
+
* blocking the unsigned application.
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<void>}
|
|
57
|
+
*/
|
|
58
|
+
async function install_macos() {
|
|
59
|
+
const brew = require('../utils/macos/brew');
|
|
60
|
+
|
|
61
|
+
// Step 1: Check if Chromium is already installed
|
|
62
|
+
// We check for the .app bundle directly since that's more reliable
|
|
63
|
+
// than checking the cask status for GUI applications
|
|
64
|
+
if (isChromiumInstalledOnMacOS()) {
|
|
65
|
+
console.log('Chromium is already installed, skipping...');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Step 2: Verify Homebrew is available
|
|
70
|
+
if (!brew.isInstalled()) {
|
|
71
|
+
console.log('Homebrew is required to install Chromium on macOS.');
|
|
72
|
+
console.log('Please install Homebrew first: https://brew.sh');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Step 3: Install Chromium via Homebrew cask with --no-quarantine
|
|
77
|
+
// The --no-quarantine flag prevents Gatekeeper from blocking the app
|
|
78
|
+
// since Chromium is not signed by an Apple Developer certificate
|
|
79
|
+
console.log('Installing Chromium via Homebrew...');
|
|
80
|
+
const result = await shell.exec('brew install --cask --quiet chromium --no-quarantine');
|
|
81
|
+
|
|
82
|
+
if (result.code !== 0) {
|
|
83
|
+
console.log('Failed to install Chromium.');
|
|
84
|
+
console.log(result.stderr || result.stdout);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Step 4: Verify installation succeeded
|
|
89
|
+
if (!isChromiumInstalledOnMacOS()) {
|
|
90
|
+
console.log('Installation completed but Chromium.app was not found.');
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.log('Chromium installed successfully.');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Install Chromium on Ubuntu/Debian using Snap.
|
|
99
|
+
*
|
|
100
|
+
* Since Ubuntu 20.04, the APT chromium-browser package is a transitional
|
|
101
|
+
* package that installs the Snap version. We use Snap directly for
|
|
102
|
+
* consistent behavior across Ubuntu and Debian systems.
|
|
103
|
+
*
|
|
104
|
+
* @returns {Promise<void>}
|
|
105
|
+
*/
|
|
106
|
+
async function install_ubuntu() {
|
|
107
|
+
const snap = require('../utils/ubuntu/snap');
|
|
108
|
+
|
|
109
|
+
// Step 1: Check if Chromium is already installed via Snap
|
|
110
|
+
const isInstalled = await snap.isSnapInstalled('chromium');
|
|
111
|
+
if (isInstalled) {
|
|
112
|
+
console.log('Chromium is already installed, skipping...');
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Step 2: Verify Snap is available
|
|
117
|
+
if (!snap.isInstalled()) {
|
|
118
|
+
console.log('Snap is required to install Chromium on Ubuntu/Debian.');
|
|
119
|
+
console.log('Installing snapd...');
|
|
120
|
+
|
|
121
|
+
// Attempt to install snapd via apt
|
|
122
|
+
const aptResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y snapd');
|
|
123
|
+
|
|
124
|
+
if (aptResult.code !== 0 || !snap.isInstalled()) {
|
|
125
|
+
console.log('Failed to install snapd. Please install it manually.');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Step 3: Install Chromium via Snap
|
|
131
|
+
console.log('Installing Chromium via Snap...');
|
|
132
|
+
const result = await snap.install('chromium');
|
|
133
|
+
|
|
134
|
+
if (!result.success) {
|
|
135
|
+
console.log('Failed to install Chromium.');
|
|
136
|
+
console.log(result.output);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Step 4: Verify installation succeeded
|
|
141
|
+
const verifyInstalled = await snap.isSnapInstalled('chromium');
|
|
142
|
+
if (!verifyInstalled) {
|
|
143
|
+
console.log('Installation completed but Chromium was not found.');
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
console.log('Chromium installed successfully.');
|
|
148
|
+
console.log('Note: You may need to log out and log back in for Chromium to appear in your application menu.');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Install Chromium on Ubuntu running in WSL (Windows Subsystem for Linux).
|
|
153
|
+
*
|
|
154
|
+
* Running GUI applications in WSL requires WSLg (Windows 11 or Windows 10 21H2+)
|
|
155
|
+
* or an X server on Windows. This function installs Chromium using Snap,
|
|
156
|
+
* similar to native Ubuntu installation.
|
|
157
|
+
*
|
|
158
|
+
* @returns {Promise<void>}
|
|
159
|
+
*/
|
|
160
|
+
async function install_ubuntu_wsl() {
|
|
161
|
+
const snap = require('../utils/ubuntu/snap');
|
|
162
|
+
const apt = require('../utils/ubuntu/apt');
|
|
163
|
+
|
|
164
|
+
// Step 1: Check if Chromium is already installed
|
|
165
|
+
// In WSL, we check both snap and apt since the user might have installed via either
|
|
166
|
+
const snapInstalled = await snap.isSnapInstalled('chromium');
|
|
167
|
+
if (snapInstalled) {
|
|
168
|
+
console.log('Chromium is already installed via Snap, skipping...');
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Also check if installed via APT (chromium-browser package)
|
|
173
|
+
const aptInstalled = await apt.isPackageInstalled('chromium-browser');
|
|
174
|
+
if (aptInstalled) {
|
|
175
|
+
console.log('Chromium is already installed via APT, skipping...');
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Step 2: Try Snap first (preferred method)
|
|
180
|
+
if (snap.isInstalled()) {
|
|
181
|
+
console.log('Installing Chromium via Snap...');
|
|
182
|
+
const result = await snap.install('chromium');
|
|
183
|
+
|
|
184
|
+
if (result.success) {
|
|
185
|
+
const verifyInstalled = await snap.isSnapInstalled('chromium');
|
|
186
|
+
if (verifyInstalled) {
|
|
187
|
+
console.log('Chromium installed successfully.');
|
|
188
|
+
console.log('Note: WSLg (Windows 11 or Windows 10 21H2+) or an X server is required to run GUI applications.');
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// If Snap installation fails (common in WSL due to systemd issues),
|
|
194
|
+
// fall back to APT
|
|
195
|
+
console.log('Snap installation failed, trying APT...');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Step 3: Fall back to APT if Snap is not available or fails
|
|
199
|
+
console.log('Installing Chromium via APT...');
|
|
200
|
+
|
|
201
|
+
// Update package lists first
|
|
202
|
+
const updateResult = await apt.update();
|
|
203
|
+
if (!updateResult.success) {
|
|
204
|
+
console.log('Warning: apt-get update failed, continuing anyway...');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Install chromium-browser package
|
|
208
|
+
const result = await apt.install('chromium-browser');
|
|
209
|
+
|
|
210
|
+
if (!result.success) {
|
|
211
|
+
console.log('Failed to install Chromium.');
|
|
212
|
+
console.log(result.output);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Step 4: Verify installation
|
|
217
|
+
const verifyInstalled = await apt.isPackageInstalled('chromium-browser');
|
|
218
|
+
if (!verifyInstalled) {
|
|
219
|
+
console.log('Installation completed but Chromium was not found.');
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
console.log('Chromium installed successfully.');
|
|
224
|
+
console.log('Note: WSLg (Windows 11 or Windows 10 21H2+) or an X server is required to run GUI applications.');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Install Chromium on Raspberry Pi OS using APT.
|
|
229
|
+
*
|
|
230
|
+
* Raspberry Pi OS includes Chromium in its official repositories with
|
|
231
|
+
* ARM-specific optimizations. APT is the preferred installation method
|
|
232
|
+
* for best performance on Raspberry Pi hardware.
|
|
233
|
+
*
|
|
234
|
+
* @returns {Promise<void>}
|
|
235
|
+
*/
|
|
236
|
+
async function install_raspbian() {
|
|
237
|
+
const apt = require('../utils/ubuntu/apt');
|
|
238
|
+
|
|
239
|
+
// Step 1: Check if Chromium is already installed
|
|
240
|
+
// Raspberry Pi OS uses 'chromium-browser' as the package name
|
|
241
|
+
const isInstalled = await apt.isPackageInstalled('chromium-browser');
|
|
242
|
+
if (isInstalled) {
|
|
243
|
+
console.log('Chromium is already installed, skipping...');
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Step 2: Update package lists to ensure we get the latest version
|
|
248
|
+
console.log('Updating package lists...');
|
|
249
|
+
const updateResult = await apt.update();
|
|
250
|
+
if (!updateResult.success) {
|
|
251
|
+
console.log('Warning: apt-get update failed, continuing anyway...');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Step 3: Install chromium-browser package
|
|
255
|
+
console.log('Installing Chromium via APT...');
|
|
256
|
+
const result = await apt.install('chromium-browser');
|
|
257
|
+
|
|
258
|
+
if (!result.success) {
|
|
259
|
+
console.log('Failed to install Chromium.');
|
|
260
|
+
console.log(result.output);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Step 4: Verify installation succeeded
|
|
265
|
+
const verifyInstalled = await apt.isPackageInstalled('chromium-browser');
|
|
266
|
+
if (!verifyInstalled) {
|
|
267
|
+
console.log('Installation completed but Chromium was not found.');
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
console.log('Chromium installed successfully.');
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Install Chromium on Amazon Linux using DNF/YUM.
|
|
276
|
+
*
|
|
277
|
+
* Chromium is not available in the default Amazon Linux repositories.
|
|
278
|
+
* On Amazon Linux 2023, we install Google Chrome (based on Chromium)
|
|
279
|
+
* using the direct RPM download. On Amazon Linux 2, we use EPEL.
|
|
280
|
+
*
|
|
281
|
+
* Note: This installs Google Chrome Stable as a Chromium alternative
|
|
282
|
+
* since pure Chromium packages are not readily available for Amazon Linux.
|
|
283
|
+
*
|
|
284
|
+
* @returns {Promise<void>}
|
|
285
|
+
*/
|
|
286
|
+
async function install_amazon_linux() {
|
|
287
|
+
// Step 1: Check if Chrome/Chromium is already installed
|
|
288
|
+
// Check for google-chrome-stable first (AL2023 method)
|
|
289
|
+
const chromeExists = shell.commandExists('google-chrome-stable');
|
|
290
|
+
if (chromeExists) {
|
|
291
|
+
console.log('Google Chrome (Chromium-based) is already installed, skipping...');
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Also check for chromium-browser (AL2 EPEL method)
|
|
296
|
+
const chromiumExists = shell.commandExists('chromium-browser');
|
|
297
|
+
if (chromiumExists) {
|
|
298
|
+
console.log('Chromium is already installed, skipping...');
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Step 2: Determine which Amazon Linux version we're on
|
|
303
|
+
// Amazon Linux 2023 uses dnf, Amazon Linux 2 uses yum
|
|
304
|
+
const hasDnf = shell.commandExists('dnf');
|
|
305
|
+
|
|
306
|
+
if (hasDnf) {
|
|
307
|
+
// Amazon Linux 2023: Install Google Chrome via direct RPM
|
|
308
|
+
console.log('Installing Google Chrome (Chromium-based) via DNF...');
|
|
309
|
+
|
|
310
|
+
// First, install required dependencies
|
|
311
|
+
const depsResult = await shell.exec('sudo dnf install -y libXcomposite libXdamage libXrandr libgbm libxkbcommon pango alsa-lib atk at-spi2-atk cups-libs libdrm');
|
|
312
|
+
if (depsResult.code !== 0) {
|
|
313
|
+
console.log('Warning: Some dependencies may not have installed correctly.');
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Install Chrome from Google's RPM repository
|
|
317
|
+
const result = await shell.exec('sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm');
|
|
318
|
+
|
|
319
|
+
if (result.code !== 0) {
|
|
320
|
+
console.log('Failed to install Google Chrome.');
|
|
321
|
+
console.log(result.stderr || result.stdout);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Verify installation
|
|
326
|
+
const verifyInstalled = shell.commandExists('google-chrome-stable');
|
|
327
|
+
if (!verifyInstalled) {
|
|
328
|
+
console.log('Installation completed but Google Chrome was not found.');
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
console.log('Google Chrome (Chromium-based) installed successfully.');
|
|
333
|
+
console.log('Run with: google-chrome-stable');
|
|
334
|
+
|
|
335
|
+
} else {
|
|
336
|
+
// Amazon Linux 2: Install via EPEL repository
|
|
337
|
+
console.log('Installing Chromium via YUM (EPEL)...');
|
|
338
|
+
|
|
339
|
+
// Enable EPEL repository
|
|
340
|
+
const epelResult = await shell.exec('sudo amazon-linux-extras install -y epel');
|
|
341
|
+
if (epelResult.code !== 0) {
|
|
342
|
+
console.log('Failed to enable EPEL repository.');
|
|
343
|
+
console.log(epelResult.stderr || epelResult.stdout);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Install Chromium
|
|
348
|
+
const result = await shell.exec('sudo yum install -y chromium');
|
|
349
|
+
|
|
350
|
+
if (result.code !== 0) {
|
|
351
|
+
console.log('Failed to install Chromium.');
|
|
352
|
+
console.log(result.stderr || result.stdout);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Verify installation
|
|
357
|
+
const verifyInstalled = shell.commandExists('chromium-browser');
|
|
358
|
+
if (!verifyInstalled) {
|
|
359
|
+
console.log('Installation completed but Chromium was not found.');
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
console.log('Chromium installed successfully.');
|
|
364
|
+
console.log('Note: Amazon Linux 2 reached end of standard support on June 30, 2025.');
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Install Chromium on Windows using Chocolatey.
|
|
370
|
+
*
|
|
371
|
+
* The Chocolatey 'chromium' package installs development snapshot builds.
|
|
372
|
+
* For a more stable Chromium-based browser, consider using 'ungoogled-chromium'.
|
|
373
|
+
*
|
|
374
|
+
* @returns {Promise<void>}
|
|
375
|
+
*/
|
|
376
|
+
async function install_windows() {
|
|
377
|
+
const choco = require('../utils/windows/choco');
|
|
378
|
+
|
|
379
|
+
// Step 1: Check if Chromium is already installed via Chocolatey
|
|
380
|
+
const isInstalled = await choco.isPackageInstalled('chromium');
|
|
381
|
+
if (isInstalled) {
|
|
382
|
+
console.log('Chromium is already installed, skipping...');
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Also check if the chromium command exists (might be installed via other means)
|
|
387
|
+
if (shell.commandExists('chromium')) {
|
|
388
|
+
console.log('Chromium is already installed, skipping...');
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Step 2: Verify Chocolatey is available
|
|
393
|
+
if (!choco.isInstalled()) {
|
|
394
|
+
console.log('Chocolatey is required to install Chromium on Windows.');
|
|
395
|
+
console.log('Please install Chocolatey first: https://chocolatey.org/install');
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Step 3: Install Chromium via Chocolatey
|
|
400
|
+
console.log('Installing Chromium via Chocolatey...');
|
|
401
|
+
const result = await choco.install('chromium');
|
|
402
|
+
|
|
403
|
+
if (!result.success) {
|
|
404
|
+
console.log('Failed to install Chromium.');
|
|
405
|
+
console.log(result.output);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Step 4: Verify installation succeeded
|
|
410
|
+
const verifyInstalled = await choco.isPackageInstalled('chromium');
|
|
411
|
+
if (!verifyInstalled) {
|
|
412
|
+
console.log('Installation completed but Chromium was not found.');
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
console.log('Chromium installed successfully.');
|
|
417
|
+
console.log('Note: You may need to open a new terminal window for the chromium command to be available.');
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Install Chromium on Git Bash (Windows) using Chocolatey.
|
|
422
|
+
*
|
|
423
|
+
* Git Bash runs in a Windows environment, so we use the same Chocolatey
|
|
424
|
+
* installation method as native Windows. The portable installation method
|
|
425
|
+
* is available as an alternative for environments without package managers.
|
|
426
|
+
*
|
|
427
|
+
* @returns {Promise<void>}
|
|
428
|
+
*/
|
|
429
|
+
async function install_gitbash() {
|
|
430
|
+
// Git Bash runs on Windows, so we can use Chocolatey if available
|
|
431
|
+
const chocoPath = '/c/ProgramData/chocolatey/bin/choco.exe';
|
|
432
|
+
|
|
433
|
+
// Step 1: Check if Chromium is already accessible
|
|
434
|
+
if (shell.commandExists('chromium')) {
|
|
435
|
+
console.log('Chromium is already installed, skipping...');
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Check for Chromium in common portable installation location
|
|
440
|
+
const portablePath = path.join(os.getHomeDir(), 'Applications', 'Chromium', 'chromium.exe');
|
|
441
|
+
if (fs.existsSync(portablePath)) {
|
|
442
|
+
console.log('Chromium is already installed (portable), skipping...');
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Step 2: Try Chocolatey installation first
|
|
447
|
+
const chocoExists = fs.existsSync(chocoPath) || shell.commandExists('choco');
|
|
448
|
+
|
|
449
|
+
if (chocoExists) {
|
|
450
|
+
console.log('Installing Chromium via Chocolatey...');
|
|
451
|
+
const result = await shell.exec('choco install chromium -y');
|
|
452
|
+
|
|
453
|
+
if (result.code === 0) {
|
|
454
|
+
console.log('Chromium installed successfully.');
|
|
455
|
+
console.log('Note: You may need to open a new terminal window for the chromium command to be available.');
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
console.log('Chocolatey installation failed, attempting portable installation...');
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Step 3: Fall back to portable installation using chrlauncher
|
|
463
|
+
console.log('Installing Chromium (portable) via chrlauncher...');
|
|
464
|
+
|
|
465
|
+
// Create installation directory
|
|
466
|
+
const installDir = path.join(os.getHomeDir(), 'Applications', 'Chromium');
|
|
467
|
+
if (!fs.existsSync(installDir)) {
|
|
468
|
+
fs.mkdirSync(installDir, { recursive: true });
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Download chrlauncher
|
|
472
|
+
const zipPath = path.join(installDir, 'chrlauncher.zip');
|
|
473
|
+
const downloadUrl = 'https://github.com/niclaslson/niclaslson.github.io/raw/refs/heads/main/files/chrlauncher_v3.4.7_64.zip';
|
|
474
|
+
|
|
475
|
+
const downloadResult = await shell.exec(`curl -L -o "${zipPath}" "${downloadUrl}"`);
|
|
476
|
+
if (downloadResult.code !== 0) {
|
|
477
|
+
console.log('Failed to download chrlauncher.');
|
|
478
|
+
console.log(downloadResult.stderr || downloadResult.stdout);
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// Extract the launcher
|
|
483
|
+
const unzipResult = await shell.exec(`unzip -o -q "${zipPath}" -d "${installDir}"`);
|
|
484
|
+
if (unzipResult.code !== 0) {
|
|
485
|
+
console.log('Failed to extract chrlauncher.');
|
|
486
|
+
console.log(unzipResult.stderr || unzipResult.stdout);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Clean up zip file
|
|
491
|
+
try {
|
|
492
|
+
fs.unlinkSync(zipPath);
|
|
493
|
+
} catch (err) {
|
|
494
|
+
// Ignore cleanup errors
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
console.log('Chromium portable installation prepared successfully.');
|
|
498
|
+
console.log(`Run the launcher to download Chromium: ${path.join(installDir, 'chrlauncher.exe')}`);
|
|
499
|
+
console.log('Add the following to your ~/.bashrc to include Chromium in PATH:');
|
|
500
|
+
console.log(` export PATH="$HOME/Applications/Chromium:$PATH"`);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Check if Chromium is installed on the current platform.
|
|
505
|
+
*
|
|
506
|
+
* This function performs platform-specific checks to determine if Chromium
|
|
507
|
+
* is already installed:
|
|
508
|
+
* - macOS: Checks for Chromium.app in /Applications
|
|
509
|
+
* - Windows: Checks for Chocolatey package or chromium command
|
|
510
|
+
* - Ubuntu/Debian/WSL: Checks for Snap package
|
|
511
|
+
* - Raspberry Pi: Checks for APT package
|
|
512
|
+
* - Amazon Linux: Checks for google-chrome-stable or chromium-browser command
|
|
513
|
+
*
|
|
514
|
+
* @returns {Promise<boolean>} True if Chromium is installed
|
|
515
|
+
*/
|
|
516
|
+
async function isInstalled() {
|
|
517
|
+
const platform = os.detect();
|
|
518
|
+
|
|
519
|
+
// macOS: Check for Chromium.app
|
|
520
|
+
if (platform.type === 'macos') {
|
|
521
|
+
return isChromiumInstalledOnMacOS();
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Windows: Check for Chocolatey package or command
|
|
525
|
+
if (platform.type === 'windows') {
|
|
526
|
+
const choco = require('../utils/windows/choco');
|
|
527
|
+
const isPackageInstalled = await choco.isPackageInstalled('chromium');
|
|
528
|
+
if (isPackageInstalled) {
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
return shell.commandExists('chromium');
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// Git Bash: Check for command or portable installation
|
|
535
|
+
if (platform.type === 'gitbash') {
|
|
536
|
+
if (shell.commandExists('chromium')) {
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
// Check portable installation location
|
|
540
|
+
const portablePath = path.join(os.getHomeDir(), 'Applications', 'Chromium', 'chromium.exe');
|
|
541
|
+
return fs.existsSync(portablePath);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Ubuntu/Debian: Check for Snap package
|
|
545
|
+
if (['ubuntu', 'debian'].includes(platform.type)) {
|
|
546
|
+
const snap = require('../utils/ubuntu/snap');
|
|
547
|
+
return await snap.isSnapInstalled('chromium');
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// WSL: Check for Snap or APT package
|
|
551
|
+
if (platform.type === 'wsl') {
|
|
552
|
+
const snap = require('../utils/ubuntu/snap');
|
|
553
|
+
const apt = require('../utils/ubuntu/apt');
|
|
554
|
+
const snapInstalled = await snap.isSnapInstalled('chromium');
|
|
555
|
+
if (snapInstalled) return true;
|
|
556
|
+
return await apt.isPackageInstalled('chromium-browser');
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// Raspberry Pi: Check for APT package
|
|
560
|
+
if (platform.type === 'raspbian') {
|
|
561
|
+
const apt = require('../utils/ubuntu/apt');
|
|
562
|
+
return await apt.isPackageInstalled('chromium-browser');
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Amazon Linux/RHEL/Fedora: Check for Chrome or Chromium command
|
|
566
|
+
if (['amazon_linux', 'rhel', 'fedora'].includes(platform.type)) {
|
|
567
|
+
return shell.commandExists('google-chrome-stable') || shell.commandExists('chromium-browser');
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
9
572
|
|
|
10
573
|
/**
|
|
11
|
-
*
|
|
574
|
+
* Check if this installer is supported on the current platform.
|
|
575
|
+
*
|
|
576
|
+
* Chromium can be installed on all supported platforms:
|
|
577
|
+
* - macOS (via Homebrew cask)
|
|
578
|
+
* - Ubuntu/Debian (via Snap)
|
|
579
|
+
* - Ubuntu on WSL (via Snap or APT)
|
|
580
|
+
* - Raspberry Pi OS (via APT)
|
|
581
|
+
* - Amazon Linux/RHEL/Fedora (via DNF/YUM or Chrome RPM)
|
|
582
|
+
* - Windows (via Chocolatey)
|
|
583
|
+
* - Git Bash (via Chocolatey or portable)
|
|
584
|
+
*
|
|
585
|
+
* @returns {boolean} True if installation is supported on this platform
|
|
586
|
+
*/
|
|
587
|
+
function isEligible() {
|
|
588
|
+
const platform = os.detect();
|
|
589
|
+
const supportedPlatforms = ['macos', 'ubuntu', 'debian', 'wsl', 'raspbian', 'amazon_linux', 'rhel', 'fedora', 'windows', 'gitbash'];
|
|
590
|
+
if (!supportedPlatforms.includes(platform.type)) {
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
if (REQUIRES_DESKTOP && !os.isDesktopAvailable()) {
|
|
594
|
+
return false;
|
|
595
|
+
}
|
|
596
|
+
return true;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Main installation entry point - detects the current platform and
|
|
601
|
+
* runs the appropriate installer function.
|
|
602
|
+
*
|
|
603
|
+
* Supported platforms:
|
|
604
|
+
* - macOS: Homebrew cask
|
|
605
|
+
* - Ubuntu/Debian: Snap
|
|
606
|
+
* - Ubuntu on WSL: Snap or APT
|
|
607
|
+
* - Raspberry Pi OS: APT
|
|
608
|
+
* - Amazon Linux/RHEL: DNF (Chrome) or YUM (EPEL)
|
|
609
|
+
* - Windows: Chocolatey
|
|
610
|
+
* - Git Bash: Chocolatey or portable
|
|
12
611
|
*
|
|
13
612
|
* @returns {Promise<void>}
|
|
14
613
|
*/
|
|
15
614
|
async function install() {
|
|
16
615
|
const platform = os.detect();
|
|
17
616
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
617
|
+
// Map platform types to their installer functions
|
|
618
|
+
const installers = {
|
|
619
|
+
'macos': install_macos,
|
|
620
|
+
'ubuntu': install_ubuntu,
|
|
621
|
+
'debian': install_ubuntu,
|
|
622
|
+
'wsl': install_ubuntu_wsl,
|
|
623
|
+
'raspbian': install_raspbian,
|
|
624
|
+
'amazon_linux': install_amazon_linux,
|
|
625
|
+
'rhel': install_amazon_linux,
|
|
626
|
+
'fedora': install_amazon_linux,
|
|
627
|
+
'windows': install_windows,
|
|
628
|
+
'gitbash': install_gitbash,
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
const installer = installers[platform.type];
|
|
632
|
+
|
|
633
|
+
if (!installer) {
|
|
634
|
+
// Gracefully handle unsupported platforms without throwing errors
|
|
635
|
+
console.log(`Chromium is not available for ${platform.type}.`);
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
await installer();
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// Export all functions for testing and programmatic use
|
|
643
|
+
module.exports = {
|
|
644
|
+
REQUIRES_DESKTOP,
|
|
645
|
+
install,
|
|
646
|
+
isInstalled,
|
|
647
|
+
isEligible,
|
|
648
|
+
install_macos,
|
|
649
|
+
install_ubuntu,
|
|
650
|
+
install_ubuntu_wsl,
|
|
651
|
+
install_raspbian,
|
|
652
|
+
install_amazon_linux,
|
|
653
|
+
install_windows,
|
|
654
|
+
install_gitbash,
|
|
655
|
+
};
|
|
41
656
|
|
|
657
|
+
// Allow running directly from command line: node chromium.js
|
|
42
658
|
if (require.main === module) {
|
|
43
|
-
install()
|
|
659
|
+
install().catch(err => {
|
|
660
|
+
console.error(err.message);
|
|
661
|
+
process.exit(1);
|
|
662
|
+
});
|
|
44
663
|
}
|