@@ -4,18 +4,14 @@ use serde::{Deserialize, Serialize};
4
4
use simplelog:: * ;
5
5
use std:: {
6
6
fmt:: { self , Display } ,
7
- fs, io ,
7
+ fs,
8
8
path:: PathBuf ,
9
- process:: { Command , Stdio } ,
10
9
str:: FromStr ,
11
10
sync:: Arc ,
12
11
} ;
13
12
use tokio:: sync:: RwLock ;
14
13
use toml_edit:: { value, DocumentMut } ;
15
14
16
- // module name for logging engine
17
- const NAME : & str = "<i><bright-black> config: </>" ;
18
-
19
15
pub type SharedConfig = Arc < RwLock < AppConfig > > ;
20
16
21
17
#[ derive(
@@ -185,34 +181,6 @@ impl Default for AppConfig {
185
181
}
186
182
}
187
183
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
-
216
184
impl AppConfig {
217
185
pub fn load ( config_file : PathBuf ) -> Result < Self , Box < dyn std:: error:: Error > > {
218
186
use :: config:: File ;
@@ -280,13 +248,6 @@ impl AppConfig {
280
248
doc[ "ev_connector_types" ] = value ( ev_connector_types) ;
281
249
}
282
250
283
- let _ = remount_root ( false ) ;
284
- info ! (
285
- "{} Saving new configuration to file: {}" ,
286
- NAME ,
287
- config_file. display( )
288
- ) ;
289
251
let _ = fs:: write ( config_file, doc. to_string ( ) ) ;
290
- let _ = remount_root ( true ) ;
291
252
}
292
253
}
0 commit comments