-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmtps-setup
executable file
·55 lines (49 loc) · 1.38 KB
/
mtps-setup
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
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/bash -efu
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright: Red Hat Inc. 2023
# Author: Andrei Stepanov <[email protected]>
#
# This file is `source` by all mini-tps scripts
#
# What command to used for yum/dnf command defined by next priority:
# 1. Env variable MINITPSYUMDNFCMD
# 2. If /usr/bin/yum is symlink:
#
# * read this symlink
# * <=f40, <= c10s, <= rhel10:
#
# lrwxrwxrwx. 1 root root 5 May 29 00:00 /usr/bin/yum -> dnf-3
#
# * >=F41:
#
# lrwxrwxrwx. 1 root root 4 Jul 19 00:00 /usr/bin/yum -> dnf5
#
# 3. If /usr/bin/yum is present then use `yum`
# 4. Else use `dnf`
#
YUMDNFCMD="${MINITPSYUMDNFCMD:-}"
if [ -z "$YUMDNFCMD" ]; then
if [ -f "/usr/bin/yum" ]; then
YUMDNFCMD="yum"
if [ -L "/usr/bin/yum" ]; then
YUMDNFCMD="$(readlink "/usr/bin/yum")"
fi
else
YUMDNFCMD="dnf"
fi
fi
debug() {
if [[ -n "${DEBUG:-}" || -n "${GB_DEBUG:-}" ]]; then
echo -e "$*" >&2
fi
}