Skip to content

Commit 9ef2d74

Browse files
committed
fix alpine version check
1 parent 0ca8c82 commit 9ef2d74

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

qbittorrent-nox-static.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ get_os_info() {
9797
#######################################################################################################################################################
9898
# Checks to see if we are on a supported OS and release.
9999
#######################################################################################################################################################
100-
os_id="$(get_os_info ID)" # Get the ID for this OS.
101-
os_version_codename="$(get_os_info VERSION_CODENAME)" # Get the codename for this OS. Note, Alpine does not have a unique codename.
102-
os_version_id="$(get_os_info VERSION_ID)" # Get the version number for this codename, for example: 10, 20.04, 3.12.4
103-
[[ "$(wc -w <<< "${os_version_id//\./ }")" -eq "2" ]] && alpine_min_version="310" # Account for variation in the versioning 3.1 or 3.1.0 to make sure the check works correctly
104-
[[ ${os_id} =~ ^(alpine)$ ]] && os_version_codename="alpine" # If alpine, set the codename to alpine. We check for min v3.10 later with codenames.
100+
os_id="$(get_os_info ID)" # Get the ID for this OS.
101+
os_version_codename="$(get_os_info VERSION_CODENAME)" # Get the codename for this OS. Note, Alpine does not have a unique codename.
102+
os_version_id="$(get_os_info VERSION_ID)" # Get the version number for this codename, for example: 10, 20.04, 3.12.4
103+
[[ ${os_id} =~ ^(alpine)$ ]] && os_version_codename="alpine" # If alpine, set the codename to alpine. We check for min v3.10 later with codenames.
105104

106105
if [[ ${os_id} =~ ^(debian|ubuntu)$ ]]; then
107106
# dpkg --print-architecture give amd64/arm64 and arch gives x86_64/aarch64
@@ -112,13 +111,13 @@ elif [[ ${os_id} =~ ^(alpine)$ ]]; then
112111
fi
113112

114113
# Check against allowed codenames or if the codename is alpine version greater than 3.10
115-
if [[ ! ${os_version_codename} =~ ^(alpine|trixie|noble)$ ]] || [[ ${os_version_codename} =~ ^(alpine)$ && ${os_version_id//\./} -lt ${alpine_min_version:-3150} ]]; then
114+
if [[ ! ${os_version_codename} =~ ^(alpine|trixie|noble)$ ]] || [[ ${os_version_codename} =~ ^(alpine)$ && "$(apk version -t "${os_version_id}" "3.18")" == "<" ]]; then
116115
printf '\n%b\n\n' " ${unicode_red_circle} ${color_yellow} This is not a supported OS. There is no reason to continue.${color_end}"
117116
printf '%b\n\n' " id: ${text_dim}${color_yellow_light}${os_id}${color_end} codename: ${text_dim}${color_yellow_light}${os_version_codename}${color_end} version: ${text_dim}${color_red_light}${os_version_id}${color_end}"
118117
printf '%b\n\n' " ${unicode_yellow_circle} ${text_dim}These are the supported platforms${color_end}"
119118
printf '%b\n' " ${color_magenta_light}Debian${color_end} - ${color_blue_light}trixie${color_end}"
120119
printf '%b\n' " ${color_magenta_light}Ubuntu${color_end} - ${color_blue_light}noble${color_end}"
121-
printf '%b\n\n' " ${color_magenta_light}Alpine${color_end} - ${color_blue_light}3.15.0${color_end} ${text_dim}or greater${color_end}"
120+
printf '%b\n\n' " ${color_magenta_light}Alpine${color_end} - ${color_blue_light}3.18${color_end} ${text_dim}or greater${color_end}"
122121
exit
123122
fi
124123
#######################################################################################################################################################

qbt-nox-static.bash

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ get_os_info() {
101101
#######################################################################################################################################################
102102
# Checks to see if we are on a supported OS and release.
103103
#######################################################################################################################################################
104-
os_id="$(get_os_info ID)" # Get the ID for this OS.
105-
os_version_codename="$(get_os_info VERSION_CODENAME)" # Get the codename for this OS. Note, Alpine does not have a unique codename.
106-
os_version_id="$(get_os_info VERSION_ID)" # Get the version number for this codename, for example: 10, 20.04, 3.12.4
107-
[[ "$(wc -w <<< "${os_version_id//\./ }")" -eq "2" ]] && alpine_min_version="310" # Account for variation in the versioning 3.1 or 3.1.0 to make sure the check works correctly
108-
[[ ${os_id} =~ ^(alpine)$ ]] && os_version_codename="alpine" # If alpine, set the codename to alpine. We check for min v3.10 later with codenames.
104+
os_id="$(get_os_info ID)" # Get the ID for this OS.
105+
os_version_codename="$(get_os_info VERSION_CODENAME)" # Get the codename for this OS. Note, Alpine does not have a unique codename.
106+
os_version_id="$(get_os_info VERSION_ID)" # Get the version number for this codename, for example: 10, 20.04, 3.12.4
107+
[[ ${os_id} =~ ^(alpine)$ ]] && os_version_codename="alpine" # If alpine, set the codename to alpine. We check for min v3.10 later with codenames.
109108

110109
if [[ ${os_id} =~ ^(debian|ubuntu)$ ]]; then
111110
# dpkg --print-architecture give amd64/arm64 and arch gives x86_64/aarch64
@@ -116,13 +115,13 @@ elif [[ ${os_id} =~ ^(alpine)$ ]]; then
116115
fi
117116

118117
# Check against allowed codenames or if the codename is alpine version greater than 3.10
119-
if [[ ! ${os_version_codename} =~ ^(alpine|trixie|noble)$ ]] || [[ ${os_version_codename} =~ ^(alpine)$ && ${os_version_id//\./} -lt ${alpine_min_version:-3150} ]]; then
118+
if [[ ! ${os_version_codename} =~ ^(alpine|trixie|noble)$ ]] || [[ ${os_version_codename} =~ ^(alpine)$ && "$(apk version -t "${os_version_id}" "3.18")" == "<" ]]; then
120119
printf '\n%b\n\n' " ${unicode_red_circle} ${color_yellow} This is not a supported OS. There is no reason to continue.${color_end}"
121120
printf '%b\n\n' " id: ${text_dim}${color_yellow_light}${os_id}${color_end} codename: ${text_dim}${color_yellow_light}${os_version_codename}${color_end} version: ${text_dim}${color_red_light}${os_version_id}${color_end}"
122121
printf '%b\n\n' " ${unicode_yellow_circle} ${text_dim}These are the supported platforms${color_end}"
123122
printf '%b\n' " ${color_magenta_light}Debian${color_end} - ${color_blue_light}trixie${color_end}"
124123
printf '%b\n' " ${color_magenta_light}Ubuntu${color_end} - ${color_blue_light}noble${color_end}"
125-
printf '%b\n\n' " ${color_magenta_light}Alpine${color_end} - ${color_blue_light}3.15.0${color_end} ${text_dim}or greater${color_end}"
124+
printf '%b\n\n' " ${color_magenta_light}Alpine${color_end} - ${color_blue_light}3.18${color_end} ${text_dim}or greater${color_end}"
126125
exit
127126
fi
128127
#######################################################################################################################################################

0 commit comments

Comments
 (0)