Update .local/share/chezmoi/software.yml, .local/share/chezmoi/home/.chezmoidata.yaml, .local/share/chezmoi/home/private_dot_config/zap/v2/config.ini, .local/share/chezmoi/home/dot_local/bin/executable_install-program

This commit is contained in:
Brian Zalewski 2022-12-09 06:37:26 +00:00
parent d261280dc1
commit 33427cd0db
4 changed files with 207 additions and 31 deletions

View file

@ -460,8 +460,8 @@ softwareGroups:
- composer - composer
- php - php
Package-Management: &Package-Management Package-Management: &Package-Management
- homebrew # - homebrew
- whalebrew # - whalebrew
- zap - zap
Productivity-Desktop: &Productivity-Desktop Productivity-Desktop: &Productivity-Desktop
- libreoffice - libreoffice

View file

@ -541,6 +541,7 @@ async function afterInstall(packageManager) {
} else if (packageManager === "pkg") { } else if (packageManager === "pkg") {
} else if (packageManager === "port") { } else if (packageManager === "port") {
} else if (packageManager === "scoop") { } else if (packageManager === "scoop") {
} else if (packageManager === "script") {
} else if (packageManager === "snap") { } else if (packageManager === "snap") {
} else if (packageManager === "whalebrew") { } else if (packageManager === "whalebrew") {
} else if (packageManager === "winget") { } else if (packageManager === "winget") {
@ -549,8 +550,63 @@ async function afterInstall(packageManager) {
} }
} }
async function ensureCurl() {
const curl = which.sync('curl', { nothrow: true })
if (!curl) {
log("warn", "Ensure curl", `Installing curl because it is required for the binary install method`)
if (osType === 'linux') {
const apk = which.sync("apk", { nothrow: true });
const apt = which.sync("apt", { nothrow: true });
const dnf = which.sync("dnf", { nothrow: true });
const yum = which.sync("yum", { nothrow: true });
const pacman = which.sync("pacman", { nothrow: true });
const zypper = which.sync("zypper", { nothrow: true });
if (apk) {
$`sudo apk add curl`;
} else if (apt) {
if (updateDone[packageManager] !== true) {
await beforeInstall('apt-get')
}
await $`sudo apt-get install -y curl`;
} else if (dnf) {
if (updateDone[packageManager] !== true) {
await beforeInstall('dnf')
}
await $`sudo dnf install -y curl`;
} else if (yum) {
if (updateDone[packageManager] !== true) {
await beforeInstall('dnf')
}
await $`sudo yum install -y curl`;
} else if (pacman) {
if (updateDone[packageManager] !== true) {
await beforeInstall('pacman')
}
await $`sudo pacman -Sy curl`;
} else if (zypper) {
if (updateDone[packageManager] !== true) {
await beforeInstall('zypper')
}
await $`sudo zypper install -y curl`;
}
} else if (osType === 'darwin') {
if (updateDone['brew'] !== true) {
await beforeInstall('brew')
}
await $`brew install curl`
} else if (osType === 'windows') {
if (updateDone['choco'] !== true) {
await beforeInstall('choco')
}
await `choco install -y curl`
}
}
}
// Pre-install hook // Pre-install hook
const updateDone = {}
async function beforeInstall(packageManager) { async function beforeInstall(packageManager) {
updateDone[packageManager] = true
const logStage = "Pre-Install Package Manager"; const logStage = "Pre-Install Package Manager";
if (packageManager === "appimage") { if (packageManager === "appimage") {
} else if (packageManager === "ansible") { } else if (packageManager === "ansible") {
@ -721,6 +777,12 @@ async function ensurePackageManager(packageManager) {
await ensurePackageManager("brew"); await ensurePackageManager("brew");
} }
if (packageManager === "appimage") { if (packageManager === "appimage") {
const zap = which.sync('zap', { nothrow: true })
if (!zap) {
log("info", "Zap Installation", 'Installing Zap to handle AppImage installation')
await ensureCurl()
await $`sudo curl -sSL https://github.com/srevinsaju/zap/releases/download/continuous/zap-amd64 > /usr/local/bin/zap`
}
} else if (packageManager === "ansible") { } else if (packageManager === "ansible") {
try { try {
await $`test -f "$HOME/.cache/megabyte-labs/ansible-installed"`; await $`test -f "$HOME/.cache/megabyte-labs/ansible-installed"`;
@ -750,6 +812,7 @@ async function ensurePackageManager(packageManager) {
` `
); );
} else if (packageManager === "binary") { } else if (packageManager === "binary") {
await ensureCurl()
} else if (packageManager === "bpkg") { } else if (packageManager === "bpkg") {
await ensureInstalled( await ensureInstalled(
"bpkg", "bpkg",
@ -987,6 +1050,7 @@ async function ensurePackageManager(packageManager) {
} else { } else {
log("warn", logStage, 'Snap installation sequence completed but the snap bin is still not available') log("warn", logStage, 'Snap installation sequence completed but the snap bin is still not available')
} }
} else if (packageManager === "script") {
} else if (packageManager === "whalebrew") { } else if (packageManager === "whalebrew") {
await ensureInstalled("whalebrew", $`brew install whalebrew`); await ensureInstalled("whalebrew", $`brew install whalebrew`);
} else if (packageManager === "winget") { } else if (packageManager === "winget") {
@ -1016,6 +1080,22 @@ async function installPackageList(packageManager, packages) {
const logStage = "Package Install"; const logStage = "Package Install";
try { try {
if (packageManager === "appimage") { if (packageManager === "appimage") {
for (let pkg of packages) {
try {
if (pkg.substring(0, 3) === 'http' && pkg.slice(-8) === 'AppImage') {
log("info", "AppImage Install", `Installing ${pkg} from its URL`)
await $`zap install --from ${pkg}`
} else if (pkg.includes("/")) {
log("info", "AppImage Install", `Installing ${pkg} from a GitHub Release`)
await $`zap install --github --from ${pkg}`
} else {
log("info", "AppImage Install", `Installing ${pkg} using the AppImage Catalog`)
await $`zap install ${pkg}`
}
} catch (e) {
log("error", "AppImage / Zap Failure", `There was an error using Zap to install ${pkg}`)
}
}
} else if (packageManager === "ansible") { } else if (packageManager === "ansible") {
for (let pkg of packages) { for (let pkg of packages) {
try { try {
@ -1070,6 +1150,13 @@ async function installPackageList(packageManager, packages) {
} }
} }
} else if (packageManager === "binary") { } else if (packageManager === "binary") {
for (let pkg of packages) {
try {
await $`TMP="$(mktemp)" && curl -sSL ${pkg} > "$TMP" && sudo mv "$TMP" /usr/local/src/${binName} && chmod +x /usr/local/src/${binName}`
} catch (e) {
log("error", "Binary Release Install", `There was an error installing the binary release for ${pkg}`)
}
}
} else if (packageManager === "brew") { } else if (packageManager === "brew") {
for (let pkg of packages) { for (let pkg of packages) {
try { try {
@ -1267,6 +1354,14 @@ async function installPackageList(packageManager, packages) {
); );
} }
} }
} else if (packageManager === "script") {
for (let pkg of packages) {
try {
await $`${pkg}`
} catch(e) {
log("error", "Script Install Failure", `There was an error running the script installation method for ${pkg}`)
}
}
} else if (packageManager === "snap-classic") { } else if (packageManager === "snap-classic") {
for (let pkg of packages) { for (let pkg of packages) {
try { try {

View file

@ -0,0 +1,9 @@
[Zap]
Version = 2
Mirror = https://g.srev.in/get-appimage/%s/core.json
MirrorRoot = https://g.srev.in/get-appimage
ApplicationStore = {{ .host.home }}/Applications
IconStore = {{ .host.home }}/.local/icons
LocalStore = {{ .host.home }}/Applications
CustomIconTheme = true
Integrate = yes

View file

@ -53,6 +53,10 @@
# pkg-termux: altair # pkg-termux: altair
# port: altair # port: altair
# scoop: altair # scoop: altair
# script >-
# curl -sS https://getcomposer.org/installer | php
# sudo mv composer.phar /usr/local/bin/composer
# sudo chmod +x /usr/local/bin/composer
# _snapClassic: true # Install the snap in classic mode # _snapClassic: true # Install the snap in classic mode
# snap: altair # snap: altair
# whalebrew: # whalebrew:
@ -1068,14 +1072,20 @@ softwarePackages:
_service: null _service: null
ansible: professormanhattan.common ansible: professormanhattan.common
composer: composer:
_bin: null _bin: composer
_desc: '[Composer](https://getcomposer.org/) is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. It was developed by Nils Adermann and Jordi Boggiano, who continue to manage the project.' _desc: '[Composer](https://getcomposer.org/) is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. It was developed by Nils Adermann and Jordi Boggiano, who continue to manage the project.'
_docs: https://getcomposer.org/doc/ _docs: https://getcomposer.org/doc/
_github: https://github.com/composer/composer _github: https://github.com/composer/composer
_home: https://getcomposer.org/ _home: https://getcomposer.org/
_name: Composer _name: Composer
_service: null _service: false
ansible: professormanhattan.composer ansible: professormanhattan.composer
brew: composer
choco: composer
pacman: composer
scoop: composer
script:darwin: cd ~ && curl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composer && sudo chmod +x /usr/local/bin/composer
script:linux: cd ~ && curl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composer && sudo chmod +x /usr/local/bin/composer
confd: confd:
_bin: null _bin: null
_desc: Manage local application configuration files using templates and data from etcd or consul _desc: Manage local application configuration files using templates and data from etcd or consul
@ -3001,15 +3011,6 @@ softwarePackages:
ansible: professormanhattan.himalaya ansible: professormanhattan.himalaya
brew: himalaya brew: himalaya
scoop: himalaya scoop: himalaya
homebrew:
_bin: null
_desc: '[Homebrew](https://brew.sh/) is a free and open-source software package management system that simplifies the installation of software on Apple''s operating system macOS as well as Linux. The name is intended to suggest the idea of building software on the Mac depending on the user''s taste.'
_docs: null
_github: null
_home: null
_name: Homebrew
_service: null
ansible: professormanhattan.homebrew
hostctl: hostctl:
_bin: null _bin: null
_desc: This tool gives more control over the use of hosts file _desc: This tool gives more control over the use of hosts file
@ -4770,14 +4771,90 @@ softwarePackages:
pipx: pgcli pipx: pgcli
port: pgcli port: pgcli
php: php:
_bin: null _deps:
- php-extensions
_bin: php
_desc: '[PHP](https://www.php.net/) is a general-purpose scripting language especially suited to web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994. The PHP reference implementation is now produced by The PHP Group.' _desc: '[PHP](https://www.php.net/) is a general-purpose scripting language especially suited to web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994. The PHP reference implementation is now produced by The PHP Group.'
_docs: https://www.php.net/docs.php _docs: https://www.php.net/docs.php
_github: https://github.com/php/php-src _github: https://github.com/php/php-src
_home: https://www.php.net/ _home: https://www.php.net/
_name: PHP _name: PHP
_service: null _service: false
ansible: professormanhattan.php ansible: professormanhattan.php
apt: php
brew: php
choco: php
dnf: php
pacman: php
port: php
scoop: php
php-extensions:
_name: PHP Extensions
_service: false
_note: Needs testing
apt:
- libpcre3-dev
- php-apache
- php-apcu
- php-cgi
- php-cli
- php-common
- php-curl
- php-dev
- php-fpm
- php-gd
- php-embed
- php-intl
- php-imap
- php-json
- php-mbstring
- php-opcache
- php-redis
- php-snmp
- php-sqlite3
- php-xml
dnf:
- libpcre3-dev
- php-apache
- php-apcu
- php-cgi
- php-cli
- php-common
- php-curl
- php-dev
- php-fpm
- php-gd
- php-embed
- php-intl
- php-imap
- php-json
- php-mbstring
- php-opcache
- php-redis
- php-snmp
- php-sqlite3
- php-xml
pacman:
- libpcre3-dev
- php-apache
- php-apcu
- php-cgi
- php-cli
- php-common
- php-curl
- php-dev
- php-fpm
- php-gd
- php-embed
- php-intl
- php-imap
- php-json
- php-mbstring
- php-opcache
- php-redis
- php-snmp
- php-sqlite3
- php-xml
pihole: pihole:
_bin: null _bin: null
_desc: '[Pi-hole](https://pi-hole.net/) is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole and optionally a DHCP server, intended for use on a private network. It is designed for low-power embedded devices with network capability, such as the Raspberry Pi, but supports any Linux machines.' _desc: '[Pi-hole](https://pi-hole.net/) is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole and optionally a DHCP server, intended for use on a private network. It is designed for low-power embedded devices with network capability, such as the Raspberry Pi, but supports any Linux machines.'
@ -5435,7 +5512,9 @@ softwarePackages:
_github: https://github.com/rust-lang/rust _github: https://github.com/rust-lang/rust
_home: https://www.rust-lang.org/ _home: https://www.rust-lang.org/
_name: Rust _name: Rust
_post:snap: rustup toolchain install stable
_service: false _service: false
_snapClassic: true
ansible: professormanhattan.rust ansible: professormanhattan.rust
apt: apt:
- cargo - cargo
@ -5450,6 +5529,7 @@ softwarePackages:
- cargo - cargo
- rust - rust
scoop: rust scoop: rust
snap: rustup
rvm: rvm:
_bin: null _bin: null
_desc: '[rvm](https://rvm.io/) lets you manage Ruby environments and switch between them.' _desc: '[rvm](https://rvm.io/) lets you manage Ruby environments and switch between them.'
@ -6948,16 +7028,6 @@ softwarePackages:
brew: wget brew: wget
dnf: wget dnf: wget
# whalebrew: whalebrew/wget # Temporarily commentted out for debugging # whalebrew: whalebrew/wget # Temporarily commentted out for debugging
whalebrew:
_bin: whalebrew
_desc: Homebrew, but with Docker images
_docs: https://github.com/whalebrew/whalebrew
_github: https://github.com/whalebrew/whalebrew
_home: https://github.com/whalebrew/whalebrew
_name: Whalebrew
_service: false
_type: cli
brew: whalebrew
whaler: whaler:
_bin: null _bin: null
_desc: Whaler takes a Docker image and attempts to reverse engineer the Dockerfile that created it _desc: Whaler takes a Docker image and attempts to reverse engineer the Dockerfile that created it
@ -7269,14 +7339,16 @@ softwarePackages:
pacman: yubikey-manager-qt pacman: yubikey-manager-qt
scoop: yubikey-manager-qt scoop: yubikey-manager-qt
zap: zap:
_bin: null _bin: zap
_desc: Delightful AppImage package manager _desc: Delightful AppImage package manager
_docs: null _docs: https://zap.srev.in/
_github: https://github.com/srevinsaju/zap _github: https://github.com/srevinsaju/zap
_home: null _home: https://zap.srev.in/
_name: null _name: Zap
_service: null _service: false
ansible: professormanhattan.zap ansible:linux: professormanhattan.zap
binary:linux: https://github.com/srevinsaju/zap/releases/download/continuous/zap-amd64
script:linux: curl https://raw.githubusercontent.com/srevinsaju/zap/main/install.sh | sudo bash -s
zoom: zoom:
_bin: null _bin: null
_desc: '[Zoom](https://zoom.us/) is a videotelephony software program developed by Zoom Video Communications. This role installs Zoom on nearly any platform. The Zoom free plan provides a video chatting service that allows up to 100 participants concurrently, with a 40-minute time restriction.' _desc: '[Zoom](https://zoom.us/) is a videotelephony software program developed by Zoom Video Communications. This role installs Zoom on nearly any platform. The Zoom free plan provides a video chatting service that allows up to 100 participants concurrently, with a 40-minute time restriction.'