11
11
RPM_DIR = "workstation"
12
12
13
13
14
- def verify_sig_rpm (path ):
14
+ def check_unsigned_rpm (path ):
15
+ subprocess .check_call (["rpm" , "--delsign" , path ])
16
+ subprocess .check_call (["sha256sum" , path ])
17
+
18
+
19
+ def check_unsigned_all_rpms ():
20
+ for root , dirs , files in os .walk (RPM_DIR ):
21
+ for name in files :
22
+ check_unsigned_rpm (os .path .join (root , name ))
23
+
15
24
25
+ def verify_sig_rpm (path ):
16
26
for key_path in [PROD_SIGNING_KEY_PATH , PROD_SIGNING_KEY_PATH_LEGACY ]:
17
27
try :
18
28
subprocess .check_call (["rpmkeys" , "--import" , key_path ])
@@ -63,6 +73,7 @@ def fail(msg):
63
73
64
74
def main ():
65
75
parser = argparse .ArgumentParser (description = __doc__ )
76
+ parser .add_argument ("--check-unsigned" , action = "store_true" , default = False )
66
77
parser .add_argument ("--verify" , action = "store_true" , default = True )
67
78
parser .add_argument ("--all" , action = "store_true" , default = False )
68
79
parser .add_argument ("packages" , type = str , nargs = "*" , help = "Files to sign/verify" )
@@ -74,7 +85,16 @@ def main():
74
85
# Since we can't specify with which key to check sigs, we should clear the keyring
75
86
remove_keys_in_rpm_keyring ()
76
87
77
- if args .verify :
88
+ if args .check_unsigned :
89
+ output = subprocess .check_call (["rpm" , "--version" ])
90
+ if args .all :
91
+ check_unsigned_all_rpms ()
92
+ else :
93
+ for package in args .packages :
94
+ assert os .path .exists (package )
95
+ check_unsigned_rpm (package )
96
+
97
+ elif args .verify :
78
98
if args .all :
79
99
verify_all_rpms ()
80
100
else :
0 commit comments