Update file executable_install-program

This commit is contained in:
Brian Zalewski 2023-01-05 05:47:56 +00:00
parent 1868dfc95f
commit 11c8412012

View file

@ -76,6 +76,10 @@ function runCommand(spinnerTitle, command) {
}) })
} }
async function runSilentCommand(command) {
execSync(`${command}`, { stdio: 'inherit', shell: true })
}
function fileExists(pathToFile) { function fileExists(pathToFile) {
return fs.existsSync(pathToFile) return fs.existsSync(pathToFile)
} }
@ -1402,7 +1406,7 @@ async function pruneInstallOrders(installOrders) {
if (pkgManager === 'apt') { if (pkgManager === 'apt') {
newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (pkg) => { newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (pkg) => {
try { try {
await $`dpkg -l ${pkg} | grep -E '^ii' > /dev/null` runSilentCommand(`dpkg -l ${pkg} | grep -E '^ii' > /dev/null`)
return false return false
} catch (e) { } catch (e) {
return true return true
@ -1424,9 +1428,9 @@ async function pruneInstallOrders(installOrders) {
newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (pkg) => { newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (pkg) => {
try { try {
if (dnf) { if (dnf) {
await $`rpm -qa | grep ${pkg} > /dev/null > /dev/null` runSilentCommand(`rpm -qa | grep ${pkg} > /dev/null > /dev/null`)
} else { } else {
await $`rpm -qa | grep ${pkg} > /dev/null > /dev/null` runSilentCommand(`rpm -qa | grep ${pkg} > /dev/null > /dev/null`)
} }
return false return false
} catch (e) { } catch (e) {
@ -1436,11 +1440,7 @@ async function pruneInstallOrders(installOrders) {
} else if (pkgManager === 'flatpak') { } else if (pkgManager === 'flatpak') {
newOrders[pkgManager] = newOrders[pkgManager].filter(async (pkg) => { newOrders[pkgManager] = newOrders[pkgManager].filter(async (pkg) => {
try { try {
if (dnf) { runSilentCommand(`flatpak info ${pkg} > /dev/null`)
await $`rpm -qa | grep ${pkg} > /dev/null > /dev/null`
} else {
await $`rpm -qa | grep ${pkg} > /dev/null > /dev/null`
}
return true return true
} catch (e) { } catch (e) {
return false return false
@ -1449,7 +1449,16 @@ async function pruneInstallOrders(installOrders) {
} else if (pkgManager === 'pacman') { } else if (pkgManager === 'pacman') {
newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (pkg) => { newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (pkg) => {
try { try {
await $`pacman -Qs ${pkg} > /dev/null > /dev/null` runSilentCommand(`pacman -Qs ${pkg} > /dev/null > /dev/null`)
return false
} catch (e) {
return true
}
})
} else if (pkgManager === 'snap') {
newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (pkg) => {
try {
runSilentCommand(`snap list ${pkg} | grep ${pkg} > /dev/null`)
return false return false
} catch (e) { } catch (e) {
return true return true