File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ tar = "0.4.44"
1616tokio = { version = " 1" , features = [" full" ] }
1717tokio-util = { version = " 0.7" }
1818tokio-stream = { version = " 0.1" , features = [" io-util" , " net" ] }
19- nix = { version = " 0.31" , features = [" sched" ] }
19+ nix = { version = " 0.31" , features = [" sched" , " user " ] }
2020futures = " 0.3"
2121async-trait = " 0.1"
2222clap = { version = " 4.5" , features = [" derive" ] }
Original file line number Diff line number Diff line change @@ -16,8 +16,10 @@ use std::{
1616 fs,
1717 fs:: File ,
1818 path:: { Path , PathBuf } ,
19+ process,
1920} ;
2021use tokio:: task:: JoinHandle ;
22+ use nix:: unistd:: Uid ;
2123
2224static SPARKLE : Emoji = Emoji ( "✨" , "[*]" ) ;
2325
@@ -71,6 +73,11 @@ enum Commands {
7173async fn main ( ) -> Result < ( ) > {
7274 env_logger:: init ( ) ;
7375
76+ if !Uid :: effective ( ) . is_root ( ) {
77+ println ! ( "{}" , style( "This tool must be run as root" ) . red( ) . bold( ) ) ;
78+ process:: exit ( 1 ) ;
79+ }
80+
7481 let cli = Cli :: parse ( ) ;
7582 match cli. command {
7683 Commands :: Preinstall {
You can’t perform that action at this time.
0 commit comments