Menu

[r10367]: / legacy / etc / rc.d / geli  Maximize  Restore  History

Download this file

55 lines (42 with data), 920 Bytes

#!/bin/sh
# Copyright (c) 2007-2009 Volker Theile (votdev@gmx.de)
# All rights reserved.

# PROVIDE: disks
# REQUIRE: initrandom
# KEYWORD: nojail shutdown

. /etc/rc.subr
. /etc/configxml.subr

name="geli"

load_rc_config "$name"

# Custom commands
start_cmd="geli_start"
stop_cmd="geli_stop"

# Creates a list of providers for GELI encryption
geli_make_list()
{
	local _devices

	_devices=`/usr/local/bin/xml sel -t -m "//geli/vdisk" \
		-v devicespecialfile -n \
		${configxml_file} | /usr/local/bin/xml unesc |
		while read _provider; do
			_provider=${_provider#/dev/}
			_provider=${_provider%.eli}
			echo "${_provider} "
		done`

	echo $_devices
}

geli_start()
{
	# Nothing to do here.
}

geli_stop()
{
	devices=`geli_make_list`

	for provider in ${devices}; do
		if [ -e "/dev/${provider}.eli" ]; then
			umount "/dev/${provider}.eli" 2>/dev/null
			geli detach "${provider}"
		fi
	done
}

run_rc_command "$1"
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.