Skip to content
Snippets Groups Projects
Commit b4d0ff68 authored by Thiago Abdo's avatar Thiago Abdo
Browse files

Merge branch 'issue/385' into 'master'

SCRUM#385: Update ifs to the default used by c3sl (test command)

See merge request !12
parents 0e185e5a 13c7c78b
No related branches found
No related tags found
1 merge request!12SCRUM#385: Update ifs to the default used by c3sl (test command)
Pipeline #
le-multiterminal (0.0.3) testing; urgency=medium
* Update ifs to the default used by c3sl (test command)
-- Stephanie Briere Americo <sba16@c3sl.ufpr.br> Wed, 17 Jan 2018 11:47:50 -0200
le-multiterminal (0.0.2) testing; urgency=medium
* Check for scripting failure and abort with error
......
#!/bin/bash
for i in /dev/input/*; do
if [ -c $i ]; then
if test -c $i; then
if udevadm info $i | grep -qw ID_INPUT_KEYBOARD; then
echo $i
fi
......
......@@ -44,7 +44,7 @@ find_keyboard () {
SEATS_LISTED=(seat0 $(loginctl list-seats | grep seat-))
CREATED=0
while (( ! CREATED )); do
while test $CREATED -eq 0; do
KEYBOARDS=$($DETECT_KEYBOARDS)
# List all conected keyboards
......@@ -53,7 +53,7 @@ find_keyboard () {
done
# If no keyboard is connected, you can not proceed
if [ -z "$KEYBOARDS" ]; then
if test -z "$KEYBOARDS"; then
echo "[Error] No keyboards connected"
exit 1
fi
......@@ -62,12 +62,12 @@ find_keyboard () {
PRESSED=$($READ_DEVICES $fKey $KEYBOARDS | grep '^detect' | cut -d'|' -f2)
# If $READ_DEVICES gets killed the script won't do bad stuff
if [ -z "$PRESSED" ]; then
if test -z "$PRESSED"; then
continue
fi
# If the key has not yet been processed, continue to wait
if [ "$PRESSED" = 'timeout' ]; then
if test "$PRESSED" = 'timeout'; then
continue
fi
......@@ -79,14 +79,14 @@ find_keyboard () {
# Check if there is no longer a link to this keyboard
for i in `ls $DEVICES | grep "\<keyboard"`; do
if [ "$i" != "keyboard_$fKey" ]; then
AUX=$(stat -c %N $DEVICES/$i | cut -d '>' -f2 | cut -d "'" -f2)
if [ "$AUX" = "$PRESSED" ]; then
# Keyboard link already exists, try again
rm -f $DEVICES/keyboard_$fKey
CREATED=0
fi
if test "$i" != "keyboard_$fKey"; then
AUX=$(stat -c %N $DEVICES/$i | cut -d '>' -f2 | cut -d "'" -f2)
if test "$AUX" = "$PRESSED"; then
# Keyboard link already exists, try again
rm -f $DEVICES/keyboard_$fKey
CREATED=0
fi
fi
done
done
......@@ -94,19 +94,19 @@ find_keyboard () {
# Find device address
SYS_DEV=/sys$(udevadm info $PRESSED | grep 'P:' | cut -d ' ' -f2- | sed -r 's/event.*$//g')
if [ -n "$SYS_DEV" ]; then
if test -n "$SYS_DEV"; then
# Now we know the seat/output
SEAT_NAME=$(udevadm info -p $SYS_DEV | grep ID_SEAT | cut -d '=' -f2)
# Sometimes the devices that belong to seat0 do not have ID_SEAT
if [ -z "$SEAT_NAME" ]; then
if test -z "$SEAT_NAME"; then
SEAT_NAME=seat0
fi
$WRITE_W ok $wNum
# Write in configuration file
if [[ $fKey -gt 1 ]]; then
if test $fKey -gt 1; then
echo -e "[Seat:$SEAT_NAME]\nxserver-command=xephyr-wrapper :90.0 -output ${OUTPUTS[$((wNum-1))]}\n" >> $CONF
fi
......
......@@ -60,7 +60,7 @@ declare -a PID_FIND_DEVICES # saves the pid from the launched configuration proc
create_onboard_window () {
# Checks if there is a device connected to the onboard card
if [ "$(cat "/sys$(udevadm info /sys/class/drm/card0 | grep "P:" | cut -d " " -f2)/card0-VGA-1/status")" == "connected" ]; then
if test "$(cat "/sys$(udevadm info /sys/class/drm/card0 | grep "P:" | cut -d " " -f2)/card0-VGA-1/status")" == "connected"; then
# Runs Xorg and creates the window for the onboard card
DISPLAY_XORGS[$WINDOW_COUNTER]=:$(($WINDOW_COUNTER+10))
export DISPLAY=${DISPLAY_XORGS[$WINDOW_COUNTER]}
......@@ -72,7 +72,7 @@ create_onboard_window () {
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
EXIT_CODE=$?
N_ATTEMPT=0
while [[ $EXIT_CODE -ne 0 ]]; do
while test $EXIT_CODE -ne 0; do
sleep 0.5
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
EXIT_CODE=$?
......@@ -81,7 +81,7 @@ create_onboard_window () {
pid=$!
fi
if [[ $N_ATTEMPT -gt $MAX_ATTEMPTS ]]; then
if test $N_ATTEMPT -gt $MAX_ATTEMPTS; then
echo "[Error] Run Xorg ${DISPLAY_XORGS[$WINDOW_COUNTER]} failed."
exit 1
fi
......@@ -114,7 +114,7 @@ create_secundarycard_windows () {
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
EXIT_CODE=$?
N_ATTEMPT=0
while [[ $EXIT_CODE -ne 0 ]]; do
while test $EXIT_CODE -ne 0; do
sleep 0.5
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
EXIT_CODE=$?
......@@ -123,7 +123,7 @@ create_secundarycard_windows () {
pid=$!
fi
if [[ $N_ATTEMPT -gt $MAX_ATTEMPTS ]]; then
if test $N_ATTEMPT -gt $MAX_ATTEMPTS; then
echo "[Error] Run Xephyr ${DISPLAY_XORGS[$WINDOW_COUNTER]} failed."
exit 1
fi
......@@ -153,11 +153,11 @@ configure_devices () {
}
kill_jobs () {
if [[ -n "$(ls | grep lock)" ]]; then
if test -n "$(ls | grep lock)"; then
rm lock*
fi
if [[ -n "$(ls $MC3SL_DEVICES)" ]]; then
if test -n "$(ls $MC3SL_DEVICES)"; then
rm -rf $MC3SL_DEVICES/
fi
......@@ -175,7 +175,7 @@ pid=$!
xdpyinfo -display $FAKE_DISPLAY
EXIT_CODE=$?
N_ATTEMPT=0
while [[ $EXIT_CODE -ne 0 ]]; do
while test $EXIT_CODE -ne 0; do
sleep 0.5
xdpyinfo -display $FAKE_DISPLAY
EXIT_CODE=$?
......@@ -184,7 +184,7 @@ while [[ $EXIT_CODE -ne 0 ]]; do
pid=$!
fi
if [[ $N_ATTEMPT -gt $MAX_ATTEMPTS ]]; then
if test $N_ATTEMPT -gt $MAX_ATTEMPTS; then
echo "[Error] Run Xorg $FAKE_DISPLAY -seat $FAKE_SEAT failed."
exit 1
fi
......@@ -207,13 +207,13 @@ configure_devices
# Wait until all seats are configured
N_SEATS_LISTED=$(($(loginctl list-seats | grep -c "seat-")+$ONBOARD))
CONFIGURED_SEATS=0
while [[ $CONFIGURED_SEATS -lt $N_SEATS_LISTED ]]; do
while test $CONFIGURED_SEATS -lt $N_SEATS_LISTED; do
wait -n ${PID_FIND_DEVICES[*]}
EXIT_CODE=$?
if [[ $EXIT_CODE -eq 0 ]]; then
if test $EXIT_CODE -eq 0; then
CONFIGURED_SEATS=$(($CONFIGURED_SEATS+1))
else if [[ $EXIT_CODE -eq 2 ]]; then
else if test $EXIT_CODE -eq 2; then
echo "[Error] Can not configure output: find-devices.sh failed."
rm -f $MC3SL_CONF
exit 1
......
......@@ -7,18 +7,18 @@
set -x
####LOGFILE
if [ ! -d /var/log/le-multiterminal ]; then
if test ! -d /var/log/le-multiterminal; then
mkdir -p /var/log/le-multiterminal
fi
CONFIG_FLAG=0
if [ ! -e /etc/le-multiterminal/configurado ]; then
if test ! -e /etc/le-multiterminal/configurado; then
touch /etc/le-multiterminal/configurado
CONFIG_FLAG=1
fi
if [ $CONFIG_FLAG -eq 1 ]; then
if test $CONFIG_FLAG -eq 1; then
/opt/le-multiterminal/multiseat-controller.sh >> /var/log/le-multiterminal/controller.log 2>&1
reboot
fi
......@@ -24,7 +24,7 @@
#### There should already be an Xorg/Xephyr running in this display.
#### Written by: Stephanie Briere Americo - sba16@c3sl.inf.ufpr.br on 2017.
## Script/function in other file
## Script/function in other file
NEW_WINDOW="seat-parent-window" # it receives as parameter <RESOLUTION>x<X_Initial>+<Y_Inicial>
WRITE_MESSAGE="write-message" # it receives as parameter <ID_WINDOW> <Message>
......@@ -35,12 +35,12 @@ create_window () {
# Try to access Xorg
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
EXIT_CODE=$?
while [[ $EXIT_CODE -ne 0 ]]; do
while test $EXIT_CODE -ne 0; do
sleep 0.5
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
EXIT_CODE=$?
done
# Get screen resolution
SCREEN_RESOLUTION=$(xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]} | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
......@@ -51,7 +51,7 @@ create_window () {
# Try to access the window
xwininfo -name $WINDOW_NAME
EXIT_CODE=$?
while [[ $EXIT_CODE -ne 0 ]]; do
while test $EXIT_CODE -ne 0; do
sleep 0.5
xwininfo -name $WINDOW_NAME
EXIT_CODE=$?
......@@ -61,25 +61,25 @@ create_window () {
ID_WINDOWS[$WINDOW_COUNTER]=$(xwininfo -name $WINDOW_NAME | grep "Window id" | cut -d ' ' -f4)
write_window wait_load $WINDOW_COUNTER
# Increases the number of windows
WINDOW_COUNTER=$(($WINDOW_COUNTER+1))
}
write_window() {
#### Description: Writes in a specific window on a particular display.
#### Parameters: $1 - message to be written; $2 - display to be used.
#### Parameters: $1 - message to be written; $2 - display to be used.
#### DISPLAY_XORGS and ID_WINDOWS are declared in "multiseat-controller.sh".
export DISPLAY=${DISPLAY_XORGS[$2]}
case $1 in
ok)
ok)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Monitor configurado, aguarde o restante ficar pronto" ;;
wait_load)
wait_load)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Aguarde" ;;
press_key)
press_key)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Pressione a tecla F$(($2+1))" ;;
press_mouse)
press_mouse)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Pressione o botão esquerdo do mouse" ;;
esac
}
\ No newline at end of file
}
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