34
34
"adobe_reader.*" ,
35
35
"amsn.*" ,
36
36
"amule.*" ,
37
- "apt.*" ,
38
37
"audacious.*" ,
39
38
"bash.*" ,
40
39
"beagle.*" ,
66
65
# "firefox.cookies",
67
66
"firefox.crash_reports" ,
68
67
"firefox.dom" ,
69
- "firefox.download_history" ,
68
+ # "firefox.download_history",
70
69
"firefox.forms" ,
71
70
# "firefox.passwords",
72
71
"firefox.session_restore" ,
140
139
"yum.*"
141
140
]
142
141
142
+ BLEACHBIT_ROOT : tp .List [str ] = [
143
+ "apt.*" ,
144
+ ]
145
+
143
146
BLEACHBIT_DEEP : tp .List [str ] = [
144
147
"deepscan.backup" ,
145
148
"deepscan.ds_store" ,
@@ -193,9 +196,13 @@ def bleachbit(deep: bool = False, firefox: bool = False, thunderbird: bool = Fal
193
196
args += BLEACHBIT_FIREFOX
194
197
if thunderbird :
195
198
args += BLEACHBIT_THUNDERBIRD
196
- # Bleachbit does not run with the run() function for some reason
199
+ # Bleachbit does not run with the run() function for some reason.
200
+ # Run both as root and as the current user.
197
201
if os .geteuid () != 0 :
198
- args .insert (0 , "sudo" )
202
+ args2 = ["sudo" , * args , * BLEACHBIT_ROOT ]
203
+ sp .run (args2 , check = True )
204
+ else :
205
+ args += BLEACHBIT_ROOT
199
206
sp .run (args , check = True )
200
207
201
208
@@ -358,6 +365,7 @@ def zgen() -> None:
358
365
359
366
def main ():
360
367
parser = argparse .ArgumentParser (description = "Maintenance script" )
368
+ parser .add_argument ("--bleachbit-only" , help = "Run only Bleachbit" , action = "store_true" )
361
369
parser .add_argument ("--deep" , help = "Deep-clean all" , action = "store_true" )
362
370
parser .add_argument ("--docker" , help = "Deep-clean Docker" , action = "store_true" )
363
371
parser .add_argument ("--firefox" , help = "Deep-clean Firefox" , action = "store_true" )
@@ -376,6 +384,10 @@ def main():
376
384
if args .virtualbox :
377
385
raise NotImplementedError ("VirtualBox support does not work yet." )
378
386
387
+ if args .bleachbit_only :
388
+ bleachbit (deep = args .deep , firefox = (args .deep or args .firefox ), thunderbird = (args .deep or args .thunderbird ))
389
+ return
390
+
379
391
zero = get_zerofree_status (args )
380
392
381
393
print_info ("Running maintenance script" )
0 commit comments