summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-03-01 21:41:22 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-03-02 09:59:03 +0000
commit7be6795c631d310a4811a297d1f5d1bc648fe8d7 (patch)
treede3a49b4d701cf103bef7621fed935c74e030cab
parent0b0956f82093d8b661313ed22291611b909ecbc6 (diff)
downloadvyos-build-7be6795c631d310a4811a297d1f5d1bc648fe8d7.tar.gz
vyos-build-7be6795c631d310a4811a297d1f5d1bc648fe8d7.zip
T3664: remove leading whitespaces from generated /usr/lib/os-release
(cherry picked from commit 195c13022de0b022e054347f0170fb536f4e9b9b)
-rwxr-xr-xscripts/build-vyos-image30
1 files changed, 16 insertions, 14 deletions
diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image
index 0ec77bde..3d6238a4 100755
--- a/scripts/build-vyos-image
+++ b/scripts/build-vyos-image
@@ -31,13 +31,12 @@ import functools
import json
-
try:
import toml
import jinja2
import git
except ModuleNotFoundError as e:
- print("Cannot load a required library: {}".format(e))
+ print(f"Cannot load a required library: {e}")
print("Please make sure the following Python3 modules are installed: toml jinja2 git")
import vyos_build_utils as utils
@@ -318,16 +317,19 @@ if __name__ == "__main__":
'build_comment': build_config['build_comment']
}
+ # Multi line strings needs to be un-indented to not have leading
+ # whitespaces in the resulting file
os_release = f"""
- PRETTY_NAME="VyOS {version} ({build_config['release_train']})"
- NAME="VyOS"
- VERSION_ID="{version}"
- VERSION="{version} ({build_config['release_train']})"
- VERSION_CODENAME={build_defaults['debian_distribution']}
- ID=vyos
- HOME_URL="{build_defaults['website_url']}"
- SUPPORT_URL="{build_defaults['support_url']}"
- BUG_REPORT_URL="{build_defaults['bugtracker_url']}"
+PRETTY_NAME="VyOS {version} ({build_config['release_train']})"
+NAME="VyOS"
+VERSION_ID="{version}"
+VERSION="{version} ({build_config['release_train']})"
+VERSION_CODENAME={build_defaults['debian_distribution']}
+ID=vyos
+BUILD_ID="{build_git}"
+HOME_URL="{build_defaults['website_url']}"
+SUPPORT_URL="{build_defaults['support_url']}"
+BUG_REPORT_URL="{build_defaults['bugtracker_url']}"
"""
# Switch to the build directory, this is crucial for the live-build work
@@ -353,7 +355,7 @@ if __name__ == "__main__":
# Define variables that influence to welcome message on boot
os.makedirs(os.path.join(chroot_includes_dir, 'usr/lib/'), exist_ok=True)
- with open(os.path.join(chroot_includes_dir, 'usr/lib//os-release'), 'w') as f:
+ with open(os.path.join(chroot_includes_dir, 'usr/lib/os-release'), 'w') as f:
print(os_release, file=f)
@@ -371,12 +373,12 @@ if __name__ == "__main__":
# Add the additional repositories to package lists
print("I: Setting up additional APT entries")
- vyos_repo_entry = "deb {0} {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch'])
+ vyos_repo_entry = "deb {vyos_mirror} {vyos_branch} main\n".format(**build_config)
apt_file = defaults.VYOS_REPO_FILE
if debug:
- print("D: Adding these entries to {0}:".format(apt_file))
+ print(f"D: Adding these entries to {apt_file}:")
print("\t", vyos_repo_entry)
with open(apt_file, 'w') as f: