diff --git a/content/docs/latest/installing/cloud/azure.md b/content/docs/latest/installing/cloud/azure.md index 1fdf9132..d9137c1b 100644 --- a/content/docs/latest/installing/cloud/azure.md +++ b/content/docs/latest/installing/cloud/azure.md @@ -558,7 +558,7 @@ resource_group_location = "westeurope" You can resolve the latest Flatcar Stable version with this shell command: ``` -curl -sSfL https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt | grep -m 1 FLATCAR_VERSION_ID= | cut -d = -f 2 +(source <(curl -sSfL https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt); echo "${FLATCAR_VERSION_ID}") ``` The machine name listed in the `machines` variable is used to retrieve the corresponding [Container Linux Config](../../provisioning/config-transpiler/configuration) template from the `cl/` subfolder. diff --git a/content/docs/latest/installing/cloud/digitalocean.md b/content/docs/latest/installing/cloud/digitalocean.md index 2fac9ed2..547813ea 100644 --- a/content/docs/latest/installing/cloud/digitalocean.md +++ b/content/docs/latest/installing/cloud/digitalocean.md @@ -127,7 +127,7 @@ read SSH_KEY_ID If not done yet, [create a custom image](https://developers.digitalocean.com/documentation/v2/#create-a-custom-image) from the current Flatcar Container Linux Stable version: ```shell -VER=$(curl https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt | grep -m 1 FLATCAR_VERSION_ID= | cut -d = -f 2) +VER=$(source <(curl https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt); echo "${FLATCAR_VERSION_ID}") curl --request POST "https://api.digitalocean.com/v2/images" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer $TOKEN" \ @@ -339,7 +339,7 @@ flatcar_stable_version = "x.y.z" You can resolve the latest Flatcar Stable version with this shell command: ```shell -curl -sSfL https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt | grep -m 1 FLATCAR_VERSION_ID= | cut -d = -f 2 +(source <(curl -sSfL https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt); echo "${FLATCAR_VERSION_ID}") ``` The machine name listed in the `machines` variable is used to retrieve the corresponding [Butane Config](https://www.flatcar.org/docs/latest/provisioning/config-transpiler/configuration/). diff --git a/content/docs/latest/migrating-from-coreos/update-from-container-linux.md b/content/docs/latest/migrating-from-coreos/update-from-container-linux.md index 6a0a92ff..daf714db 100644 --- a/content/docs/latest/migrating-from-coreos/update-from-container-linux.md +++ b/content/docs/latest/migrating-from-coreos/update-from-container-linux.md @@ -29,7 +29,7 @@ core@host ~ $ sudo systemctl reboot If it fails due to SSL connection issues from outdated certificates, you can also download the update payload of the latest Stable release through plain HTTP and use the `flatcar-update` script instead: ```shell -$ VER=$(curl -fsSL --insecure --ssl-no-revoke http://stable.release.flatcar-linux.net/amd64-usr/current/version.txt | grep FLATCAR_VERSION= | cut -d = -f 2) +$ VER=$(source <(curl -fsSL --insecure --ssl-no-revoke http://stable.release.flatcar-linux.net/amd64-usr/current/version.txt); echo "${FLATCAR_VERSION}") $ wget --no-check-certificate "http://update.release.flatcar-linux.net/amd64-usr/$VER/flatcar_production_update.gz" $ wget --no-check-certificate http://raw.githubusercontent.com/flatcar/init/flatcar-master/bin/flatcar-update $ less flatcar-update # Double check the content of the script diff --git a/content/docs/latest/reference/developer-guides/sdk-tips-and-tricks.md b/content/docs/latest/reference/developer-guides/sdk-tips-and-tricks.md index 8a88fef3..4311d162 100644 --- a/content/docs/latest/reference/developer-guides/sdk-tips-and-tricks.md +++ b/content/docs/latest/reference/developer-guides/sdk-tips-and-tricks.md @@ -218,7 +218,7 @@ In some cases such a file can pin an exact version of a specific package, which Some packages like `coreos-modules` take a long time to build. Use: ```shell -./build_packages --getbinpkgver=$(gsutil cat gs://…/boards/amd64-usr/current-master/version.txt |& sed -n 's/^FLATCAR_VERSION=//p') +./build_packages --getbinpkgver=$(source <(gsutil cat gs://…/boards/amd64-usr/current-master/version.txt); echo "${FLATCAR_VERSION}") ``` to use packages from the another build store. diff --git a/content/docs/latest/setup/releases/switching-channels.md b/content/docs/latest/setup/releases/switching-channels.md index 47a82982..6e8c5aa2 100644 --- a/content/docs/latest/setup/releases/switching-channels.md +++ b/content/docs/latest/setup/releases/switching-channels.md @@ -89,7 +89,7 @@ $ # In case another channel is set as GROUP, first remove it so that in the futu $ sudo sed -i "/GROUP=.*/d" /etc/flatcar/update.conf $ # Set the channel you want to jump to: $ CHANNEL=beta -$ VER=$(curl -fsSL "https://$CHANNEL.release.flatcar-linux.net/amd64-usr/current/version.txt" | grep FLATCAR_VERSION= | cut -d = -f 2) +$ VER=$(source <(curl -fsSL "https://$CHANNEL.release.flatcar-linux.net/amd64-usr/current/version.txt"); echo "${FLATCAR_VERSION}") $ sudo flatcar-update --to-version "$VER" ``` diff --git a/content/docs/latest/setup/releases/update-strategies.md b/content/docs/latest/setup/releases/update-strategies.md index f4466753..11518bef 100644 --- a/content/docs/latest/setup/releases/update-strategies.md +++ b/content/docs/latest/setup/releases/update-strategies.md @@ -189,7 +189,7 @@ The `flatcar-update` tool automatically removes the `SERVER=disabled` line to ap ```shell $ # For example, update to the latest Stable release: -$ VER=$(curl -fsSL https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt | grep FLATCAR_VERSION= | cut -d = -f 2) +$ VER=$(source <(curl -fsSL https://stable.release.flatcar-linux.net/amd64-usr/current/version.txt); echo "${FLATCAR_VERSION}") $ sudo flatcar-update --to-version $VER ``` @@ -236,7 +236,7 @@ On the non-airgapped machine (here for amd64, use `ARCH=arm64` for arm64): ```shell ARCH=amd64 -VER=$(curl -fsSL https://stable.release.flatcar-linux.net/${ARCH}-usr/current/version.txt | grep FLATCAR_VERSION= | cut -d = -f 2) +VER=$(source <(curl -fsSL "https://stable.release.flatcar-linux.net/${ARCH}-usr/current/version.txt"; echo "${FLATCAR_VERSION}") echo "$VER" # or if you know which version to update to, set it like VER=3033.2.1 (no channel info needed) wget "https://update.release.flatcar-linux.net/${ARCH}-usr/${VER}/flatcar_production_update.gz" diff --git a/tools/fcl-fetch-version-data.py b/tools/fcl-fetch-version-data.py index 8ac4ebf2..20f9e7ec 100755 --- a/tools/fcl-fetch-version-data.py +++ b/tools/fcl-fetch-version-data.py @@ -13,8 +13,8 @@ import glob import json -import re import sys +import shlex import urllib.request import yaml @@ -27,9 +27,14 @@ def latestVersion(channel = 'stable', board = 'amd64-usr'): url = 'https://%s.release.flatcar-linux.net/%s/current/version.txt' % (channel, board) try: versionTxt = fetch(url) - match = re.findall('FLATCAR_VERSION=(.*)', versionTxt) - if len(match) > 0: - return match[0] + s = shlex.shlex(versionTxt, posix = True, punctuation_chars = '=') + s.whitespace_split = True + for item in s: + if item == 'FLATCAR_VERSION': + items = list(s) + if len(items) < 2 or items[0] != '=': + raise 'malformed version.txt' + return items[1] except: return 'unreleased'