This commit is contained in:
Brian Zalewski 2024-01-16 05:04:34 +00:00
parent 7bf6928568
commit ac42b6e136
2 changed files with 35 additions and 64 deletions

View file

@ -32,9 +32,9 @@ async function runSilentCommand(command) {
async function runScript(key, script) { async function runScript(key, script) {
fs.writeFileSync(`${cacheDir}/${key}`, script) fs.writeFileSync(`${cacheDir}/${key}`, script)
const file = await $`cat ${cacheDir}/${key} | grep "^# @file" | sed 's/^# @file //'` const file = await $`cat ${cacheDir}/${key} | ( grep "^# @file" || [ "$?" == "1" ] ) | sed 's/^# @file //'`
const brief = await $`cat ${cacheDir}/${key} | grep "^# @brief" | sed 's/^# @brief //'` const brief = await $`cat ${cacheDir}/${key} | ( grep "^# @brief" || [ "$?" == "1" ] ) | sed 's/^# @brief //'`
fs.writeFileSync(`${cacheDir}/${key}-glow`, "# " + file.stdout + "\n> " + brief.stdout + "\n```sh\n" + script + "\n```") fs.writeFileSync(`${cacheDir}/${key}-glow`, '```sh\n' + (file.stdout ? (!file.stdout && !brief.stdout ? '```sh' + '') + `# ${file.stdout}\n` : '') + (brief.stdout ? `> ${brief.stdout}\n` : '') + (file.stdout || brief.stdout ? '```sh\n' : '') + script + "\n```")
runSilentCommand(`glow "${cacheDir}/${key}-glow" && bash "${cacheDir}/${key}"`) runSilentCommand(`glow "${cacheDir}/${key}-glow" && bash "${cacheDir}/${key}"`)
} }
@ -201,7 +201,9 @@ async function installPackages(pkgInstructions) {
promises.push(bundleInstall(combined.brew ? combined.brew.flatMap(x => x.installList.flatMap(i => i)) : [], combined.cask ? combined.cask.flatMap(x => x.installList.flatMap(i => i)) : [])) promises.push(bundleInstall(combined.brew ? combined.brew.flatMap(x => x.installList.flatMap(i => i)) : [], combined.cask ? combined.cask.flatMap(x => x.installList.flatMap(i => i)) : []))
} }
for (const key of Object.keys(combined)) { for (const key of Object.keys(combined)) {
log(`Install orders for ${key}: ${combined[key].flatMap(i => i.installList).join(' ')}`) if (key !== 'script') {
log(`Install orders for ${key}: ${combined[key].flatMap(i => i.installList).join(' ')}`)
}
switch (key) { switch (key) {
case 'ansible': case 'ansible':
promises.push(forEachSeries(combined[key].flatMap(x => x.installList.flatMap(i => $`${key} 127.0.0.1 -v${process.env.DEBUG && 'vv'} -e '{ ansible_connection: "local", ansible_become_user: "root", ansible_user: "${process.env.USER}", ansible_family: "${osId.charAt(0).toUpperCase() + osId.slice(1)}", install_homebrew: False }' -m include_role -a name=${i}`)))) promises.push(forEachSeries(combined[key].flatMap(x => x.installList.flatMap(i => $`${key} 127.0.0.1 -v${process.env.DEBUG && 'vv'} -e '{ ansible_connection: "local", ansible_become_user: "root", ansible_user: "${process.env.USER}", ansible_family: "${osId.charAt(0).toUpperCase() + osId.slice(1)}", install_homebrew: False }' -m include_role -a name=${i}`))))
@ -274,10 +276,7 @@ async function installPackages(pkgInstructions) {
case 'sbopkg': // TODO case 'sbopkg': // TODO
break break
case 'script': case 'script':
promises.push(...combined[key].flatMap(x => x.installList.join(i => $`${i}`))) promises.push(...combined[key].flatMap(x => x.installList.flatMap(i => runScript(i))))
break
case 'snap-classic':
promises.push($`sudo snap install --classic ${combined[key].flatMap(x => x.installList).join(' ')}`)
break break
case 'whalebrew': // TODO case 'whalebrew': // TODO
break break
@ -419,12 +418,12 @@ async function main() {
log(`Running installation routine`) log(`Running installation routine`)
await installPackages(installInstructions) await installPackages(installInstructions)
log(`Running post-install scripts`) log(`Running post-install scripts`)
/*const postScripts = installData const postScripts = installData
.flatMap(x => { .flatMap(x => {
const postField = getPkgData('_post', x, x.installType) const postField = getPkgData('_post', x, x.installType)
return (postField && runScript(x.listKey, x[postField])) || Promise.resolve() return (postField && runScript(x.listKey, x[postField])) || Promise.resolve()
}) })
await Promise.all(postScripts)*/ await Promise.all(postScripts)
} }
main() main()

View file

@ -1967,7 +1967,6 @@ softwarePackages:
_github: https://github.com/certbot/certbot _github: https://github.com/certbot/certbot
_home: https://certbot.eff.org/ _home: https://certbot.eff.org/
_name: CertBot _name: CertBot
_snapClassic: true
_post: | _post: |
#!/usr/bin/env bash #!/usr/bin/env bash
pipx inject certbot certbot-dns-cloudflare pipx inject certbot certbot-dns-cloudflare
@ -2028,14 +2027,13 @@ softwarePackages:
_github: https://github.com/twpayne/chezmoi _github: https://github.com/twpayne/chezmoi
_home: https://www.chezmoi.io/ _home: https://www.chezmoi.io/
_name: Chezmoi _name: Chezmoi
_snapClassic: true
apk: chezmoi apk: chezmoi
brew: chezmoi brew: chezmoi
choco: chezmoi choco: chezmoi
nix: chezmoi nix: chezmoi
pacman: chezmoi pacman: chezmoi
pkg: chezmoi pkg: chezmoi
snap: chezmoi snap: chezmoi --classic
xbps: chezmoi xbps: chezmoi
zypper: chezmoi zypper: chezmoi
google-chrome: google-chrome:
@ -2511,10 +2509,9 @@ softwarePackages:
_github: https://github.com/Kitware/CMake _github: https://github.com/Kitware/CMake
_home: https://cmake.org/ _home: https://cmake.org/
_name: Chezmoi _name: Chezmoi
_snapClassic: true
brew: cmake brew: cmake
choco: cmake choco: cmake
snap: cmake snap: cmake --classic
cmctl: cmctl:
_bin: cmctl _bin: cmctl
_desc: A CLI tool that can help you to manage cert-manager resources inside your cluster _desc: A CLI tool that can help you to manage cert-manager resources inside your cluster
@ -3184,7 +3181,6 @@ softwarePackages:
_bin: espanso _bin: espanso
_github: https://github.com/espanso/espanso _github: https://github.com/espanso/espanso
_name: Espanso _name: Espanso
_snapClassic: true
_app: Espanso.app _app: Espanso.app
_post:snap: | _post:snap: |
#!/usr/bin/env bash #!/usr/bin/env bash
@ -3195,7 +3191,7 @@ softwarePackages:
appimage: federico-terzi/espanso appimage: federico-terzi/espanso
cask: espanso cask: espanso
choco: espanso choco: espanso
snap: espanso --channel=latest/edge snap: espanso --channel=latest/edge --classic
bun: bun:
_bin: bun _bin: bun
_github: https://github.com/oven-sh/bun _github: https://github.com/oven-sh/bun
@ -3404,7 +3400,9 @@ softwarePackages:
yay: dotnet-sdk-bin yay: dotnet-sdk-bin
sdkman-cli: sdkman-cli:
_bin: sdk _bin: sdk
_post: | _github: https://github.com/sdkman/sdkman-cli
_name: SDKMan
script: |
#!/usr/bin/env bash #!/usr/bin/env bash
# @file SDKMAN Install # @file SDKMAN Install
# @brief Ensures SDKMAN is installed. # @brief Ensures SDKMAN is installed.
@ -3448,9 +3446,6 @@ softwarePackages:
logg warn 'Unable to run sdk update because the sdk command is unavailable' logg warn 'Unable to run sdk update because the sdk command is unavailable'
fi fi
fi fi
script: |
#!/usr/bin/env bash
echo "Downloaded by Chezmoi (see .chezmoiexternal.toml.tmpl)"
dprint: dprint:
_bin: dprint _bin: dprint
_desc: '[dprint](https://dprint.dev/) is a pluggable and configurable code formatting platform written in Rust.' _desc: '[dprint](https://dprint.dev/) is a pluggable and configurable code formatting platform written in Rust.'
@ -4566,10 +4561,9 @@ softwarePackages:
_github: https://github.com/flutter/flutter _github: https://github.com/flutter/flutter
_home: https://flutter.dev/ _home: https://flutter.dev/
_name: Flutter _name: Flutter
_snapClassic: true
cask: flutter cask: flutter
choco: flutter choco: flutter
snap: flutter snap: flutter --classic
yay: flutter yay: flutter
pock: pock:
_bin: null _bin: null
@ -4925,11 +4919,10 @@ softwarePackages:
_github: null _github: null
_home: null _home: null
_name: Google Cloud SDK _name: Google Cloud SDK
_snapClassic: true
ansible: professormanhattan.googlecloudsdk ansible: professormanhattan.googlecloudsdk
cask: google-cloud-sdk cask: google-cloud-sdk
choco: gcloudsdk choco: gcloudsdk
snap: google-cloud-sdk snap: google-cloud-sdk --classic
yay: google-cloud-sdk yay: google-cloud-sdk
gdown: gdown:
_bin: gdown _bin: gdown
@ -5214,13 +5207,12 @@ softwarePackages:
_github: Not open-source _github: Not open-source
_home: https://www.gitkraken.com/ _home: https://www.gitkraken.com/
_name: GitKraken _name: GitKraken
_snapClassic: true
_app: GitKraken.app _app: GitKraken.app
ansible: professormanhattan.gitkraken ansible: professormanhattan.gitkraken
cask: gitkraken cask: gitkraken
choco: gitkraken choco: gitkraken
flatpak: com.axosoft.GitKraken flatpak: com.axosoft.GitKraken
snap: gitkraken snap: gitkraken --classic
gitlab-runner: gitlab-runner:
_bin: gitlab-runner _bin: gitlab-runner
_desc: '[GitLab Runner](https://docs.gitlab.com/runner/) is an application that works with GitLab CI/CD to run jobs in a pipeline.' _desc: '[GitLab Runner](https://docs.gitlab.com/runner/) is an application that works with GitLab CI/CD to run jobs in a pipeline.'
@ -5593,7 +5585,6 @@ softwarePackages:
_github: https://github.com/golang/go _github: https://github.com/golang/go
_home: https://go.dev/ _home: https://go.dev/
_name: Go _name: Go
_snapClassic: true
ansible: professormanhattan.go ansible: professormanhattan.go
apt: golang-go apt: golang-go
brew: go brew: go
@ -5601,7 +5592,7 @@ softwarePackages:
pacman: go pacman: go
port: go port: go
scoop: go scoop: go
snap: go snap: go --classic
go-chromecast: go-chromecast:
_bin: go-chromecast _bin: go-chromecast
_desc: CLI for Google Chromecast, Home devices and Cast Groups _desc: CLI for Google Chromecast, Home devices and Cast Groups
@ -5715,13 +5706,12 @@ softwarePackages:
_github: https://github.com/gradle/gradle _github: https://github.com/gradle/gradle
_home: https://gradle.org/ _home: https://gradle.org/
_name: Gradle _name: Gradle
_snapClassic: true
ansible: professormanhattan.gradle ansible: professormanhattan.gradle
brew: gradle brew: gradle
choco: gradle choco: gradle
port: gradle port: gradle
scoop: gradle scoop: gradle
snap: gradle snap: gradle --classic
grex: grex:
_bin: grex _bin: grex
_desc: A command-line tool and library for generating regular expressions from user-provided test cases _desc: A command-line tool and library for generating regular expressions from user-provided test cases
@ -6162,12 +6152,11 @@ softwarePackages:
_github: https://github.com/JetBrains/intellij-community _github: https://github.com/JetBrains/intellij-community
_home: https://www.jetbrains.com/idea/ _home: https://www.jetbrains.com/idea/
_name: IntelliJ IDEA (CE) _name: IntelliJ IDEA (CE)
_snapClassic: true
_app: IntelliJ IDEA CE.app _app: IntelliJ IDEA CE.app
ansible: professormanhattan.intellij ansible: professormanhattan.intellij
cask: intellij-idea-ce cask: intellij-idea-ce
choco: intellijidea-community choco: intellijidea-community
snap: intellij-idea-community snap: intellij-idea-community --classic
ionic: ionic:
_bin: ionic _bin: ionic
_desc: '[Ionic Framework](https://ionicframework.com/) The Ionic command line interface (CLI) is your go-to tool for developing Ionic apps' _desc: '[Ionic Framework](https://ionicframework.com/) The Ionic command line interface (CLI) is your go-to tool for developing Ionic apps'
@ -6435,11 +6424,10 @@ softwarePackages:
_github: null _github: null
_home: https://juju.is/ _home: https://juju.is/
_name: Juju _name: Juju
_snapClassic: true
ansible: professormanhattan.juju ansible: professormanhattan.juju
brew: juju brew: juju
choco: juju choco: juju
snap: juju snap: juju --classic
kdash: kdash:
_bin: kdash _bin: kdash
_desc: A simple and fast dashboard for Kubernetes _desc: A simple and fast dashboard for Kubernetes
@ -6564,14 +6552,13 @@ softwarePackages:
_github: https://github.com/ahmetb/kubectx _github: https://github.com/ahmetb/kubectx
_home: null _home: null
_name: kubectx _name: kubectx
_snapClassic: true
brew: kubectx brew: kubectx
choco: choco:
- kubens - kubens
- kubectx - kubectx
pacman: kubectx pacman: kubectx
port: kubectx port: kubectx
snap: kubectx snap: kubectx --classic
kubenav: kubenav:
_bin: null _bin: null
_desc: kubenav is the navigator for your Kubernetes clusters right in your pocket _desc: kubenav is the navigator for your Kubernetes clusters right in your pocket
@ -6590,10 +6577,9 @@ softwarePackages:
_github: https://github.com/kubernetes/kubectl _github: https://github.com/kubernetes/kubectl
_home: null _home: null
_name: kubectl _name: kubectl
_snapClassic: true
brew: kubectl brew: kubectl
choco: kubernetes-cli choco: kubernetes-cli
snap: kubectl snap: kubectl --classic
helm: helm:
_bin: helm _bin: helm
_desc: The Kubernetes Package Manager. Helm is the best way to find, share, and use software built for Kubernetes. _desc: The Kubernetes Package Manager. Helm is the best way to find, share, and use software built for Kubernetes.
@ -6601,11 +6587,10 @@ softwarePackages:
_github: https://github.com/helm/helm _github: https://github.com/helm/helm
_home: https://helm.sh/ _home: https://helm.sh/
_name: Helm _name: Helm
_snapClassic: true
brew: helm brew: helm
choco: kubernetes-helm choco: kubernetes-helm
scoop: helm scoop: helm
snap: helm snap: helm --classic
helmfile: helmfile:
_bin: helmfile _bin: helmfile
_github: https://github.com/helmfile/helmfile _github: https://github.com/helmfile/helmfile
@ -6776,12 +6761,11 @@ softwarePackages:
_github: https://github.com/lensapp/lens _github: https://github.com/lensapp/lens
_home: https://k8slens.dev/ _home: https://k8slens.dev/
_name: Lens _name: Lens
_snapClassic: true
_app: Lens.app _app: Lens.app
ansible: professormanhattan.lens ansible: professormanhattan.lens
cask: lens cask: lens
choco: lens choco: lens
snap: kontena-lens snap: kontena-lens --classic
yay: lens yay: lens
lepton: lepton:
_bin: lepton _bin: lepton
@ -8300,14 +8284,13 @@ softwarePackages:
_github: https://github.com/zaproxy/zaproxy _github: https://github.com/zaproxy/zaproxy
_home: https://www.zaproxy.org/ _home: https://www.zaproxy.org/
_name: OWASP ZAP _name: OWASP ZAP
_snapClassic: true
_app: ZAP.app _app: ZAP.app
cask: zap cask: zap
choco: zap choco: zap
flatpak: org.zaproxy.ZAP flatpak: org.zaproxy.ZAP
pkg-freebsd: zaproxy pkg-freebsd: zaproxy
scoop: zaproxy scoop: zaproxy
snap: zaproxy snap: zaproxy --classic
pika: pika:
_bin: null _bin: null
_desc: An open-source colour picker app for macOS _desc: An open-source colour picker app for macOS
@ -9230,14 +9213,13 @@ softwarePackages:
_github: null _github: null
_home: null _home: null
_name: Powershell _name: Powershell
_snapClassic: true
_post:cask: | _post:cask: |
#!/usr/bin/env bash #!/usr/bin/env bash
brew install mono-libgdiplus brew install mono-libgdiplus
_app: PowerShell.app _app: PowerShell.app
ansible: professormanhattan.powershell ansible: professormanhattan.powershell
cask: powershell cask: powershell
snap: powershell snap: powershell --classic
pre-commit: pre-commit:
_bin: pre-commit _bin: pre-commit
_desc: Automatically installs a git pre-commit script in your git repository which runs your `npm test` on pre-commit _desc: Automatically installs a git pre-commit script in your git repository which runs your `npm test` on pre-commit
@ -10154,7 +10136,6 @@ softwarePackages:
_post:snap: | _post:snap: |
#!/usr/bin/env bash #!/usr/bin/env bash
rustup toolchain install stable rustup toolchain install stable
_snapClassic: true
ansible: professormanhattan.rust ansible: professormanhattan.rust
brew: rust brew: rust
choco: rust choco: rust
@ -10378,7 +10359,6 @@ softwarePackages:
_github: https://github.com/blender/blender _github: https://github.com/blender/blender
_home: https://www.blender.org/ _home: https://www.blender.org/
_name: Blender _name: Blender
_snapClassic: true
_app: Blender.app _app: Blender.app
apt: blender apt: blender
cask: blender cask: blender
@ -10386,7 +10366,7 @@ softwarePackages:
dnf: blender dnf: blender
flatpak: org.blender.Blender flatpak: org.blender.Blender
scoop: extras/blender scoop: extras/blender
snap: blender snap: blender --classic
fiddler: fiddler:
_bin: fiddler _bin: fiddler
_desc: The community-trusted free Windows-only tool that logs HTTP(s) network traffic. _desc: The community-trusted free Windows-only tool that logs HTTP(s) network traffic.
@ -10693,7 +10673,6 @@ softwarePackages:
_github: https://github.com/mltframework/shotcut _github: https://github.com/mltframework/shotcut
_home: https://shotcut.org/ _home: https://shotcut.org/
_name: Shotcut _name: Shotcut
_snapClassic: true
_app: Shotcut.app _app: Shotcut.app
ansible: professormanhattan.shotcut ansible: professormanhattan.shotcut
apt: shotcut apt: shotcut
@ -10701,7 +10680,7 @@ softwarePackages:
choco: shotcut choco: shotcut
dnf: shotcut dnf: shotcut
flatpak: org.shotcut.Shotcut flatpak: org.shotcut.Shotcut
snap: shotcut snap: shotcut --classic
shotwell: shotwell:
_bin: shotwell _bin: shotwell
_desc: '[Shotwell](https://shotwell-project.org/doc/html/) is an image organizer designed to provide personal photo management for the GNOME desktop environment. In 2010, it replaced F-Spot as the standard image tool for several GNOME-based Linux distributions, including Fedora in version 13 and Ubuntu in its 10.10 Maverick Meerkat release.' _desc: '[Shotwell](https://shotwell-project.org/doc/html/) is an image organizer designed to provide personal photo management for the GNOME desktop environment. In 2010, it replaced F-Spot as the standard image tool for several GNOME-based Linux distributions, including Fedora in version 13 and Ubuntu in its 10.10 Maverick Meerkat release.'
@ -10823,9 +10802,8 @@ softwarePackages:
_github: null _github: null
_home: null _home: null
_name: Snapcraft _name: Snapcraft
_snapClassic: true
brew: snapcraft brew: snapcraft
snap: snapcraft snap: snapcraft --classic
snapd: snapd:
_bin: snap _bin: snap
_desc: '[Snap](https://snapcraft.io/) is a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel. The packages, called snaps, and the tool for using them, snapd, work across a range of Linux distributions and allow upstream software developers to distribute their applications directly to users. Snaps are self-contained applications running in a sandbox with mediated access to the host system.' _desc: '[Snap](https://snapcraft.io/) is a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel. The packages, called snaps, and the tool for using them, snapd, work across a range of Linux distributions and allow upstream software developers to distribute their applications directly to users. Snaps are self-contained applications running in a sandbox with mediated access to the host system.'
@ -11411,12 +11389,11 @@ softwarePackages:
_github: https://github.com/sassman/t-rec-rs _github: https://github.com/sassman/t-rec-rs
_home: https://crates.io/crates/t-rec _home: https://crates.io/crates/t-rec
_name: t-rec _name: t-rec
_snapClassic: true
ansible: professormanhattan.trec ansible: professormanhattan.trec
brew: t-rec brew: t-rec
cargo: t-rec cargo: t-rec
port: t-rec port: t-rec
snap: t-rec snap: t-rec --classic
yay: t-rec yay: t-rec
just: just:
_bin: just _bin: just
@ -11484,7 +11461,6 @@ softwarePackages:
_github: https://github.com/Eugeny/tabby _github: https://github.com/Eugeny/tabby
_home: https://tabby.sh/ _home: https://tabby.sh/
_name: Tabby _name: Tabby
_snapClassic: true
_notes: TODO Update the direct links periodically and keep eye out for Snap / Flatpak _notes: TODO Update the direct links periodically and keep eye out for Snap / Flatpak
_app: Tabby.app _app: Tabby.app
_post: | _post: |
@ -12542,7 +12518,6 @@ softwarePackages:
_github: https://github.com/hashicorp/vagrant _github: https://github.com/hashicorp/vagrant
_home: https://www.vagrantup.com/ _home: https://www.vagrantup.com/
_name: Vagrant _name: Vagrant
_snapClassic: true
ansible: professormanhattan.vagrant ansible: professormanhattan.vagrant
apt: vagrant apt: vagrant
brew: hashicorp/tap/vagrant brew: hashicorp/tap/vagrant
@ -12935,7 +12910,6 @@ softwarePackages:
rm -f "/tmp/actions-runner-${OS_FAMILY}-${ARCHITECTURE}-${LATEST_VERSION:1}.tar.gz" rm -f "/tmp/actions-runner-${OS_FAMILY}-${ARCHITECTURE}-${LATEST_VERSION:1}.tar.gz"
vscodium: vscodium:
_bin: codium _bin: codium
_snapClassic: true
_app: VSCodium.app _app: VSCodium.app
_post: | _post: |
#!/usr/bin/env bash #!/usr/bin/env bash
@ -12960,7 +12934,7 @@ softwarePackages:
flatpak: com.vscodium.codium flatpak: com.vscodium.codium
nix: nixpkgs.vscodium nix: nixpkgs.vscodium
scoop: vscodium scoop: vscodium
snap: codium snap: codium --classic
winget: vscodium winget: vscodium
yay: vscodium-bin yay: vscodium-bin
vlc: vlc:
@ -13193,7 +13167,6 @@ softwarePackages:
_github: https://github.com/microsoft/vscode _github: https://github.com/microsoft/vscode
_home: https://code.visualstudio.com/ _home: https://code.visualstudio.com/
_name: Visual Studio Code _name: Visual Studio Code
_snapClassic: true
_app: Visual Studio Code.app _app: Visual Studio Code.app
_post: | _post: |
#!/usr/bin/env bash #!/usr/bin/env bash
@ -13318,7 +13291,7 @@ softwarePackages:
cask: visual-studio-code cask: visual-studio-code
choco: vscode choco: vscode
flatpak: com.visualstudio.code flatpak: com.visualstudio.code
snap: code snap: code --classic
yay: visual-studio-code-bin yay: visual-studio-code-bin
w3m: w3m:
_bin: w3m _bin: w3m
@ -14457,11 +14430,10 @@ softwarePackages:
_bin: goreleaser _bin: goreleaser
_github: https://github.com/goreleaser/goreleaser _github: https://github.com/goreleaser/goreleaser
_name: Go Releaser _name: Go Releaser
_snapClassic: true
brew: goreleaser brew: goreleaser
go: github.com/goreleaser/goreleaser@latest go: github.com/goreleaser/goreleaser@latest
nix-env: goreleaser nix-env: goreleaser
snap: goreleaser snap: goreleaser --classic
yay: goreleaser-bin yay: goreleaser-bin
obs-studio: obs-studio:
_bin: obs-studio _bin: obs-studio