aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2019-03-07 20:53:52 +1300
committerDavid Phillips <david@sighup.nz>2019-03-07 20:53:52 +1300
commita3f4fe5c53c41ee92bc8f60c0b8b83550111d33d (patch)
treea35508baf0f913d8567e0818e53a64b704bf1e56 /bin
parentda2b78e3a64b32ff66d58d7b4e11cc1477e5060a (diff)
downloadThirdPartyInstallers-master.tar.xz
Draft support for Arch Linux/pacman packagesHEADpacmanmaster
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ThirdPartyInstaller23
1 files changed, 20 insertions, 3 deletions
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