3434 "adobe_reader.*" ,
3535 "amsn.*" ,
3636 "amule.*" ,
37- "apt.*" ,
3837 "audacious.*" ,
3938 "bash.*" ,
4039 "beagle.*" ,
6665 # "firefox.cookies",
6766 "firefox.crash_reports" ,
6867 "firefox.dom" ,
69- "firefox.download_history" ,
68+ # "firefox.download_history",
7069 "firefox.forms" ,
7170 # "firefox.passwords",
7271 "firefox.session_restore" ,
140139 "yum.*"
141140]
142141
142+ BLEACHBIT_ROOT : tp .List [str ] = [
143+ "apt.*" ,
144+ ]
145+
143146BLEACHBIT_DEEP : tp .List [str ] = [
144147 "deepscan.backup" ,
145148 "deepscan.ds_store" ,
@@ -193,9 +196,13 @@ def bleachbit(deep: bool = False, firefox: bool = False, thunderbird: bool = Fal
193196 args += BLEACHBIT_FIREFOX
194197 if thunderbird :
195198 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.
197201 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
199206 sp .run (args , check = True )
200207
201208
@@ -358,6 +365,7 @@ def zgen() -> None:
358365
359366def main ():
360367 parser = argparse .ArgumentParser (description = "Maintenance script" )
368+ parser .add_argument ("--bleachbit-only" , help = "Run only Bleachbit" , action = "store_true" )
361369 parser .add_argument ("--deep" , help = "Deep-clean all" , action = "store_true" )
362370 parser .add_argument ("--docker" , help = "Deep-clean Docker" , action = "store_true" )
363371 parser .add_argument ("--firefox" , help = "Deep-clean Firefox" , action = "store_true" )
@@ -376,6 +384,10 @@ def main():
376384 if args .virtualbox :
377385 raise NotImplementedError ("VirtualBox support does not work yet." )
378386
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+
379391 zero = get_zerofree_status (args )
380392
381393 print_info ("Running maintenance script" )
0 commit comments