Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.147.56.125
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/self/root/proc/2/root/proc/3/cwd/proc/2/root/usr/share/initramfs-tools/hooks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/self/root/proc/2/root/proc/3/cwd/proc/2/root/usr/share/initramfs-tools/hooks/resume
#!/bin/sh

PREREQ=""

prereqs()
{
	echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
	prereqs
	exit 0
	;;
esac

. /usr/share/initramfs-tools/scripts/functions

# First check if a location is set and is a valid swap partition.
# If so, the config file will be copied in and there is nothing to do.
if [ -n "$RESUME" ] && [ "$RESUME" != auto ]; then
	if [ "$RESUME" = none ]; then
		exit 0
	fi
	if resume_dev_node="$(resolve_device "$RESUME")" && \
	   blkid -p -n swap "$resume_dev_node" >/dev/null 2>&1; then
		exit 0
	fi

	echo >&2 "W: initramfs-tools configuration sets RESUME=$RESUME"
	echo >&2 "W: but no matching swap device is available."
fi

# If we were not explicitly requested to select a device, or the -v
# option is used, report that we are doing so
report_auto()
{
	test "${verbose?}" != y && test "$RESUME" = auto || echo "I: $*"
}

# Report in excruciating detail if the -v option is used
report_verbose()
{
	test "${verbose?}" != y || echo "I: $*"
}

report_verbose "Configuration sets RESUME=$RESUME"

# Try to autodetect the RESUME partition, using biggest swap device that
# is not ephemeral.  We need to be able to read the listed swap partitions.
resume_auto=
if ! ischroot && [ -r /proc/swaps ]; then
	# shellcheck disable=SC2013
	for resume_auto in $(grep ^/dev/ /proc/swaps | sort -rnk3 | cut -d " " -f 1); do
		report_verbose "Checking swap device $resume_auto"
		ephemeral=false
		dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)"

		# dm-crypt is ephemeral if the key file is /dev/urandom
		if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then
			report_verbose "$resume_auto has device-mapper name $dm_name; checking crypttab"
			# shellcheck disable=SC2034
			while read -r cryptdev srcdev keyfile junk; do
				report_verbose "Found cryptdev=$cryptdev keyfile=$keyfile"
				if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then
					report_verbose "Rejecting $resume_auto since it has no permanent key"
					ephemeral=true
				fi
			done < /etc/crypttab
		fi

		# zram is ephemeral
		case "$resume_auto" in
		/dev/zram*)
			report_verbose "Rejecting $resume_auto since it is zram"
			ephemeral=true
			;;

		/dev/zd[0-9]*)
			report_verbose "Rejecting $resume_auto since it is zvol"
			ephemeral=true
			;;
		esac

		$ephemeral || break
	done

	if $ephemeral; then
		resume_auto=
	fi
	if [ -n "$resume_auto" ]; then
		if [ -n "$dm_name" ]; then
			resume_auto_canon="/dev/mapper/$dm_name"
		elif UUID=$(blkid -s UUID -o value "$resume_auto"); then
			resume_auto_canon="UUID=$UUID"
		else
			resume_auto_canon=
		fi
		report_auto "The initramfs will attempt to resume from $resume_auto"
		if [ -n "$resume_auto_canon" ]; then
			report_auto "($resume_auto_canon)"
			resume_auto="$resume_auto_canon"
		fi
		report_auto "Set the RESUME variable to override this."
	fi
fi

# Write selected resume device to intramfs conf.d
if [ "$RESUME" = auto ] || [ -n "$resume_auto" ]; then
	# If we were explicitly requested to select a device, and we failed,
	# report that
	if [ -z "$resume_auto" ]; then
		echo >&2 "W: initramfs-tools failed to select a resume device"
	fi
	echo "RESUME=${resume_auto}" > "${DESTDIR}/conf/conf.d/zz-resume-auto"
fi

Anon7 - 2022
AnonSec Team