debug fedora
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
		
							parent
							
								
									a5158d2bb7
								
							
						
					
					
						commit
						a0c899bd67
					
				| @ -1943,13 +1943,13 @@ lazy_static::lazy_static! { | |||||||
|             link: "", |             link: "", | ||||||
|             try_again: false, |             try_again: false, | ||||||
|         }), (crate::server::LOGIN_MSG_DESKTOP_XORG_NOT_FOUND, LoginErrorMsgBox{ |         }), (crate::server::LOGIN_MSG_DESKTOP_XORG_NOT_FOUND, LoginErrorMsgBox{ | ||||||
|             msgtype: "session-re-login", |             msgtype: "info-nocancel-nocancel", | ||||||
|             title: "xorg_not_found_title_tip", |             title: "xorg_not_found_title_tip", | ||||||
|             text: "xorg_not_found_text_tip", |             text: "xorg_not_found_text_tip", | ||||||
|             link: LINK_HEADLESS_LINUX_SUPPORT, |             link: LINK_HEADLESS_LINUX_SUPPORT, | ||||||
|             try_again: true, |             try_again: true, | ||||||
|         }), (crate::server::LOGIN_MSG_DESKTOP_NO_DESKTOP, LoginErrorMsgBox{ |         }), (crate::server::LOGIN_MSG_DESKTOP_NO_DESKTOP, LoginErrorMsgBox{ | ||||||
|             msgtype: "session-re-login", |             msgtype: "info-nocancel-nocancel", | ||||||
|             title: "no_desktop_title_tip", |             title: "no_desktop_title_tip", | ||||||
|             text: "no_desktop_text_tip", |             text: "no_desktop_text_tip", | ||||||
|             link: LINK_HEADLESS_LINUX_SUPPORT, |             link: LINK_HEADLESS_LINUX_SUPPORT, | ||||||
|  | |||||||
| @ -64,11 +64,41 @@ pub fn stop_xdesktop() { | |||||||
|     *DESKTOP_MANAGER.lock().unwrap() = None; |     *DESKTOP_MANAGER.lock().unwrap() = None; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | fn detect_headless() -> Option<&'static str> { | ||||||
|  |     match run_cmds(&format!("which {}", DesktopManager::get_xorg())) { | ||||||
|  |         Ok(output) => { | ||||||
|  |             if output.trim().is_empty() { | ||||||
|  |                 return Some(LOGIN_MSG_DESKTOP_XORG_NOT_FOUND); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         _ => { | ||||||
|  |             return Some(LOGIN_MSG_DESKTOP_XORG_NOT_FOUND); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     match run_cmds("ls /usr/share/xsessions/") { | ||||||
|  |         Ok(output) => { | ||||||
|  |             if output.trim().is_empty() { | ||||||
|  |                 return Some(LOGIN_MSG_DESKTOP_NO_DESKTOP); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         _ => { | ||||||
|  |             return Some(LOGIN_MSG_DESKTOP_NO_DESKTOP); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     None | ||||||
|  | } | ||||||
|  | 
 | ||||||
| pub fn try_start_desktop(_username: &str, _passsword: &str) -> String { | pub fn try_start_desktop(_username: &str, _passsword: &str) -> String { | ||||||
|     if _username.is_empty() { |     if _username.is_empty() { | ||||||
|         let username = get_username(); |         let username = get_username(); | ||||||
|         if username.is_empty() { |         if username.is_empty() { | ||||||
|             LOGIN_MSG_DESKTOP_SESSION_NOT_READY |             if let Some(msg) = detect_headless() { | ||||||
|  |                 msg | ||||||
|  |             } else { | ||||||
|  |                 LOGIN_MSG_DESKTOP_SESSION_NOT_READY | ||||||
|  |             } | ||||||
|         } else { |         } else { | ||||||
|             "" |             "" | ||||||
|         } |         } | ||||||
| @ -80,26 +110,8 @@ pub fn try_start_desktop(_username: &str, _passsword: &str) -> String { | |||||||
|             return "".to_owned(); |             return "".to_owned(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         match run_cmds(&format!("which {}", DesktopManager::get_xorg())) { |         if let Some(msg) = detect_headless() { | ||||||
|             Ok(output) => { |             return msg.to_owned(); | ||||||
|                 if output.trim().is_empty() { |  | ||||||
|                     return LOGIN_MSG_DESKTOP_XORG_NOT_FOUND.to_owned(); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             _ => { |  | ||||||
|                 return LOGIN_MSG_DESKTOP_XORG_NOT_FOUND.to_owned(); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         match run_cmds("ls /usr/share/xsessions/") { |  | ||||||
|             Ok(output) => { |  | ||||||
|                 if output.trim().is_empty() { |  | ||||||
|                     return LOGIN_MSG_DESKTOP_NO_DESKTOP.to_owned(); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             _ => { |  | ||||||
|                 return LOGIN_MSG_DESKTOP_NO_DESKTOP.to_owned(); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         match try_start_x_session(_username, _passsword) { |         match try_start_x_session(_username, _passsword) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user