Skip to content

Commit 5c0d7b8

Browse files
committed
Ship the tmp keyring bootstrap .repo file enabled and remove it when bootstrap is complete
1 parent c8a9ccf commit 5c0d7b8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scripts/bootstrap-keyring.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def create_repo_file(env: str, repo_file_path: str, ver: str):
2525
"""Create .repo file based on environment."""
2626
repo_content = f"""
2727
[{KEYRING_PACKAGENAME}-{env}]
28-
enabled=0
28+
enabled=1
2929
gpgcheck=1
3030
baseurl={BASEURL}/workstation/dom0/f{ver}{'-nightlies' if env == 'dev' else ''}
3131
name=SecureDrop Workstation Keyring ({env})
@@ -52,9 +52,8 @@ def dom0_install_keyring(env: str | None = None):
5252
"""Use qubes-dom0-update to install keyring package."""
5353
args = ["sudo", "qubes-dom0-update", "-y"]
5454

55-
if env:
55+
if env: # noqa: SIM108
5656
package_name = f"{KEYRING_PACKAGENAME}-{env}"
57-
args.append(f"--enablerepo={package_name}")
5857
else:
5958
package_name = KEYRING_PACKAGENAME
6059
args.append(package_name)
@@ -87,7 +86,7 @@ def main():
8786
repo_file_path = Path(temp_dir) / f"{KEYRING_PACKAGENAME}-{args.env}.repo"
8887

8988
create_repo_file(args.env, repo_file_path, fedora_version)
90-
repo_dest_path = Path(YUM_REPOS_DIR) / f"{KEYRING_PACKAGENAME}-{args.env}.repo"
89+
repo_dest_path = Path(YUM_REPOS_DIR) / f"{KEYRING_PACKAGENAME}-{args.env}-tmp.repo"
9190
subprocess.check_call(
9291
["sudo", "install", "-m", "0644", str(repo_file_path), str(repo_dest_path)]
9392
)
@@ -103,12 +102,16 @@ def main():
103102
print(f"Key {TEST_KEY_RPMID} ({TEST_KEY_FILENAME}) not found in rpm db.")
104103
sys.exit(1)
105104

106-
dom0_install_keyring(args.env)
105+
# Install environment-specific keyring
106+
dom0_install_keyring(env=args.env)
107107

108108
# Install prod keyring hosted in yum-test to satisfy dom0 config dependency.
109109
# When the prod keyring reaches Qubes-Contrib, this can be removed.
110110
dom0_install_keyring()
111111

112+
# Remove .repo file
113+
subprocess.check_call(["sudo", "rm", str(repo_dest_path)])
114+
112115

113116
if __name__ == "__main__":
114117
main()

0 commit comments

Comments
 (0)