mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-10-31 11:59:11 +00:00 
			
		
		
		
	Remove all tty init from init
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
		
							
								
								
									
										12
									
								
								pkg/init/etc/init.d/000-issue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								pkg/init/etc/init.d/000-issue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  | if [ -f /etc/issue ]; then | ||||||
|  | 	for opt in $(cat /proc/cmdline); do | ||||||
|  | 		case "$opt" in | ||||||
|  | 		console=*) | ||||||
|  | 			fulltty=${opt#console=} | ||||||
|  | 			tty=${fulltty%,*} | ||||||
|  | 			cat /etc/issue >> /dev/$tty | ||||||
|  | 		esac | ||||||
|  | 	done | ||||||
|  | fi | ||||||
| @@ -1,45 +1,9 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
|  |  | ||||||
| setup_console() { |  | ||||||
| 	tty=${1%,*} |  | ||||||
| 	speed=${1#*,} |  | ||||||
| 	inittab="$2" |  | ||||||
| 	securetty="$3" |  | ||||||
| 	line= |  | ||||||
| 	term="linux" |  | ||||||
| 	[ "$speed" = "$1" ] && speed=115200 |  | ||||||
|  |  | ||||||
| 	case "$tty" in |  | ||||||
| 	ttyS*|ttyAMA*|ttyUSB*|ttyMFD*) |  | ||||||
| 		line="-L" |  | ||||||
| 		term="vt100" |  | ||||||
| 		;; |  | ||||||
| 	tty?) |  | ||||||
| 		line="" |  | ||||||
| 		speed="38400" |  | ||||||
| 		term="" |  | ||||||
| 		;; |  | ||||||
| 	esac |  | ||||||
| 	# skip consoles already in inittab |  | ||||||
| 	grep -q "^$tty:" "$inittab" && return |  | ||||||
|  |  | ||||||
| 	echo "$tty::once:cat /etc/issue" >> "$inittab" |  | ||||||
| 	echo "$tty::respawn:/sbin/getty -n -l /bin/sh $line $speed $tty $term" >> "$inittab" |  | ||||||
| 	if ! grep -q -w "$tty" "$securetty"; then |  | ||||||
| 		echo "$tty" >> "$securetty" |  | ||||||
| 	fi |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /bin/mount -t tmpfs tmpfs /mnt | /bin/mount -t tmpfs tmpfs /mnt | ||||||
|  |  | ||||||
| /bin/cp -a / /mnt 2>/dev/null | /bin/cp -a / /mnt 2>/dev/null | ||||||
|  |  | ||||||
| /bin/mount -t proc -o noexec,nosuid,nodev proc /proc | /bin/mount -t proc -o noexec,nosuid,nodev proc /proc | ||||||
| for opt in $(cat /proc/cmdline); do |  | ||||||
| 	case "$opt" in |  | ||||||
| 	console=*) |  | ||||||
| 		setup_console ${opt#console=} /mnt/etc/inittab /mnt/etc/securetty;; |  | ||||||
| 	esac |  | ||||||
| done |  | ||||||
|  |  | ||||||
| exec /bin/busybox switch_root /mnt /sbin/init | exec /bin/busybox switch_root /mnt /sbin/init | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user