Skip to content
Snippets Groups Projects
Commit 920fc78d authored by Alberto LIVIO BECCARIA's avatar Alberto LIVIO BECCARIA
Browse files

Considera l'id dell'esame per decidere se pulire l'area o no

parent 0d9991e6
No related branches found
No related tags found
No related merge requests found
......@@ -103,6 +103,7 @@ getConfigVars() {
MACHINE_ID=`echo $MACHINE_JSON | jsonValue id 1`
MACHINE_CONFIGS_ID=`echo $MACHINE_JSON | jsonValue configs_id 1`
CONFIG_NAME=`echo $MACHINE_JSON | jsonValue name 2`
EXAM_ID=`echo $MACHINE_JSON | jsonValue examid 1`
if [[ "$CONFIG_NAME" == "" ]]; then
echo "Error fetching machine configuration!"
......@@ -223,6 +224,7 @@ start() {
rm /local/iptables >/dev/null 2>&1
rm /local/iptables.prev >/dev/null 2>&1
rm /local/mk-homedir >/dev/null 2>&1
rm /local/examid >/dev/null 2>&1
/usr/bin/systemctl start graphical && exit 0
fi
echo "Fatal error(s): missing or wrong web service reply, abort."
......@@ -238,13 +240,13 @@ start() {
echo "Reboot to Normal!"
# reboot => exam
else
echo "Reboot to Exam!"
echo "Reboot to Exam (exam id: ${EXAM_ID})"
fi
/usr/bin/systemctl reboot
fi
else
# at boot time
if [[ "$CONFIG_NAME" != "$CONFIG_NAME_PREV" ]]; then
#if [[ "$CONFIG_NAME" != "$CONFIG_NAME_PREV" ]]; then
# update config_name file
echo "${CONFIG_NAME}" > /local/config_name
......@@ -256,10 +258,25 @@ start() {
rm /local/iptables >/dev/null 2>&1
rm /local/iptables.prev >/dev/null 2>&1
rm /local/mk-homedir >/dev/null 2>&1
rm /local/examid >/dev/null 2>&1
else
touch /local/mk-homedir
# if the examid of the session before the boot is different,
# then clean the exam user home (if the profile requires it)
EXAM_ID_PREV=""
# if the exam is already started, get examid from file
if [[ -f /local/examid ]]; then
EXAM_ID_PREV=`cat /local/examid`
# otherwise let's create the file with the current examid
else
echo "${EXAM_ID}" > /local/examid
fi
# different examid?
if [[ ${EXAM_ID} != ${EXAM_ID_PREV} ]]; then
touch /local/mk-homedir
fi
fi
fi
#fi
# choose the correct target
# we have just booted/rebooted, update the current configuration via web service
updateCurrentConfigId
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment