This file is indexed.

/usr/bin/faum is in faumachine 20120707-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/sh
# 
# $Id: faum.in,v 1.11 2011-02-04 15:26:42 potyra Exp $
#
# Copyright (C) 2009 FAUmachine Team <info@faumachine.org>.
# This program is free software. You can redistribute it and/or modify it
# under the terms of the GNU General Public License, either version 2 of
# the License, or (at your option) any later version. See COPYING.

set -e

PREFIX=/usr

check() {
	if [ -z "$HOME" ]; then
		echo "HOME is unset. Exiting."
		exit 1;
	fi

	if [ -z $(which zenity) ]; then
		echo "zenity not found. Exiting."
		exit 1;
	fi

	if [ -z $(which $PREFIX/bin/fauhdlc) ]; then
		echo "$PREFIX/bin/fauhdlc not found. Exiting."
		exit 1;
	fi
}

create_faumrc() {
	echo "IMAGE_PATH=\"$IMAGE_PATH\"" > "$HOME/.faumrc"
	echo "MEDIA_SIZE=$MEDIA_SIZE" >> "$HOME/.faumrc"
	echo "RAM_SIZE=$RAM_SIZE" >> "$HOME/.faumrc"
	echo "SIMULATION_PC=\"$SIMULATION_PC\"" >> "$HOME/.faumrc"
}


ask_directory() {
	# $1 -> title
	RET=$(zenity --title="$1" --file-selection --directory)
}

ask_text() {
	# $1 -> title
	# $2 -> question text
	RET=$(zenity  --title "$1" --entry --text "$2")
}

ask_list() {
	# $1 -> title
	# $2 -> info text
	# $3 -> column headers
	# $4... -> options
	TITLE=$1
	shift
	TEXT=$1
	shift
	COLHEADER=$1
	shift
	RET=$(zenity --title "$TITLE" --text="$TEXT" --list \
		--column="$COLHEADER" $*)
}

msg_error() {
	# $1 -> title
	# $2 -> error message
	zenity --title="$1" --error --text="$2"
}

check

if [ ! -e "$HOME/.faumrc" ]; then
	CREATE_FAUMRC=1
else
	. $HOME/.faumrc
	CREATE_FAUMRC=0
fi

if [ -z "$IMAGE_PATH" ]; then
	ask_directory "In which path should virtual machines get stored?"
	IMAGE_PATH=$RET
	CREATE_FAUMRC=1
	set +e
	touch "$IMAGE_PATH/testfile"
	if [ $? -eq 1 ]; then
		msg_error "Configuring faum" \
			"\"$IMAGE_PATH\" is not writable. Aborting."
		exit 1
	fi
	set -e
	rm "$IMAGE_PATH/testfile"
fi

if [ -z "$SIMULATION_PC" ]; then
	ask_list "Configuring faum: Which PC to simulate" \
		"Select which PC to simulate" \
		"Architecture" \
		"i386" "amd64"

	case "$RET" in
		"i386")
			SIMULATION_PC="pc-4.vhdl"
			;;
		"amd64")
			SIMULATION_PC="pc-amd64-pci.vhdl"
			;;
		*)
			msg_error "Error" "Unsupported choice, exiting"
			exit 1;
		;;
	esac
	CREATE_FAUMRC=1
fi
			

if [ -z "$MEDIA_SIZE" ]; then
	ask_text "Configuring faum: Disk size" \
		"Size of the virtual disk in Megabytes"
	MEDIA_SIZE=$RET
	CREATE_FAUMRC=1
fi

if [ -z "$RAM_SIZE" ]; then
	ask_list "Configuring faum: Memory size" \
		"Memory size of the virtual RAM (Mb)" \
		"Memory size" \
		"64" "128" "256" 
	RAM_SIZE=$RET
	CREATE_FAUMRC=1
fi

if [ $CREATE_FAUMRC -eq "1" ]; then
	create_faumrc
fi

if [ ! -d "$IMAGE_PATH" ]; then
	msg_error "Error" "Node path $IMAGE_PATH does not exist"
	exit 1
fi

# sed expression to change disk size
CDS_SED="/disksize : integer := [0-9]\+/disksize : integer :="
# same for memsize
CMS_SED="/memsize : integer := [0-9]\+/memsize : integer :="

FAUM_DATA=$PREFIX/share/faumachine/vhdl
PC_VHDL="$FAUM_DATA/$SIMULATION_PC"
HW_TB_VHDL=$FAUM_DATA/test_bench_network.vhdl
HW_UB_VHDL=$FAUM_DATA/user-begin.vhdl
HW_UE_VHDL=$FAUM_DATA/user-end.vhdl

# check if slirp binary is present
HAVE_SLIRP=1
which slirp > /dev/null 2>&1 || HAVE_SLIRP=0

if [ $HAVE_SLIRP -eq 0 ]; then
	msg_error "Warning" "Slirp not installed, continuing without network."
	HW_TB_VHDL=$FAUM_DATA/test_bench.vhdl
fi

cat "$PC_VHDL" | \
	sed -e s"$CDS_SED $MEDIA_SIZE/" \
	    -e s"$CMS_SED $RAM_SIZE/" > \
	    "$IMAGE_PATH/system.vhdl"

cat "$HW_UB_VHDL" >> "$IMAGE_PATH/system.vhdl"

cat "$HW_UE_VHDL" |\
	sed -e "s/terminate;/wait;/" \
		>> "$IMAGE_PATH/system.vhdl"

cat "$HW_TB_VHDL" >> "$IMAGE_PATH/system.vhdl"

$PREFIX/bin/fauhdlc \
	--lib expect "$FAUM_DATA/sigs_and_comps.vhdl" \
	--lib expect "$FAUM_DATA/expect.vhdl" \
	--lib expect "$IMAGE_PATH/system.vhdl" \
	-o "$IMAGE_PATH/system.ic"

cp "$FAUM_DATA/simulation.setup" "$IMAGE_PATH"
# enable interactive mode
echo 'interactive     1' >> "$IMAGE_PATH/simulation.setup"

cd "$IMAGE_PATH"

$PREFIX/bin/faum-node-pc