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

Added NFS service, refactored get-config and apply-config to run the same script

parent 8de5c81f
No related branches found
No related tags found
No related merge requests found
Showing
with 79 additions and 59 deletions
File deleted
/bin/sleep
\ No newline at end of file
#!/bin/bash
getconf() {
ESAME_KIOSK_URL=${args[1]}
ESAME_KIOSK_FIREFOX_PREFS_JS=${args[2]}
}
stop() {
:
}
start() {
#getconf
echo "ESAME_KIOSK_URL = ${ESAME_KIOSK_URL}"
echo "ESAME_KIOSK_FIREFOX_PREFS_JS = ${ESAME_KIOSK_FIREFOX_PREFS_JS}"
if [ "z${ESAME_KIOSK_URL}" != "z" -a "z${ESAME_KIOSK_FIREFOX_PREFS_JS}" != "z" ]; then
......
......@@ -73,7 +73,7 @@ start() {
else
echo "Downloaded iptables config file (http_status=$HTTP_STATUS)"
fi
# configuration profile is changed
if [[ "$MACHINE_CONFIGS_ID" != "$MACHINE_CONFIGS_ID_PREV" ]]
then
......@@ -91,12 +91,10 @@ start() {
rm /local/iptables 2>&1
rm /local/iptables.prev 2>&1
echo "Normal!"
#/usr/bin/systemctl isolate graphical.target
/usr/bin/systemctl set-default graphical.target
reboot
else
echo "Exam!"
#/usr/bin/systemctl isolate esame.target
/usr/bin/systemctl set-default esame.target
reboot
fi
......@@ -109,7 +107,7 @@ start() {
if [[ $? -ne 0 ]]
then
/usr/bin/systemctl daemon-reload
echo "Configuration parameters changed: restart services... "
echo "Configuration parameters changed: start some services again... "
# restart some exam services
echo -n "USB..."
/usr/bin/systemctl start esame-usb
......@@ -122,7 +120,7 @@ start() {
fi
fi
/usr/bin/systemctl stop esame-get-config
#/usr/bin/systemctl stop esame-get-config
}
......
......@@ -4,10 +4,6 @@
# il file in /local/kiosk.mode
ESAME_KIOSK_FILE=/local/kiosk/bin/approve.lock
getconf() {
ESAME_KIOSK_MODE=${args[1]}
}
stop() {
if [ -f ${ESAME_KIOSK_FILE} ]; then
echo "STOP KIOSK";
......@@ -16,7 +12,6 @@ stop() {
}
start() {
#getconf
if [ ${ESAME_KIOSK_MODE} -eq 1 ]; then
echo "START KIOSK MODE";
touch ${ESAME_KIOSK_FILE};
......
#!/bin/bash
getconf() {
ESAME_CLEAN_HOME=${args[1]}
ESAME_USER=${args[2]}
}
stop() {
# Do nothing
:
}
start() {
#getconf
echo "ESAME_CLEAN_HOME = ${ESAME_CLEAN_HOME}"
echo "ESAME_USER = ${ESAME_USER}"
if [ ${ESAME_CLEAN_HOME} -eq 1 ]; then
......
bin/nfs 0 → 100755
#!/bin/bash
# Keep the following services in proper shutdown order
# (Check with the start/stop numbers in the init file)
#
# NOTE: This seems to work. Moving netfs at the end does not work.
# If you modify this, test-test-test...
SERVICES="rpcidmapd rpcgssd nfslock rpcbind"
stop() {
echo "STOPPING NFS"
if [ ${ESAME_NFS} -eq 0 ]; then
sync
umount /home
for i in ${SERVICES}; do
service "$i" stop
done
fi
}
start() {
echo "STARTING NFS"
for i in ${SERVICES}; do
service "$i" start
done
mount /home
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
*)
echo "Usage: $0 { start | stop | restart }";
exit 1;
;;
esac
exit 0
#!/bin/bash
API_BASE_URL=https://labguiws.foo.local/api/1.0
function getTokenJSON() {
echo `curl -s -k --max-time 10 -X POST -H "Content-Type: application/json" -d "{\"login\":\"guest\",\"pwd\":\"\"}" ${API_BASE_URL}/login`
}
function jsonValue() {
KEY=$1
num=$2
awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p
}
# obsolete
stop() {
echo "STOP ESAME-APPLY-CONFIG"
......@@ -43,12 +30,10 @@ start() {
rm /local/iptables 2>&1
rm /local/iptables.prev 2>&1
echo "Normal!"
#/usr/bin/systemctl isolate graphical.target
/usr/bin/systemctl set-default graphical.target
reboot
else
echo "Exam!"
#/usr/bin/systemctl isolate esame.target
/usr/bin/systemctl set-default esame.target
reboot
fi
......
......@@ -24,7 +24,6 @@ stop() {
}
start() {
#getconf
echo "ESAME_VIRTUALBOX = ${ESAME_VIRTUALBOX}"
echo "ESAME_USER = ${ESAME_USER}"
if [ $ESAME_VIRTUALBOX -eq 1 ]; then
......
......@@ -5,8 +5,4 @@ Wants=network-online.target
[Service]
Type=oneshot
#RemainAfterExit=yes
ExecStart=/opt/esame/bin/apply-config start
#[Install]
#WantedBy=configurator.target
ExecStart=/opt/esame/bin/get-config start
......@@ -4,11 +4,8 @@ After=esame-mk-homedir.service
[Service]
Type=oneshot
#RemainAfterExit=yes
EnvironmentFile=/local/esame-machine.conf
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/opt/esame/bin/firefox-home start
ExecStop=/opt/esame/bin/firefox-home stop
ExecReload=/opt/esame/bin/firefox-home restart
[Install]
WantedBy=esame.target
......@@ -5,10 +5,7 @@ Wants=network-online.target
[Service]
Type=oneshot
#RemainAfterExit=yes
ExecStart=/opt/esame/bin/iptables-rules start
ExecStop=/opt/esame/bin/iptables-rules stop
ExecReload=/opt/esame/bin/iptables-rules restart
[Install]
WantedBy=esame.target
......@@ -5,7 +5,7 @@ After=kdm.service esame-mk-homedir.service esame-firefox-home.service esame-virt
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/local/esame-machine.conf
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/opt/esame/bin/kdm-autologin start
ExecStop=/opt/esame/bin/kdm-autologin stop
ExecReload=/opt/esame/bin/kdm-autologin restart
......
......@@ -5,7 +5,7 @@ After=esame-mk-homedir.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/local/esame-machine.conf
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/opt/esame/bin/kioskmode start
ExecStop=/opt/esame/bin/kioskmode stop
ExecReload=/opt/esame/bin/kioskmode restart
......
......@@ -4,8 +4,7 @@ After=esame-get-config.service
[Service]
Type=oneshot
#RemainAfterExit=yes
EnvironmentFile=/local/esame-machine.conf
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/opt/esame/bin/mk-homedir start
[Install]
......
[Unit]
Description=Esame - Mount homes (NFS)
After=esame-user-sessions.service esame-get-config.service
[Service]
Type=oneshot
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/opt/esame/bin/nfs start
[Install]
WantedBy=esame.target
# Esame Stand alone Target
[Unit]
Description=Esame Standalone
#Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes
......@@ -4,9 +4,8 @@ After=esame-user-sessions.service esame-get-config.service
[Service]
Type=oneshot
#RemainAfterExit=yes
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/bin/bash /opt/esame/bin/usb start
[Install]
WantedBy=esame.target esame-sa.target
WantedBy=esame.target
......@@ -5,7 +5,7 @@ After=esame-iptables-rules.service esame-get-config.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/local/esame-machine.conf
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/opt/esame/bin/user-sessions start
ExecStop=/opt/esame/bin/user-sessions stop
ExecReload=/opt/esame/bin/user-sessions restart
......
......@@ -5,7 +5,7 @@ After=esame-iptables-rules.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/local/esame-machine.conf
EnvironmentFile=-/local/esame-machine.conf
ExecStart=/opt/esame/bin/virtualbox start
ExecStop=/opt/esame/bin/virtualbox stop
ExecReload=/opt/esame/bin/virtualbox restart
......
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