From a3f4fe5c53c41ee92bc8f60c0b8b83550111d33d Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 7 Mar 2019 20:53:52 +1300 Subject: Draft support for Arch Linux/pacman packages --- bin/ThirdPartyInstaller | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/ThirdPartyInstaller b/bin/ThirdPartyInstaller index 122df20..158d4db 100755 --- a/bin/ThirdPartyInstaller +++ b/bin/ThirdPartyInstaller @@ -491,6 +491,21 @@ function prepare_program_entry() { target="$goboPrograms/$programname/$programversion" } +function has_mixed_packages() { + grep -vq "\.pkg.tar" <<< "$@" + local has_arch=$? + + grep -vq "\.deb" <<< "$@" + local has_deb=$? + + grep -vq "\.rpm" <<< "$@" + local has_rpm=$? + + # only one of these should be 1 for mutual exclusivity + [ "$(( $has_arch + $has_deb + $has_rpm ))" != "1" ] +} + + ### Operation ################################################################# Is_Writable "${goboPrograms}" || Verify_Superuser @@ -501,13 +516,15 @@ else verbose= fi # Sanity checks, then import the backend to handle the input package(s) -if echo "$@" | grep -q "\.rpm" && echo "$@" | grep -q "\.deb" -then Die "Error: cannot handle both RPM and DEB files in one shot." +if has_mixed_packages $@ +then Die "Error: cannot handle package archives of more than one format in one shot." elif echo "$@" | grep -q "\.rpm" then Import RPM elif echo "$@" | grep -q "\.deb" then Import DEB -else Die "Error: this tool can only handle RPM and DEB archives." +elif echo "$@" | grep -q "\.pkg.tar" +then Import Arch +else Die "Error: this tool can only handle RPM, DEB, and Arch Linux archives." fi # The inputfiles array holds the full path of all RPM/DEB input files -- cgit v1.1