File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 5
5
import tomllib
6
6
import argparse
7
7
8
+
8
9
from ublue_update .update_checks .system import system_update_check
10
+ from ublue_update .update_checks .wait import transaction_wait
9
11
10
12
11
13
def notify (title : str , body : str , actions : list = [], expire_time : int = 0 ):
@@ -153,6 +155,9 @@ def run_updates():
153
155
154
156
log .info ("Running system update" )
155
157
158
+ """Wait on any existing transactions to complete before updating"""
159
+ transaction_wait ()
160
+
156
161
for root , dirs , files in os .walk (root_dir ):
157
162
for file in files :
158
163
full_path = root_dir + str (file )
@@ -214,9 +219,19 @@ def main():
214
219
action = "store_true" ,
215
220
help = "check for updates and exit" ,
216
221
)
222
+ parser .add_argument (
223
+ "-w" ,
224
+ "--wait" ,
225
+ action = "store_true" ,
226
+ help = "wait for transactions to complete and exit" ,
227
+ )
217
228
args = parser .parse_args ()
218
229
hardware_checks_failed = False
219
230
231
+ if args .wait :
232
+ transaction_wait ()
233
+ os ._exit (0 )
234
+
220
235
if not args .force and not args .updatecheck :
221
236
hardware_checks_failed , failures = check_hardware_inhibitors ()
222
237
if hardware_checks_failed :
Original file line number Diff line number Diff line change
1
+ from json import loads
2
+ from subprocess import PIPE , run
3
+ from time import sleep
4
+
5
+
6
+ def transaction ():
7
+ """Pull deployment status via rpm-ostree"""
8
+ rpm_ostree_status = ["rpm-ostree" , "status" , "--json" ]
9
+ status = run (rpm_ostree_status , stdout = PIPE )
10
+ """Parse transaction state"""
11
+ return loads (status .stdout )["transaction" ]
12
+
13
+
14
+ def transaction_wait ():
15
+ while transaction () is not None :
16
+ sleep (1 )
You can’t perform that action at this time.
0 commit comments