forked from hetzneronline/installimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imageinfo.functions.sh
54 lines (45 loc) · 1.39 KB
/
imageinfo.functions.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
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
#
# imageinfo functions
#
# (c) 2019-2022, Hetzner Online GmbH
#
debian_buster_image() {
[[ "${IAM,,}" == 'debian' ]] || return 1
( ((IMG_VERSION >= 100)) && ((IMG_VERSION <= 109)) ) || ( ((IMG_VERSION >= 1010)) && ((IMG_VERSION < 1100)) )
}
debian_bullseye_image() {
[[ "${IAM,,}" == 'debian' ]] || return 1
((IMG_VERSION >= 1100)) && ((IMG_VERSION <= 1200))
}
other_image() {
local image="$1"
while read other_image; do
[[ "${image##*/}" == "$other_image" ]] && return 0
done < <(other_images)
return 1
}
old_image() {
local image="$1"
image="$(readlink -f "$image")"
[[ -e "$image" ]] || return 1
[[ "${image%/*}" == "$(readlink -f "$OLDIMAGESPATH")" ]]
}
rhel_9_based_image() {
[[ "$IAM" == 'centos' ]] && ((IMG_VERSION >= 90)) && ((IMG_VERSION != 610)) && return
[[ "$IAM" == 'rockylinux' ]] && ((IMG_VERSION >= 90)) && return
[[ "$IAM" == 'rhel' ]] && ((IMG_VERSION >= 90)) && return
[[ "$IAM" == 'almalinux' ]] && ((IMG_VERSION >= 90)) && return
return 1
}
uses_network_manager() {
[[ "$IAM" == 'centos' ]] && ((IMG_VERSION >= 80)) && ((IMG_VERSION != 610)) && ! is_cpanel_install && return
[[ "$IAM" == 'rockylinux' ]] && return
[[ "$IAM" == 'rhel' ]] && return
[[ "$IAM" == 'almalinux' ]] && ! is_cpanel_install && return
return 1
}
debian_based_image() {
[[ "$IAM" == 'debian' ]] || [[ "$IAM" == 'ubuntu' ]]
}
# vim: ai:ts=2:sw=2:et