diff --git a/home/dot_local/bin/executable_install-program b/home/dot_local/bin/executable_install-program index 686311fb..1c757c70 100644 --- a/home/dot_local/bin/executable_install-program +++ b/home/dot_local/bin/executable_install-program @@ -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 }