@@ -24,9 +24,9 @@ under certain conditions; for details see https://www.gnu.org/licenses/gpl-3.0.h
24
24
25
25
/// validates if user has root priviliges. Terminates the program otherwise.
26
26
pub fn validate_root_priviliges ( ) {
27
- if unsafe { libc:: getuid ( ) } ! = 0 {
28
- eprintln ! ( "{}" , "This program requires root privileges. Please run with sudo using your current user.\n Example: sudo ./gnulinwiz" . red( ) ) ;
29
- // exits if not root
27
+ if unsafe { libc:: getuid ( ) } = = 0 {
28
+ eprintln ! ( "{}" , "this program is not recommended to run with root privileges. please run it with your current user.\n example: ./gnulinwiz" . red( ) ) ;
29
+ // exits if root
30
30
exit ( 1 ) ;
31
31
}
32
32
} // validate_root_priviliges()
@@ -35,39 +35,39 @@ pub fn validate_root_priviliges() {
35
35
pub fn print_setup_status_success ( ) {
36
36
println ! (
37
37
"{}" ,
38
- "All set! Your GNU/Linux system is ready to use!" . green( )
38
+ "all set! your gnu/linux system is ready to use!" . green( )
39
39
) ;
40
40
} // print_setup_status_success()
41
41
42
42
/// prints red-colored failure message if set up unseccessfully
43
43
pub fn print_setup_status_failed ( ) {
44
44
println ! (
45
45
"{}" ,
46
- "Something went wrong... Please fix the reported problems and re-run the program." . red( )
46
+ "something went wrong... please fix the reported problems and re-run the program." . red( )
47
47
) ;
48
48
} // print_setup_status_failed()
49
49
50
50
/// checks wether user wants to use default installation list or to enter a custom one
51
51
pub fn check_sw_install_type ( ) -> bool {
52
52
println ! (
53
53
"{}" ,
54
- "Enter 0 for the default list of software or 1 to enter a custom list:" . yellow( )
54
+ "enter any number for the default list of software or 0 to enter a custom list:" . yellow( )
55
55
) ;
56
56
57
57
let input = read_input ( ) . trim ( ) . to_string ( ) ;
58
58
59
59
match input. parse :: < i8 > ( ) {
60
- Ok ( value) if value == 1 => {
61
- println ! ( "{}" , "You chose to enter a custom list." . green( ) ) ;
60
+ Ok ( value) if value == 0 => {
61
+ println ! ( "{}" , "you chose to enter a custom list. \n installation takes a few minutes, please wait.. ." . green( ) ) ;
62
62
true
63
63
}
64
64
Ok ( _) => {
65
- println ! ( "{}" , "You chose to use the default list." . green( ) ) ;
65
+ println ! ( "{}" , "you chose to use the default list. \n installation takes a few minutes, please wait.. ." . green( ) ) ;
66
66
false
67
67
}
68
68
Err ( _) => {
69
- handle_error ( "Please enter a valid number (0 or 1)." ) ;
70
- false // Return false in case of error, or you can choose to exit
69
+ handle_error ( "please enter a valid number (0 or 1)." ) ;
70
+ false
71
71
}
72
72
}
73
73
} // check_sw_install_type
@@ -76,15 +76,15 @@ pub fn check_sw_install_type() -> bool {
76
76
fn read_input ( ) -> String {
77
77
let mut input = String :: new ( ) ;
78
78
if let Err ( error) = stdin ( ) . read_line ( & mut input) {
79
- handle_error ( & format ! ( "{}{}" , "Error reading input:" . red( ) , error) ) ;
79
+ handle_error ( & format ! ( "{}{}" , "error reading input:" . red( ) , error) ) ;
80
80
exit ( 1 ) ;
81
81
}
82
82
input
83
83
} // read_input
84
84
85
85
/// Handles errors by printing the error message and performing any necessary cleanup.
86
86
fn handle_error ( message : & str ) {
87
- eprintln ! ( "{}{}" , "Error : " . red( ) , message) ;
87
+ eprintln ! ( "{}{}" , "error : " . red( ) , message) ;
88
88
print_setup_status_failed ( ) ;
89
89
exit ( 1 ) ;
90
90
} // handle_error
@@ -94,10 +94,10 @@ pub fn set_sw_list() -> Vec<String> {
94
94
let mut packages = Vec :: new ( ) ;
95
95
let mut input = String :: new ( ) ;
96
96
97
- println ! ( "Enter the software packages to install (separated by spaces):" ) ;
97
+ println ! ( "enter the software packages to install (separated by spaces):" ) ;
98
98
std:: io:: stdin ( )
99
99
. read_line ( & mut input)
100
- . expect ( "Failed to read line" ) ;
100
+ . expect ( "failed to read line" ) ;
101
101
102
102
packages. extend ( input. trim ( ) . split_whitespace ( ) . map ( String :: from) ) ;
103
103
0 commit comments