summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/emufe/files/run-virt.include
blob: 2286c4ea9ca845d46fdb469c7deadfa0c0eae0e2 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# run-virt.include
# -----------------------------------------------------------------------------
# Copyright (c) 2011 - RZ Uni Freiburg
# Copyright (c) 2011 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org
# -----------------------------------------------------------------------------
# run-virt.include
#    - Include script for running the various emulators via a common frontend 
#      script via the common run-virt.sh of the vmchooser
################################################################################

################################################################################
### Include general configuration
################################################################################
if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf ]; then
  . ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf
else 
  writelog "Problems reading config file of ${self} plugin"
  # TODO: exit wenn conf wichtig
  #exit 1
fi

################################################################################
### Declaration of default variables
################################################################################

PLUGINCONFQK="${PLUGINCONFROOT}/${self}"
PLUGINDIRQK=${OPENSLX_DEFAULT_DIR}/plugin-repo/${self}
# create TMPDIR for all users
mkdir -m 1777 /tmp/${self} 2>/dev/null
# TMPDIR
TMPDIR="/tmp/${self}/${USER}"
# define dirs and files which can be removed after exit, be carefull!
RMDIRS="${TMPDIR}"
rm -rf ${RMDIRS} 2>/dev/null
mkdir -m 1777 -p ${TMPDIR} 2>/dev/null
# vmpath is the path to the emulator/original system image
diskfile=${vmpath}

# emulator is the information provided via xml file
emulator=$(grep -o 'virtualmachine param=.*"' ${xmlfile} \
          | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')

rombios=$(grep -o 'rombios param=.*"' ${xmlfile} \
          | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')

displayname=$(echo ${displayname} | sed -e "s, ,-,g")

VIRTCMD="${emulator}"

case "${emulator}" in
  dosbox*|Dosbox*)
    tar -xpzf ${diskfile} -C "${TMPDIR}"
    emudir=$(ls ${TMPDIR})
    [ $(echo ${emudir}|wc|awk '{print $2}') -eq 1 ] && \
      { mv ${TMPDIR}/${emudir}/* ${TMPDIR}; rmdir ${TMPDIR}/${emudir}; }
    echo "# empty" > ${TMPDIR}/dosbox.conf
    VIRTCMDOPTS="${emulator#*dosbox}"
    VIRTCMDOPTS="${VIRTCMDOPTS} -conf ${TMPDIR}/dosbox.conf -fullscreen"
    # the directory mount has to be first
    VIRTCMD="dosbox -c \"mount c ${TMPDIR}\""
  ;;
  SheepShaver*|sheepshaver*)
    [ "x${rombios}" != "x" ] && rom="--rom ${xmlpath}${rombios}"
    VIRTCMDOPTS="${VIRTCMDOPTS} --name ${displayname} ${rom}"
  ;;
  hatari*|Hatari*)

  ;;
  *mess*)
    [ "x${rombios}" != "x" ] && rom="${xmlpath}${rombios}"
    VIRTCMDOPTS="${VIRTCMDOPTS} ${rom}"
  ;;
  *uae*)
    [ "x${rombios}" != "x" ] && rom="-s kickstart_rom_file=${xmlpath}${rombios}"
    VIRTCMDOPTS="${VIRTCMDOPTS} ${rom}"
  ;;
  *qemu*)
    [ "x${rombios}" != "x" ] && rom="-bios ${xmlpath}${rombios}"
    VIRTCMDOPTS="${VIRTCMDOPTS} -snapshot"
  ;;
esac

writelog "Directories:"
writelog "\tTMPDIR:\t\t\t$TMPDIR"
writelog "Diskimage:"
writelog "\tDisk type:\t\t$imgtype"
writelog "\tDisk file:\t\t$diskfile"

################################################################################
### Emulator definitions
################################################################################


writelog "Virtual Hardware:"
writelog "\tGuest RAM:\t\t${mem} MB"
# echo nur wenn memhost gesetzt
[ -n "${memhost}" ] && writelog "\tHost RAM:\t\t${memhost} MB"
writelog "\tMAC address:\t\t$macaddr"
writelog "\tNetwork card:\t\t${network_card}"
writelog "\tNetwork kind:\t\t${network_kind}"
#writelog "\tCD-ROM1:\t${cdrom0}"
#writelog "\tCD-ROM2:\t${cdrom1}"
#writelog "\tFloppy_A:\t${floppy0}"
#writelog "\tFloppy_B:\t${floppy1}"
#writelog "\tShared Folders 'home':\t/home/${USER}"

################################################################################
### finally set env for run-virt.sh
################################################################################