summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-03-01 21:41:22 +0100
committerChristian Breunig <christian@breunig.cc>2024-03-01 21:43:55 +0100
commit195c13022de0b022e054347f0170fb536f4e9b9b (patch)
tree0eb513f5f1d92fe9e0ea6466250756520ff7d530
parent8a49912cee67c916533fc8fceed76c94941cb2e5 (diff)
downloadvyos-build-195c13022de0b022e054347f0170fb536f4e9b9b.tar.gz
vyos-build-195c13022de0b022e054347f0170fb536f4e9b9b.zip
T3664: remove leading whitespaces from generated /usr/lib/os-release
-rwxr-xr-xscripts/build-vyos-image31
1 files changed, 16 insertions, 15 deletions
diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image
index ed00175..04b63a0 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
@@ -331,16 +330,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
@@ -369,7 +371,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)
## Clean up earlier build state and artifacts
@@ -386,12 +388,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:
@@ -514,4 +516,3 @@ Pin-Priority: 600
# Copy the image
shutil.copy("live-image-{0}.hybrid.iso".format(build_config["architecture"]),
"vyos-{0}-{1}.iso".format(version_data["version"], build_config["architecture"]))
-