Update file executable_install-program
This commit is contained in:
parent
e79917c6cc
commit
5116de3d23
1 changed files with 15 additions and 10 deletions
|
@ -1326,23 +1326,26 @@ const asyncFilter = async (arr, predicate) => {
|
|||
|
||||
async function pruneInstallOrders(installOrders) {
|
||||
const newOrders = Object.assign({}, installOrders)
|
||||
log('info', 'Filtering Install Orders', 'Removing packages from installOrders that are already installed')
|
||||
for (const pkgManager in installOrders) {
|
||||
log('info', 'Filtering Install Orders', `Filtering the ${pkgManager} installOrders`)
|
||||
console.log(newOrders[pkgManager])
|
||||
if (pkgManager === 'apt') {
|
||||
newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (x) => {
|
||||
try {
|
||||
await $`dpkg -l ${pkg} | grep -E '^ii' > /dev/null`
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
} catch (e) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
} else if (pkgManager === 'brew') {
|
||||
newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (x) => {
|
||||
try {
|
||||
await $`brew list ${pkg} > /dev/null`
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
} catch (e) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
/*let newVal = newOrders[pkgManager]
|
||||
|
@ -1364,9 +1367,9 @@ async function pruneInstallOrders(installOrders) {
|
|||
} else {
|
||||
await $`rpm -qa | grep ${pkg} > /dev/null > /dev/null`
|
||||
}
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
} catch (e) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
} else if (pkgManager === 'flatpak') {
|
||||
|
@ -1377,21 +1380,23 @@ async function pruneInstallOrders(installOrders) {
|
|||
} else {
|
||||
await $`rpm -qa | grep ${pkg} > /dev/null > /dev/null`
|
||||
}
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
} catch (e) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
} else if (pkgManager === 'pacman') {
|
||||
newOrders[pkgManager] = await asyncFilter(newOrders[pkgManager], async (x) => {
|
||||
try {
|
||||
await $`pacman -Qs ${pkg} > /dev/null > /dev/null`
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
} catch (e) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
log('info', 'Filtering Install Orders', `Finished filtering ${pkgManager}`)
|
||||
console.log(newOrders[pkgManager])
|
||||
}
|
||||
return newOrders
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue