#!/bin/sh -efu
### This file is covered by the GNU General Public License
### version 2 or later.
###
### Copyright (C) 2018  ALT Linux Team
### Author: Leonid Krivoshein <klark@altlinux.org>

if [ -z "${__included_rescue_launcher_plan9-}" ]; then
__included_rescue_launcher_plan9=1

# VirtIO 9P Share
autorun_probe_plan9_method() {
	local opts="ro,nosuid,trans=virtio,version=9p2000.L"
	local label="${AUTORUN_LABEL:-alt-autorun}" module="9p"

	autorun_debug "Probing PLAN9..."
	if grep -wqs $module /proc/filesystems; then
		autorun_mount -t $module -o $opts "$label" || return 1
	else
		autorun_spawn modprobe $module ||:
		autorun_mount -t $module -o $opts "$label" || {
			autorun_spawn rmmod $module ||:
			return 1
		}
	fi

	return 0
}

fi #__included_rescue_launcher_plan9
