summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/mnt_shares
blob: ff64688408736446331b91d0ad1df44587e798a2 (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
60
61
62
#!/bin/bash

# set -x

logger "openslx sharemapper: Started."

OWNDIR=$(dirname $0)
for i in "$(dirname $0)"/includes/*.inc; do
	source "$i"
done

# Wait for network connection to base system
x=1
while ! ping -w 1 -c 1 "${NATADDR}" 2>/dev/null 1>&2; do
	[ "$x" -gt 20 ] && { logger "openslx sharemapper: could not reach base system. Giving up."; exit 1; } 
	let x=x+1
	sleep 2
done

logger "openslx sharemapper: base system reaching; commencing."

# REMAPMODE (remapMode):		0: None, 1 Native, 2 Native Fallback, 3 vmware
#					mode 0 and 1 do curr. teha same, may deviate in the future
# CREATEMISSING (createMissingRemap):	0: Nichts tun, 1 xdg-Verzeichnisse

case "$REMAPMODE" in
	0)	logger "openslx sharemapper: remapMode 0 (do nothing) detected."
		preliminaries_native
		get_creds		# fills global var PW with (currently) decrypted password
		get_shares		# fills array ROHSHARES; row 0 global infos from (shares-)CONFIGFILE,
					# following rows:	column 1 share path, col 2 drive letter, col 3 share name,
					# 			column 4 username, col 5 password.
		mount_shares		# mounts shares given in array ROHSHARES.
		;;
	1)	logger "openslx sharemapper: remapMode 1 (native mode) detected."
		preliminaries_native
		get_creds		# fills global var PW with (currently) decrypted password
		get_shares
		mount_shares		# mounts shares given in array ROHSHARES.
		;;
	2)	logger "openslx sharemapper: remapMode 2 (fallback mode) detected."
		preliminaries_native
		get_creds		# fills global var PW with (currently) decrypted password
		get_shares
		mount_shares		# mounts shares given in array ROHSHARES.
		check_fallback		# checks for a mounted home and fallbacks to vmware share, if none found.
		;;
	3)	logger "openslx sharemapper: remapMode 3 (vmware mode) detected."
		preliminaries_vmware
		mount_shares		# mounts shares given in array ROHSHARES - runvirt checks whether there's
					# a home share given or not..
		;;
	*)	logger "openslx sharemapper: unknown remapMode in $SLXCONFIGFILE; doing nothing."
		;;
esac

# By the way: We also have to start a bwLehrpool-Suite given script (runscript). For convenience we will start it here and 
# after mounting shares, as perhaps a given script needs mounted shares.
runscript

exit 0