Manage auto start X on Archlinux
This commit is contained in:
		
							parent
							
								
									5b82144876
								
							
						
					
					
						commit
						d5e7884181
					
				
							
								
								
									
										22
									
								
								zlogin
								
								
								
								
							
							
						
						
									
										22
									
								
								zlogin
								
								
								
								
							|  | @ -55,10 +55,10 @@ getc () | ||||||
| 	stty cooked | 	stty cooked | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ## Autorun an X session with some restrictions | ## Autorun an X session with some restrictions for Debian {{{ | ||||||
| ## Set a ~/.noxorg file to work in tty only | ## Set a ~/.noxorg file to work in tty only | ||||||
| # If non-root session | # If non-root session | ||||||
| if [ ${USER} != "root" ] && [ $(command -v startx) ]; then | if [ -f /etc/debian_version ] && [ ${USER} != "root" ] && [ $(command -v startx) ]; then | ||||||
| 	# If it's a VC console and | 	# If it's a VC console and | ||||||
| 	# no X session already launch and | 	# no X session already launch and | ||||||
| 	# no ~/.noxorg file exist | 	# no ~/.noxorg file exist | ||||||
|  | @ -74,3 +74,21 @@ if [ ${USER} != "root" ] && [ $(command -v startx) ]; then | ||||||
| 		fi | 		fi | ||||||
| 	fi | 	fi | ||||||
| fi | fi | ||||||
|  | ## }}} | ||||||
|  | ## Autorun an X session with some restrictions for Archlinux {{{ | ||||||
|  | ## Set a ~/.noxorg file to work in tty only | ||||||
|  | # If non-root session | ||||||
|  | if [ -f /etc/arch-release ] && [ ${USER} != "root" ] && [ $(command -v startx) ]; then | ||||||
|  | 	# If it's a VC console and | ||||||
|  | 	# no X session already launch and | ||||||
|  | 	# no ~/.noxorg file exist | ||||||
|  | 	if [ -z "${SSH_TTY}" ] && | ||||||
|  | 	   [ ! -f "${HOME}/.noxorg" ] && | ||||||
|  | 	   ! pgrep --full -- "/usr/lib/xorg/Xorg|/usr/lib/Xorg" ; then | ||||||
|  | 		echo "No X11 session detected, starting a new one…" | ||||||
|  | 		`startx -- :1 vt1` | ||||||
|  | 	else | ||||||
|  | 		echo "Not in a VC console, ~/.noxorg file exists or Xorg already running…" | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
|  | ## }}} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue