-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-vm.sh
executable file
·168 lines (138 loc) · 4.13 KB
/
install-vm.sh
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/env bash
. lib-qemu.sh
. lib-bogomips-sleep.sh
. lib-install-dos-on-qemu.sh
. lib-activate-dos-powermanager.sh
. lib-activate-w311fwg-networklogon-on-qemu.sh
. lib-activate-w311fwg-networkdriver-on-qemu.sh
. lib-install-oak-cdromdriver-on-qemu.sh
. lib-install-w311fwg-on-qemu.sh
. lib-install-app-ie-on-qemu.sh
. lib-install-app-nc-on-qemu.sh
. lib-install-app-msoffice-on-qemu.sh
. lib-install-app-netscape-on-qemu.sh
. lib-install-app-pkzip-on-qemu.sh
. lib-activate-w311fwg-settings-on-qemu.sh
install-vm() {
hddimage="$1"
isoimage="$2"
shift 2
qemuargs=("$@")
[ "${CONFIG_OEMCD}" == "" ] && CONFIG_OEMCD="OEMCD"
[ "${CONFIG_NETWORK}" == "" ] && CONFIG_NETWORK="rtl8029"
[ "${CONFIG_COMPUTERNAME}" == "" ] && CONFIG_COMPUTERNAME="JohnQ.Pu"
[ "${CONFIG_WORKGROUP}" == "" ] && CONFIG_WORKGROUP="wg"
[ "${CONFIG_USERNAME}" == "" ] && CONFIG_USERNAME="JohnQ.Pu"
[ "${CONFIG_PASSWORD}" == "" ] && CONFIG_PASSWORD=""
echo "CONFIG_OEMCD=${CONFIG_OEMCD}"
echo "CONFIG_NETWORK=${CONFIG_NETWORK}"
echo "CONFIG_COMPUTERNAME=${CONFIG_COMPUTERNAME}"
echo "CONFIG_WORKGROUP=${CONFIG_WORKGROUP}"
echo "CONFIG_USERNAME=${CONFIG_USERNAME}"
echo "CONFIG_PASSWORD=${CONFIG_PASSWORD}"
case "${CONFIG_NETWORK}" in
"rtl8029")
QEMU_NETWORK="-net user -net nic,model=ne2k_pci"
;;
"amdpcnet")
QEMU_NETWORK="-net user -net nic,model=pcnet"
;;
"none")
QEMU_NETWORK=""
;;
esac
QEMU_PIPE="$( qemu-pipe-init )"
QEMU_CURRENT_CDROM_IMAGE="$( qemu-cdrom-init ide-cd0 )"
QEMU_EXEC=( qemu-system-i386 -hda "${hddimage}" -fda "" -cdrom "" ${QEMU_NETWORK} "${qemuargs[@]}" ${QEMU_ARGS} )
rm "${QEMU_PIPE}.stop"
case "$( uname )" in
Linux*)
"${QEMU_EXEC[@]}" -monitor "pipe:${QEMU_PIPE}" &
;;
CYGWIN*)
( while ! [ -f "${QEMU_PIPE}.stop" ]; do cat "${QEMU_PIPE}.in"; done ) | "${QEMU_EXEC[@]}" -monitor stdio > "${QEMU_PIPE}.out" &
;;
esac
(
# read out pipe to prevent blocking
cat "${QEMU_PIPE}.out" > /dev/null &
# wait for qemu to initialize
bogomips-sleep 1
echo installing dos...
install-dos-on-qemu DosDisk1.img DosDisk2.img DosDisk3.img Suppdisk.img
echo installing cdrom driver...
install-oak-cdromdriver-on-qemu Win98BootDisk.img
if [ "$NOAPPS" != "" ] && [ "$NOAPPS" != "0" ]
then
echo "skipping installation of dos apps due to NOAPPS=\"$NOAPPS\""
else
echo installing dos apps...
install-app-nc-on-qemu "$isoimage"
install-app-pkzip-on-qemu "$isoimage"
fi
echo installing windows 3.11 for workgroups...
install-w311fwg-on-qemu "$isoimage"
if [ "$NOAPPS" != "" ] && [ "$NOAPPS" != "0" ]
then
echo "skipping installation of apps due to NOAPPS=\"$NOAPPS\""
else
echo installing apps...
install-app-msoffice-on-qemu "$isoimage"
fi
echo "activating windows 3.11 for workgroups network driver..."
if [ "${CONFIG_NETWORK}" == "none" ]
then
echo "skipping network driver installation due to NETWORK=\"${CONFIG_NETWORK}\""
else
activate-w311fwg-networklogon-on-qemu
activate-w311fwg-networkdriver-on-qemu
fi
if [ "${CONFIG_NETWORK}" == "none" ]
then
echo "skipping installation of browsers due to NETWORK=\"${CONFIG_NETWORK}\""
else
if [ "$NOAPPS" != "" ] && [ "$NOAPPS" != "0" ]
then
echo "skipping installation of browsers due to NOAPPS=\"$NOAPPS\""
else
install-app-netscape-on-qemu "$isoimage"
install-app-ie-on-qemu "$isoimage"
fi
fi
echo "activating windows 3.11 for workgroups graphics and powermanagement drivers..."
activate-w311fwg-settings-on-qemu "$isoimage"
echo activating power management for dos...
activate-dos-powermanager
touch "${QEMU_PIPE}.stop"
qemu-send "quit"
) | while read line
do
echo -e "$(date +%H:%M:%S) $line"
done
# wait for qemu to close
wait
rm "${QEMU_PIPE}.stop"
qemu-pipe-destroy "${QEMU_PIPE}"
qemu-cdrom-destroy "${QEMU_CURRENT_CDROM_IMAGE}"
}
install-vm-usage() {
echo -e "usage:\n\t$0 <HardDisk image> <Windows 3.11 install iso>" 2>&1
}
if [ $# -lt 1 ]
then
install-vm-usage
exit
fi
if ! [ -f "$1" ]
then
echo "file not found: $1" 1>&2
install-vm-usage
exit
fi
if ! [ -f "$2" ]
then
echo "file not found: $2" 1>&2
install-vm-usage
exit
fi
install-vm "$@"