From de3095b65d6d4050f3ef1363333c3f8934e3d3e1 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Mon, 9 Jan 2023 12:00:59 +0000 Subject: [PATCH] Update 2 files - /software.yml - /home/dot_local/bin/executable_install-program --- home/dot_local/bin/executable_install-program | 38 ++++++++++++++++--- software.yml | 3 +- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/home/dot_local/bin/executable_install-program b/home/dot_local/bin/executable_install-program index f2bf4065..7934ca19 100644 --- a/home/dot_local/bin/executable_install-program +++ b/home/dot_local/bin/executable_install-program @@ -86,6 +86,7 @@ function fileExists(pathToFile) { let installData let installOrders = {} +let installMeta = {} let binLinkRan = false const installOrdersPre = [] const installOrdersPost = [] @@ -401,12 +402,33 @@ async function updateInstallMaps(preference, packages, scopedPreference, pkg, pa } log('info', 'Match', `Found a match for the package \`${pkg}\` (${packageKey} via ${scopedPreference})`) const newPackages = packages[scopedPreference] - const newPkgs = typeof newPackages === 'string' ? [newPackages] : newPackages - if (preference === 'snap' && softwarePackages[pkg]['_snapClassic'] === true) { - if (!installOrders[preference + '-classic']) { - installOrders[preference + '-classic'] = [] + const newPkgs = typeof newPackages === 'string' ? [{newPackages}] : newPackages + if (typeof newPackages === 'string') { + installMeta[newPackages] = { + preference, + packages, + scopedPreference, + pkg, + packageKey, + softwarePackages } - installOrders[preference + '-classic'] = installOrders[preference].concat(newPkgs) + } else { + for (const dataKey in newPackages) { + installMeta[newPackages] = { + preference, + packages, + scopedPreference, + pkg, + packageKey, + softwarePackages + } + } + } + if (preference === 'snap' && softwarePackages[pkg]['_snapClassic'] === true) { + if (!installOrders['snap-classic']) { + installOrders['snap-classic'] = [] + } + installOrders['snap-classic'] = installOrders[preference].concat(newPkgs) } else { installOrders[preference] = installOrders[preference].concat(newPkgs) } @@ -1143,7 +1165,11 @@ async function installPackageList(packageManager, packages) { } 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}` + const bins = installData.softwarePackages.filter(x => x.appimage === pkg) + if (bins && bins[0]) { + const binName = bins[0]['_bin'] + await $`TMP="$(mktemp)" && curl -sSL ${pkg} > "$TMP" && sudo mv "$TMP" /usr/local/src/${binName} && chmod +x /usr/local/src/${binName}` + } } catch (e) { log('error', 'Install Failure', `There was an error installing the binary release for ${pkg}`) console.error(e) diff --git a/software.yml b/software.yml index 59d9506c..60b42a58 100644 --- a/software.yml +++ b/software.yml @@ -967,7 +967,8 @@ softwarePackages: _name: CloudFlared _type: cli ansible: professormanhattan.cloudflared - brew: cloudflare/cloudflare/cloudflared + binary:linux: https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 + brew:darwin: cloudflare/cloudflare/cloudflared github: github.com/cloudflare/cloudflared cmake: _bin: cmake