@@ -10,14 +10,6 @@ update_fuse_conf() {
10
10
fi
11
11
}
12
12
13
- dnf_install () {
14
- if grep -q " Oracle Linux Server release 8" /etc/system-release; then
15
- dnf install --repo ol8_baseos_latest --repo ol8_codeready_builder " $@ "
16
- else
17
- dnf install " $@ "
18
- fi
19
- }
20
-
21
13
INSTALL_IPTABLES=0
22
14
if [ " ${LIMA_CIDATA_CONTAINERD_SYSTEM} " = 1 ] || [ " ${LIMA_CIDATA_CONTAINERD_USER} " = 1 ]; then
23
15
INSTALL_IPTABLES=1
28
20
29
21
# Install minimum dependencies
30
22
if command -v apt-get > /dev/null 2>&1 ; then
31
- DEBIAN_FRONTEND=noninteractive
32
- export DEBIAN_FRONTEND
33
- apt-get update
34
- if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ]; then
35
- if ! command -v sshfs > /dev/null 2>&1 ; then
36
- apt-get install -y sshfs
37
- fi
23
+ pkgs=" "
24
+ if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ] && ! command -v sshfs > /dev/null 2>&1 ; then
25
+ pkgs=" ${pkgs} sshfs"
38
26
fi
39
- if [ " ${INSTALL_IPTABLES} " = 1 ]; then
40
- if [ ! -e /usr/sbin/iptables ]; then
41
- apt-get install -y iptables
42
- fi
27
+ if [ " ${INSTALL_IPTABLES} " = 1 ] && [ ! -e /usr/sbin/iptables ]; then
28
+ pkgs=" ${pkgs} iptables"
43
29
fi
44
- if [ " ${LIMA_CIDATA_CONTAINERD_USER} " = 1 ]; then
45
- if ! command -v newuidmap > /dev/null 2>&1 ; then
46
- apt-get install -y uidmap fuse3 dbus-user-session
47
- fi
30
+ if [ " ${LIMA_CIDATA_CONTAINERD_USER} " = 1 ] && ! command -v newuidmap > /dev/null 2>&1 ; then
31
+ pkgs=" ${pkgs} uidmap fuse3 dbus-user-session"
32
+ fi
33
+ if [ -n " ${pkgs} " ]; then
34
+ DEBIAN_FRONTEND=noninteractive
35
+ export DEBIAN_FRONTEND
36
+ apt-get update
37
+ # shellcheck disable=SC2086
38
+ apt-get install -y --no-upgrade --no-install-recommends -q ${pkgs}
48
39
fi
49
40
elif command -v dnf > /dev/null 2>&1 ; then
41
+ pkgs=" "
50
42
if ! command -v tar > /dev/null 2>&1 ; then
51
- dnf_install -y tar
43
+ pkgs= " ${pkgs} tar"
52
44
fi
53
- if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ]; then
54
- if ! command -v sshfs > /dev/null 2>&1 ; then
55
- if grep -q " release 8" /etc/system-release && grep -qv " ^Oracle" /etc/system-release; then
56
- dnf_install --enablerepo powertools -y fuse-sshfs
57
- else
58
- dnf_install -y fuse-sshfs
59
- fi
60
- fi
45
+ if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ] && ! command -v sshfs > /dev/null 2>&1 ; then
46
+ pkgs=" ${pkgs} fuse-sshfs"
61
47
fi
62
- if [ " ${INSTALL_IPTABLES} " = 1 ]; then
63
- if [ ! -e /usr/sbin/iptables ]; then
64
- dnf_install -y iptables
65
- fi
48
+ if [ " ${INSTALL_IPTABLES} " = 1 ] && [ ! -e /usr/sbin/iptables ]; then
49
+ pkgs=" ${pkgs} iptables"
66
50
fi
67
51
if [ " ${LIMA_CIDATA_CONTAINERD_USER} " = 1 ]; then
68
52
if ! command -v newuidmap > /dev/null 2>&1 ; then
69
- dnf_install -y shadow-utils
53
+ pkgs= " ${pkgs} shadow-utils"
70
54
fi
71
55
if ! command -v mount.fuse3 > /dev/null 2>&1 ; then
72
- dnf_install -y fuse3
56
+ pkgs= " ${pkgs} fuse3"
73
57
fi
74
- if [ ! -e /usr/bin/fusermount ]; then
75
- # Workaround for https://github.com/containerd/stargz-snapshotter/issues/340
76
- ln -s fusermount3 /usr/bin/fusermount
58
+ fi
59
+ if [ -n " ${pkgs} " ]; then
60
+ dnf_install_flags=" -y --setopt=install_weak_deps=False"
61
+ if grep -q " Oracle Linux Server release 8" /etc/system-release; then
62
+ dnf_install_flags=" ${dnf_install_flags} --enablerepo ol8_baseos_latest --enablerepo ol8_codeready_builder"
63
+ elif grep -q " release 8" /etc/system-release; then
64
+ dnf_install_flags=" ${dnf_install_flags} --enablerepo powertools"
77
65
fi
66
+ # shellcheck disable=SC2086
67
+ dnf install ${dnf_install_flags} ${pkgs}
68
+ fi
69
+ if [ " ${LIMA_CIDATA_CONTAINERD_USER} " = 1 ] && [ ! -e /usr/bin/fusermount ]; then
70
+ # Workaround for https://github.com/containerd/stargz-snapshotter/issues/340
71
+ ln -s fusermount3 /usr/bin/fusermount
78
72
fi
79
73
elif command -v pacman > /dev/null 2>&1 ; then
80
- if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ]; then
81
- if ! command -v sshfs > /dev/null 2>&1 ; then
82
- pacman -Sy --noconfirm sshfs
83
- fi
74
+ pkgs=" "
75
+ if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ] && ! command -v sshfs > /dev/null 2>&1 ; then
76
+ pkgs=" ${pkgs} sshfs"
77
+ fi
78
+ # other dependencies are preinstalled on Arch Linux
79
+ if [ -n " ${pkgs} " ]; then
80
+ # shellcheck disable=SC2086
81
+ pacman -Sy --noconfirm ${pkgs}
84
82
fi
85
- # other dependencies are preinstalled on Arch Linux (https://linuximages.de/openstack/arch/)
86
83
elif command -v zypper > /dev/null 2>&1 ; then
87
- if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ]; then
88
- if ! command -v sshfs > /dev/null 2>&1 ; then
89
- zypper install -y sshfs
90
- fi
84
+ pkgs=" "
85
+ if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ] && ! command -v sshfs > /dev/null 2>&1 ; then
86
+ pkgs=" ${pkgs} sshfs"
91
87
fi
92
- if [ " ${INSTALL_IPTABLES} " = 1 ]; then
93
- if [ ! -e /usr/sbin/iptables ]; then
94
- zypper install -y iptables
95
- fi
88
+ if [ " ${INSTALL_IPTABLES} " = 1 ] && [ ! -e /usr/sbin/iptables ]; then
89
+ pkgs=" ${pkgs} iptables"
96
90
fi
97
- if [ " ${LIMA_CIDATA_CONTAINERD_USER} " = 1 ]; then
98
- if ! command -v mount.fuse3 > /dev/null 2>&1 ; then
99
- zypper install -y fuse3
100
- fi
91
+ if [ " ${LIMA_CIDATA_CONTAINERD_USER} " = 1 ] && ! command -v mount.fuse3 > /dev/null 2>&1 ; then
92
+ pkgs=" ${pkgs} fuse3"
93
+ fi
94
+ if [ -n " ${pkgs} " ]; then
95
+ # shellcheck disable=SC2086
96
+ zypper --non-interactive install -y --no-recommends ${pkgs}
101
97
fi
102
98
elif command -v apk > /dev/null 2>&1 ; then
103
- if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ]; then
104
- if ! command -v sshfs > /dev/null 2>&1 ; then
105
- apk update
106
- apk add sshfs
107
- fi
99
+ pkgs=" "
100
+ if [ " ${LIMA_CIDATA_MOUNTS} " -gt 0 ] && ! command -v sshfs > /dev/null 2>&1 ; then
101
+ pkgs=" ${pkgs} sshfs"
108
102
fi
109
- if [ " ${INSTALL_IPTABLES} " = 1 ]; then
110
- if ! command -v iptables > /dev/null 2>&1 ; then
111
- apk update
112
- apk add iptables
113
- fi
103
+ if [ " ${INSTALL_IPTABLES} " = 1 ] && ! command -v iptables > /dev/null 2>&1 ; then
104
+ pkgs=" ${pkgs} iptables"
105
+ fi
106
+ if [ -n " ${pkgs} " ]; then
107
+ apk update
108
+ # shellcheck disable=SC2086
109
+ apk add ${pkgs}
114
110
fi
115
111
fi
116
112
0 commit comments