summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt-docker/data/opt/openslx/vmchooser/plugins/docker/run-virt.include
blob: 610c78147b801f8daa3e27cbfc3ddc676d9867c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
###############################################################################
# -----------------------------------------------------------------------------
#
# Copyright (c) 2009..2018 bwLehrpool-Projektteam
#
# This program/file is free software distributed under the GPL version 2.
# See https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
#
# If you have any feedback please consult https://bwlehrpool.de and
# send your feedback to support@bwlehrpool.de.
#
# General information about bwLehrpool can be found at https://bwlehrpool.de
#
# -----------------------------------------------------------------------------
# run-virt.include
#    - qemu/kvm plugin for vmchooser run-virt
################################################################################

# BASH_SOURCE[0] contains the file being sourced, namely this one
declare -rg DOCKER_PLUGIN_DIR="$(dirname "${BASH_SOURCE[0]}")"
declare -rg DOCKER_INCLUDE_DIR="${DOCKER_PLUGIN_DIR}/includes"

# TODO make this part of the metadata coming from the server
# TBD: "firewall printer usb slxfloppy sound netshares"
declare -rg PLUGIN_FEATURES=""

run_plugin() {

	# VMX == bwlp-container-info.tar.gz
	writelog "+ unpacking container ressources"
	tar -xzvf "$TMPCONFIG" --directory "$CONFDIR"
	
	# VARS
	# location of scripts and config files which will be used in desktop 
	export USER_CONTAINER_CONTEXT="$HOME/.local/docker"
	# config file which will be filed with vars in the follwing process
	export USER_CONTAINER_CONFIG="$USER_CONTAINER_CONTEXT/.bwlp-user-conf"
	# dictonary which maps a drive letter to a directory
	declare -Ag NETSHARE_DIR

	# apply "allow_root" option to gvfsd-fuse, so docker can bind mount gvfs network shares
	writelog "+ gio_allow_root_fix.inc"
	$( safesource "${DOCKER_INCLUDE_DIR}/gio_allow_root_fix.inc" )

	# mount netshares from CONFDIR/netshares
	writelog "+ gio_mount_netshare.inc"
	$( safesource "${DOCKER_INCLUDE_DIR}/gio_mount_netshare.inc" )

	writelog "+ init user container context"
	$( safesource "${DOCKER_INCLUDE_DIR}/init_user_context.inc" )
	
	# init bind mount option for container
	writelog "+ init_bind_mount.inc"
	$( safesource "${DOCKER_INCLUDE_DIR}/init_bind_mount.inc" )

	# HACK: using the modified version of the wrapper script
	declare -rg VIRTCMD="startxfce4"
}