@@ -4,18 +4,14 @@ use serde::{Deserialize, Serialize};
44use simplelog:: * ;
55use std:: {
66 fmt:: { self , Display } ,
7- fs, io ,
7+ fs,
88 path:: PathBuf ,
9- process:: { Command , Stdio } ,
109 str:: FromStr ,
1110 sync:: Arc ,
1211} ;
1312use tokio:: sync:: RwLock ;
1413use toml_edit:: { value, DocumentMut } ;
1514
16- // module name for logging engine
17- const NAME : & str = "<i><bright-black> config: </>" ;
18-
1915pub type SharedConfig = Arc < RwLock < AppConfig > > ;
2016
2117#[ derive(
@@ -185,34 +181,6 @@ impl Default for AppConfig {
185181 }
186182}
187183
188- /// Remount `/` as readonly (`lock = true`) or read-write (`lock = false`)
189- fn remount_root ( lock : bool ) -> io:: Result < ( ) > {
190- let mode = if lock { "remount,ro" } else { "remount,rw" } ;
191-
192- let status = Command :: new ( "mount" )
193- . args ( & [ "-o" , mode, "/" ] )
194- . stdout ( Stdio :: null ( ) )
195- . stderr ( Stdio :: null ( ) )
196- . status ( ) ?;
197-
198- if status. success ( ) {
199- info ! (
200- "{} Remount as {} successful" ,
201- NAME ,
202- if lock { "read-only" } else { "read-write" }
203- ) ;
204- } else {
205- error ! (
206- "{} Remount as {} failed: {:?}" ,
207- NAME ,
208- if lock { "read-only" } else { "read-write" } ,
209- status
210- ) ;
211- }
212-
213- Ok ( ( ) )
214- }
215-
216184impl AppConfig {
217185 pub fn load ( config_file : PathBuf ) -> Result < Self , Box < dyn std:: error:: Error > > {
218186 use :: config:: File ;
@@ -280,13 +248,6 @@ impl AppConfig {
280248 doc[ "ev_connector_types" ] = value ( ev_connector_types) ;
281249 }
282250
283- let _ = remount_root ( false ) ;
284- info ! (
285- "{} Saving new configuration to file: {}" ,
286- NAME ,
287- config_file. display( )
288- ) ;
289251 let _ = fs:: write ( config_file, doc. to_string ( ) ) ;
290- let _ = remount_root ( true ) ;
291252 }
292253}
0 commit comments