Update .local/share/chezmoi/home/dot_local/bin/executable_install-program

This commit is contained in:
Brian Zalewski 2022-12-03 01:39:29 +00:00
parent 269dd96ed3
commit 5e01147287

View file

@ -652,46 +652,65 @@ async function ensurePackageManager(packageManager) {
// Installs a list of packages via the specified package manager // Installs a list of packages via the specified package manager
async function installPackageList(packageManager, packages) { async function installPackageList(packageManager, packages) {
const logStage = 'Package Install' const logStage = 'Package Install'
let pkg = packages
try { try {
if (packageManager === 'appimage') { if (packageManager === 'appimage') {
} else if (packageManager === 'ansible') { } else if (packageManager === 'ansible') {
console.log(packageManager)
console.log(packages)
for (let pkg of packages) { for (let pkg of packages) {
console.log(pkg)
try { try {
execSync(`gum spin --spinner dot --title "Installing ${pkg} via Ansible" -- ansible localhost -m setup -m include_role -a name=${pkg} -e ansible_user=${process.env.USER} -e include_homebrew_install=false`, {stdio: 'inherit', shell: true}) await $`ansible localhost -m setup -m include_role -a name=${pkg} -e ansible_user=${process.env.USER} -e include_homebrew_install=false`
} catch (e) { } catch (e) {
log('error', 'Ansible Role Failure', 'There was an error installing ' + pkg) log('error', 'Ansible Role Failure', `There was an error installing ${pkg} with Ansible`)
console.log(e)
} }
} }
} else if (packageManager === 'apk') { } else if (packageManager === 'apk') {
for (let pkg of packages) { for (let pkg of packages) {
await $`sudo apk add ${packages}` try {
await $`sudo apk add ${pkg}`
} catch (e) {
log('error', 'APK Install Failure', `There was an error installing ${pkg} with apk`)
}
} }
} else if (packageManager === 'apt') { } else if (packageManager === 'apt') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`sudo apt-get install -y ${pkg}` await $`sudo apt-get install -y ${pkg}`
} catch (e) {
log('error', 'apt-get Failure', `There was an error installing ${pkg} with apt-get`)
}
} }
} else if (packageManager === 'basher') { } else if (packageManager === 'basher') {
} else if (packageManager === 'binary') { } else if (packageManager === 'binary') {
} else if (packageManager === 'brew') { } else if (packageManager === 'brew') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`brew install ${pkg}` await $`brew install ${pkg}`
} catch (e) {
log('error', 'Homebrew Failure', `There was an error installing ${pkg} with brew`)
}
} }
} else if (packageManager === 'cask') { } else if (packageManager === 'cask') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`brew install --cask ${pkg}` await $`brew install --cask ${pkg}`
} catch(e) {
log('error', 'Homebrew Cask Failure', `There was an error installing ${pkg} with Homebrew Cask`)
}
} }
} else if (packageManager === 'cargo') { } else if (packageManager === 'cargo') {
for (const pkg of packages) { for (const pkg of packages) {
try {
await $`cargo install ${pkg}` await $`cargo install ${pkg}`
} catch (e) {
log('error', 'Cargo Failure', `There was an error installing ${pkg} with Cargo`)
}
} }
} else if (packageManager === 'choco') { } else if (packageManager === 'choco') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`choco install -y ${pkg}` await $`choco install -y ${pkg}`
} catch (e) {
log('error', 'Chocolatey Failure', `There was an error installing ${pkg} with Chocolatey`)
}
} }
} else if (packageManager === 'crew') { } else if (packageManager === 'crew') {
} else if (packageManager === 'dnf') { } else if (packageManager === 'dnf') {
@ -699,63 +718,120 @@ async function installPackageList(packageManager, packages) {
const yum = which.sync('yum', { nothrow: true }) const yum = which.sync('yum', { nothrow: true })
if (dnf) { if (dnf) {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`sudo dnf install -y ${pkg}` await $`sudo dnf install -y ${pkg}`
} catch (e) {
log('error', 'dnf Failure', `There was an error installing ${pkg} with dnf`)
}
} }
} else if (yum) { } else if (yum) {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`sudo yum install -y ${pkg}` await $`sudo yum install -y ${pkg}`
} catch(e) {
log('error', 'yum Failure', `There was an error installing ${pkg} with yum`)
}
} }
} }
} else if (packageManager === 'flatpak') { } else if (packageManager === 'flatpak') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`sudo flatpak install flathub ${pkg}` await $`sudo flatpak install flathub ${pkg}`
} catch(e) {
log('error', 'Flatpak Failure', `There was an error installing ${pkg} with flatpak`)
}
} }
} else if (packageManager === 'gem') { } else if (packageManager === 'gem') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`gem install ${pkg}` await $`gem install ${pkg}`
} catch (e) {
log('error', 'Gem Failure', `There was an error installing ${pkg} with gem`)
}
} }
} else if (packageManager === 'go') { } else if (packageManager === 'go') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`go install ${pkg}` await $`go install ${pkg}`
} catch(e) {
log('error', 'Go Failure', `There was an error installing ${pkg} with go`)
}
} }
} else if (packageManager === 'nix') { } else if (packageManager === 'nix') {
} else if (packageManager === 'npm') { } else if (packageManager === 'npm') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`volta install ${pkg}` await $`volta install ${pkg}`
} catch(e) {
log('error', 'Volta Failure', `There was an error installing ${pkg} with volta`)
}
} }
} else if (packageManager === 'pacman') { } else if (packageManager === 'pacman') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`sudo pacman -Sy --noconfirm --needed ${pkg}` await $`sudo pacman -Sy --noconfirm --needed ${pkg}`
} catch(e) {
log('error', 'Pacman Failure', `There was an error installing ${pkg} with pacman`)
}
} }
} else if (packageManager === 'pipx') { } else if (packageManager === 'pipx') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`pipx install ${pkg}` await $`pipx install ${pkg}`
} catch(e) {
log('error', 'PIPX Failure', `There was an error installing ${pkg} with pipx`)
}
} }
} else if (packageManager === 'pkg') { } else if (packageManager === 'pkg') {
} else if (packageManager === 'port') { } else if (packageManager === 'port') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`sudo port install ${pkg}` await $`sudo port install ${pkg}`
} catch(e) {
log('error', 'Port Failure', `There was an error installing ${pkg} with port`)
}
} }
} else if (packageManager === 'scoop') { } else if (packageManager === 'scoop') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`scoop install ${pkg}` await $`scoop install ${pkg}`
} catch(e) {
log('error', 'Scoop Failure', `There was an error installing ${pkg} with scoop`)
}
} }
} else if (packageManager === 'snap') { } else if (packageManager === 'snap') {
for (let pkg of packages) { for (let pkg of packages) {
// TODO _snapClassic
try {
await $`sudo snap install -y ${pkg}` await $`sudo snap install -y ${pkg}`
} catch(e) {
log('error', 'Snap Failure', `There was an error installing ${pkg} with snap`)
}
} }
} else if (packageManager === 'whalebrew') { } else if (packageManager === 'whalebrew') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`whalebrew install ${pkg}` await $`whalebrew install ${pkg}`
} catch(e) {
log('error', 'Whalebrew Failure', `There was an error installing ${pkg} with whalebrew`)
}
} }
} else if (packageManager === 'winget') { } else if (packageManager === 'winget') {
} else if (packageManager === 'yay') { } else if (packageManager === 'yay') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`yay -Sy --noconfirm --needed ${pkg}` await $`yay -Sy --noconfirm --needed ${pkg}`
} catch(e) {
log('error', 'Yay Failure', `There was an error installing ${pkg} with yay`)
}
} }
} else if (packageManager === 'zypper') { } else if (packageManager === 'zypper') {
for (let pkg of packages) { for (let pkg of packages) {
try {
await $`sudo zypper install -y ${packages}` await $`sudo zypper install -y ${packages}`
} catch(e) {
log('error', 'Zypper Failure', `There was an error installing ${pkg} with zypper`)
}
} }
} }
} catch (e) { } catch (e) {