Skip to content

Commit

Permalink
fix: change version template fn input to float
Browse files Browse the repository at this point in the history
Required to accommodate Ubuntu versions.
  • Loading branch information
femnad committed Dec 17, 2023
1 parent c76e65d commit 950008b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Mostly intended for debugging full provisioning runs.
from debian:bookworm

run echo 'deb http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/backports.list
run apt update -y && apt install -y ca-certificates gnupg2 systemd
run apt install -y -t bookworm-backports golang-1.20-go

copy . /root/fup/
workdir /root/fup
run /usr/lib/go-1.20/bin/go install

cmd ["/bin/systemd"]
2 changes: 1 addition & 1 deletion Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mostly intended for debugging full provisioning runs.
from fedora:39

run dnf update -y && dnf install -y gnupg2 golang systemd
run dnf update -y && dnf install -y ca-certificates gnupg2 golang systemd

copy . /root/fup/
workdir /root/fup
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mostly intended for debugging full provisioning runs.
from ubuntu:mantic

run apt update -y && apt install -y gnupg2 golang systemd
run apt update -y && apt install -y ca-certificates gnupg2 golang systemd

copy . /root/fup/
workdir /root/fup
Expand Down
2 changes: 1 addition & 1 deletion precheck/fact.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func isOs(osId string) (bool, error) {
return foundOsId == osId, nil
}

func isOsVersion(version int) (bool, error) {
func isOsVersion(version float64) (bool, error) {
osVersion, err := GetOSVersion()
if err != nil {
return false, err
Expand Down
6 changes: 3 additions & 3 deletions precheck/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ func GetOSId() (string, error) {
return getOSReleaseField(osIdField)
}

func GetOSVersion() (int, error) {
func GetOSVersion() (float64, error) {
versionStr, err := getOSReleaseField(osVersionField)
if err != nil {
return 0, err
}

version, err := strconv.ParseInt(versionStr, 10, 64)
version, err := strconv.ParseFloat(versionStr, 64)
if err != nil {
return 0, err
}

return int(version), nil
return version, nil
}

0 comments on commit 950008b

Please sign in to comment.