-
Notifications
You must be signed in to change notification settings - Fork 68
/
00_external.sh
43 lines (37 loc) · 1.08 KB
/
00_external.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env sh
# Purpose : Provide some basic settings for external package managers
# Author : Ky-Anh Huynh
# License : MIT
# Date : 2018 July 26th
# Ref. : https://github.com/icy/pacapt/issues/106
export _SUPPORTED_EXTERNALS="
:conda
:tlmgr
:texlive
:gem
:npm
:pip
"
readonly _SUPPORTED_EXTERNALS
_PACMAN_found_from_script_name() {
local_tmp_name=
local_pacman=
local_tmp_name="${0}"
# https://github.com/icy/pacapt/pull/161/files#r654800412
case "$local_tmp_name" in
*-*) : ;;
*) return 1 ;;
esac
local_tmp_name="${local_tmp_name##*/}" # base name (remove everything before the last `/`)
local_tmp_name="${local_tmp_name%.*}" # remove extension if any (remove everything from the last `.`)
local_pacman="${local_tmp_name##*-}" # remove every thing before the last `-`
if echo "$_SUPPORTED_EXTERNALS" \
| "$GREP" -Eq -e ":${local_pacman}[[:space:]]*";
then
export _PACMAN="$local_pacman"
return 0
else
export _PACMAN=""
_die "Unable to guess non-system package manager ($local_pacman) from script name '$0'."
fi
}