summaryrefslogtreecommitdiffstats
path: root/initrd/initrd-stuff/etc/vmware-prep
blob: 21333ed7b22e54cbc88b7b5c8a163dd88401903a (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/sh
#
# Description:  Kernel of a generic runlevel script file for use with
#               Diskless X Stations (v4.0) - script prepares vmware
#               environment. Start and stop functionality is added within
#		initial ramdisk
#
# Author(s):    Michael Janczyk <mj0@uni-freiburg.de>, 15-04-2006
#               Dirk von Suchodoletz <dirk@goe.net>, 23-08-2006
# Copyright:    (c) 2003, 2006 - RZ Universitaet Freiburg
#
# Version:      0.2.324
#
################################################################################



### VERBOSE? ###################################################################
# set verbose mode (set -x(v))
#set -xv



### CONFIGURATION ##############################################################
# read configuration information
. /etc/machine-setup



### VARIABLES SECTION ##########################################################
# Declaration of default variables
vmdir=/var/lib/vmware
#path=/var/X11R6/bin
#sessions=
#session_name=



### FUNCTIONS SECTION ##########################################################
# NOT NEEDED NOW
# unionfs used?
#pathtest () {
#  if `touch /usr/X11R6/bin/touch >/dev/null 2>&1`; then
#    path=/usr/X11R6/bin/
#    rm ${path}/touch >/dev/null 2>&1
#  else
#    test -d ${path} || mkdir -p ${path}
#  fi
#}


# loop file for exchanging information between linux and vmware
mount_loop () {
  modprobe loop >/dev/null 2>&1
  mkdir -p /tmp/loop0
  cp ${vmdir}/templ/fd0.img /tmp/${clientip}-fd0.img
  chmod a+rw /tmp/${clientip}-fd0.img
  mount -n -t msdos -o loop,umask=000 /tmp/${clientip}-fd0.img \
    /tmp/loop0
}


# device creation - the module does not trigger udev properly
vmnet () {
  for i in 0 1 2 3 4 5 6 7 8 9; do
    [ -c /dev/vmnet${i} ] || mknod /dev/vmnet${i} c 119 ${i};
  done
  chmod 0700 /dev/vmnet*
}

# MOVED TO INITRD
# special start script for vmware with predefined image
#copyscript () {
#  # runvmware
#  cp ${vmdir}/templ/runvmware ${path}
#  chmod 755 ${path}/runvmware >/dev/null 2>&1
#    
#  # default kdm session. Xdialog with WM and VMware images
#  cp ${vmdir}/templ/defaultwm ${path}/defaultwm
#  chmod 755 ${path}/defaultwm >/dev/null 2>&1
#}


# MOVED TO INITRD
# blabla sessiondinens
#desktop_session () {
#  echo -e "#!/bin/sh\n#\n# file generated by ${0} at ${date}\
#    \n# set to black background\nxsetroot -solid \"black\"\
#    \nstartvm=\$(echo \$0 | sed -e \"s,.*/,,\")\
#    \nxterm -bg black -fg white -geometry 100x30+0-0 +sb \
#      -e \"${path}/runvmware -s \${startvm} ${debug}\"\n" \
#    > ${path}/desktop-session
#  chmod 755 ${path}/desktop-session
#}


# MOVED TO INITRD
# copy nach blabla
#vmsession2desktop_session () {
#  sessions=$(ls ${vmdir}/vmsessions/*.desktop 2>/dev/null)
#  if [ -n "${sessions}" ]; then
#    for i in ${vmdir}/vmsessions/*.desktop; do
#      session_name=$(cat ${i} | grep -iw "exec" \
#        | awk -F "=" '{print $2}')
#      ln -s ${path}/desktop-session ${path}/${session_name}
#    done
#  fi
#}


### START SCRIPT ###############################################################

# create vmdir
#mkdir -p /var/lib/vmware 2>&1

# mount von zeugs (wohl besser in der InitRD, da sonst Sessions nicht 
# rechtzeitig fuer gdm/kdm verfuegbar)
#mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid ${imgsrv} ${vmdir}

# check path
#pathtest

# device creation - the module does not trigger udev properly
vmnet

# special start script for vmware with predefined image
#copyscript

# loop file for exchanging information between linux and vmware guest
mount_loop

# blabla sessiondinens
#desktop_session

# copy nach blabla
#vmsession2desktop_session

# mount usbfs
mount -t usbfs usbfs /proc/bus/usb