0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.118.140.96


Current Path : /snap/core/16928/usr/share/initramfs-tools/scripts/
Upload File :
Current File : //snap/core/16928/usr/share/initramfs-tools/scripts/ubuntu-core-functions

# -*- shell-script -*-

pre_mountroot()
{
	local script_dir="/scripts/local-top"
	[ "$quiet" != "y" ] && log_begin_msg "Running $script_dir"
	run_scripts "$script_dir"
	[ "$quiet" != "y" ] && log_end_msg
}

# Determine full path to disk partition given a filesystem label.
get_partition_from_label()
{
	local label="$1"

	[ -n "$label" ] || panic "need FS label"

	# Make sure the device has been created by udev before looking for it
	# Don't need to panic, since the output will be validated outside this function
	wait-for-root "LABEL=$label" "${ROOTDELAY:-180}" >/dev/null || true

	local part=$(find /dev -name "$label"|tail -1)
	[ -z "$part" ] && return
	local path=$(readlink -f "$part")
	[ -n "$path" ] && echo "$path"
}

# setup $writable_mnt
do_root_mounting()
{
	root="LABEL=$writable_label"

	# Make sure the device has been created by udev before we try to mount
	wait-for-root "$root" "${ROOTDELAY:-180}" || panic "unable to find root partition '$root'"

	# FIXME: This is never false since we set $root above
	[ -n "$root" ] || panic "no root partition specified"

	if echo "$root" | grep -q ^/; then
		path="$root"
	else
		# convert UUID/LABEL to a device name
		path=$(findfs "$root" 2>/dev/null || :)
	fi

	[ -e "$path" ] || panic "root device $path does not exist"

	# try loading squashfs, but don't fail if its e.g. in the kernel
	# already
	modprobe squashfs || true

	if ! grep -q squashfs /proc/filesystems; then
		 panic "no squashfs support found in your system, aborting"
	fi

	# mount writable rw
	path=$(get_partition_from_label "$writable_label")
	mount "$path" "$writable_mnt"
}