Commit 032b3d0b authored by Daniel Bissani Furlin's avatar Daniel Bissani Furlin
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !29
parents 67e875e8 dd8c948b
Pipeline #17015 passed with stages
in 7 minutes and 12 seconds
......@@ -2,17 +2,17 @@
# This script generates a .deb package
BUILD_DEPS=$(grep 'Build-Depends' package/debian/control | cut -d' ' -f2- | tr ', ' ' ' | sed -E "s/ \((>|<|=)+[0-9]\)//g")
apt-get update && apt-get install -y devscripts ${BUILD_DEPS}
apt-get update && apt-get install -y devscripts "${BUILD_DEPS}"
CHANGELOG="package/debian/changelog"
LINE=$(head -n 1 $CHANGELOG)
PACKAGE=$(echo $LINE | cut -d' ' -f1)
VERSION=$(echo $LINE | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
tar --exclude=debian -czf ${PACKAGE}_${VERSION}.orig.tar.gz package/*
PACKAGE=$(echo "$LINE" | cut -d' ' -f1)
VERSION=$(echo "$LINE" | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
tar --exclude=debian -czf "${PACKAGE}_${VERSION}.orig.tar.gz" package/*
cd package
cd package || exit 1
debuild -us -uc --lintian-opts --profile debian
cd ../
cd ../ || exit 1
mkdir build/
mv ${PACKAGE}* build/
mv "${PACKAGE}"* build/
#!/bin/bash
# shellcheck disable=SC2029
# This script uploads an includes a .deb package in our debian repository.
# The distribution is chosen based on the gitlab-ci stage we are on.
apt-get update && apt-get install -y dput ssh
eval $(ssh-agent -s)
eval "$(ssh-agent -s)"
ssh-add <(echo "$PRIV_KEY")
echo "Deploy job name: $CI_JOB_NAME"
if [ "$CI_JOB_NAME" = "deploy_for_testing" ]; then
if [ "$CI_JOB_NAME" = "deploy_for_unstable" ]; then
dput -u -f --config=dput.cf repo build/*.changes
elif [ "$CI_JOB_NAME" = "deploy_for_stable" ]; then
else
if [ "$CI_JOB_NAME" = "deploy_for_testing" ]; then
REPO_SRC="unstable"
REPO_TGT="testing"
elif [ "$CI_JOB_NAME" = "deploy_for_stable" ]; then
REPO_SRC="testing"
REPO_TGT="stable"
fi
CHANGELOG="package/debian/changelog"
LINE=$(head -n 1 $CHANGELOG)
PACKAGE=$(echo $LINE | cut -d' ' -f1)
VERSION=$(echo $LINE | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
PACKAGE=$(echo "$LINE" | cut -d' ' -f1)
VERSION=$(echo "$LINE" | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
REPREPRO_CMD="reprepro -Vb /home/repository/www/le6 copysrc $REPO_TGT $REPO_SRC $PACKAGE $VERSION"
REPREPRO_CMD="reprepro -Vb /home/repository/www/le6 copysrc stable testing $PACKAGE $VERSION"
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa repository@repo.c3sl.ufpr.br "$REPREPRO_CMD"
fi
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null repository@repo.c3sl.ufpr.br "$REPREPRO_CMD"
fi
\ No newline at end of file
## Template para empacotamento utilizando o Gitlab-ci.
stages:
- lint
- build
- test
- deploy
lint_shell:
stage: lint
tags:
- debian-packaging
script:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install wget locales locales-all -y
- locale-gen pt_BR.UTF-8
- export LANG=pt_BR.UTF-8
- scversion="stable" # or "v0.4.7", or "latest"
- wget "https://storage.googleapis.com/shellcheck/shellcheck-$scversion.linux.x86_64.tar.xz"
- tar --xz -xvf "shellcheck-$scversion.linux.x86_64.tar.xz"
- shellcheck() { "shellcheck-$scversion/shellcheck" "$@"; }
- ./.linter_shell.sh
build:
stage: build
artifacts:
......@@ -13,23 +28,40 @@ build:
tags:
- debian-packaging
script:
- apt-get update && apt-get install -y build-essential devscripts dh-make dh-systemd quilt
- apt-get update && apt-get install -y libx11-dev libcairo2-dev
- ./.build.sh
test:
stage: test
tags:
- ubuntu
- regular
- debootstrap
script:
# TODO: find a way to get the dependencies automatically
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y udev
- DEBIAN_FRONTEND=noninteractive apt-get -y -q install $(pwd)/build/*.deb
- apt-get update && apt-get install -y wget
- echo "deb http://repo.c3sl.ufpr.br/le6/ unstable main" > /etc/apt/sources.list.d/le6.list
- wget -O- http://repo.c3sl.ufpr.br/le6/le.c3sl.ufpr.br.key | apt-key add -
- echo "Installation test:"
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install $(pwd)/build/*.deb language-pack-gnome-pt language-pack-pt-base
- echo "Removal test:"
- pkg_name=$(head -n 1 package/debian/changelog | cut -d' ' -f1)
- DEBIAN_FRONTEND=noninteractive apt -y remove $pkg_name
dependencies:
- build
deploy_for_unstable:
stage: deploy
only:
- develop
tags:
- debian-packaging
script:
- ./.deploy.sh
dependencies:
- build
deploy_for_testing:
stage: deploy
when: manual
only:
- master
tags:
......@@ -50,4 +82,3 @@ deploy_for_stable:
- ./.deploy.sh
dependencies:
- build
#!/bin/bash
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
sh_files=$(find -name "*.sh")
exe_files=$(grep -Erl "#\!/bin/(bash|sh)" --exclude=*.* package)
files="$sh_files\n$exe_files"
#find no files
if [[ "$files" == "\n" ]];then
echo -e "${YELLOW}No shell files found!${NC}"
exit 0
fi
echo -e "$files"| xargs shellcheck -s bash
if [[ $? -eq 0 ]];then
echo "AWESOME!No problems found."
exit 0
else
echo -e "Understand errors in: ${BLUE}https://github.com/koalaman/shellcheck/wiki${NC}"
exit 1
fi
le-multiterminal (1.0.2) unstable; urgency=medium
* Fix Linter errors
-- Stephanie Briere Americo <lesuporte@c3sl.ufpr.br> Tue, 03 Jul 2018 11:16:31 -0300
le-multiterminal (1.0.1) testing; urgency=medium
* Limits sessions to one per user
-- Stephanie Briere Americo <sba16@c3sl.ufpr.br> Thu, 14 Jun 2018 11:02:18 -0300
le-multiterminal (1.0.0) testing; urgency=medium
* Run udevadm triggers to detect all hubs.
......
......@@ -10,7 +10,6 @@ lib/udev/rules.d/71-seat-usb.rules lib/udev/rules.d/
lib/udev/rules.d/73-seat-attach-assistant.rules lib/udev/rules.d/
usr/lib/find-devices usr/lib/
usr/lib/window-acess usr/lib/
usr/sbin/configurar-multiterminal usr/sbin/
usr/sbin/detect-keyboard usr/sbin/
usr/sbin/multiseat-controller usr/sbin/
usr/sbin/multiterminal usr/sbin/
......@@ -21,3 +20,4 @@ usr/sbin/seat-attach-assistant usr/sbin/
usr/sbin/update-xorg-conf usr/sbin/
usr/sbin/xephyr-wrapper usr/sbin/
usr/sbin/xorg-daemon usr/sbin/
etc/security/limits.d/maxlogins.conf etc/security/limits.d/
#limit all users to one login only
* hard maxlogins 1
......@@ -33,22 +33,18 @@ READ_DEVICES="/usr/sbin/read-devices"
DETECT_KEYBOARDS="/usr/sbin/detect-keyboard"
WRITE_W="write_window" # "window-acess"
## Variables
declare -a SEATS_LISTED # save the name of the existing seats
find_keyboard () {
fKey=$1 # key that this script should expect to be pressed
wNum=$(($fKey-1)) # position in the window control vector
# List all existing seats
SEATS_LISTED=(seat0 $(loginctl list-seats | grep seat-))
wNum=$((fKey-1)) # position in the window control vector
CREATED=0
while test $CREATED -eq 0; do
KEYBOARDS=$($DETECT_KEYBOARDS)
# List all conected keyboards
for i in `ls $MDM_DEVICES | grep "\<keyboard"`; do
# shellcheck disable=SC2010
for i in $(ls "$MDM_DEVICES" | grep "\<keyboard"); do
# shellcheck disable=SC2086
KEYBOARDS=$(sed "s#$i##g" <<< $KEYBOARDS)
done
......@@ -59,7 +55,8 @@ find_keyboard () {
fi
# See if someone presses the expected key
PRESSED=$($READ_DEVICES $fKey $KEYBOARDS | grep '^detect' | cut -d'|' -f2)
# shellcheck disable=SC2086
PRESSED=$($READ_DEVICES "$fKey" $KEYBOARDS | grep '^detect' | cut -d'|' -f2)
# If $READ_DEVICES gets killed the script won't do bad stuff
if test -z "$PRESSED"; then
......@@ -75,16 +72,17 @@ find_keyboard () {
CREATED=1
# Creates a link to the keyboard so no one else can use it
ln -sf $PRESSED $DEVICES/keyboard_$fKey
ln -sf "$PRESSED" "$DEVICES/keyboard_$fKey"
# Check if there is no longer a link to this keyboard
for i in `ls $DEVICES | grep "\<keyboard"`; do
# shellcheck disable=SC2010
for i in $(ls $DEVICES | grep "\<keyboard"); do
if test "$i" != "keyboard_$fKey"; then
AUX=$(stat -c %N $DEVICES/$i | cut -d '>' -f2 | cut -d "'" -f2)
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
rm -f "$DEVICES/keyboard_$fKey"
CREATED=0
fi
fi
......@@ -92,11 +90,11 @@ find_keyboard () {
done
# Find device address
SYS_DEV=/sys$(udevadm info $PRESSED | grep 'P:' | cut -d ' ' -f2- | sed -r 's/event.*$//g')
SYS_DEV=/sys$(udevadm info "$PRESSED" | grep 'P:' | cut -d ' ' -f2- | sed -r 's/event.*$//g')
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)
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 test -z "$SEAT_NAME"; then
......@@ -106,7 +104,7 @@ find_keyboard () {
$WRITE_W ok $wNum
# Write in configuration file
if test $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
......
......@@ -33,20 +33,20 @@ create_window () {
#### ID_WINDOWS and WINDOW_COUNTER are declared in "multiseat-controller".
# Try to access Xorg
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
xdpyinfo -display "${DISPLAY_XORGS[$WINDOW_COUNTER]}"
EXIT_CODE=$?
while test $EXIT_CODE -ne 0; do
sleep 0.5
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
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/')
SCREEN_RESOLUTION=$(xdpyinfo -display "${DISPLAY_XORGS[$WINDOW_COUNTER]}" | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
# Creates a new window for writing on this output
WINDOW_NAME=w$(($WINDOW_COUNTER+1))
$NEW_WINDOW $SCREEN_RESOLUTION+0+0 $WINDOW_NAME &
WINDOW_NAME=w$((WINDOW_COUNTER+1))
$NEW_WINDOW "$SCREEN_RESOLUTION+0+0" $WINDOW_NAME &
# Try to access the window
xwininfo -name $WINDOW_NAME
......@@ -60,10 +60,10 @@ create_window () {
# Get the window id
ID_WINDOWS[$WINDOW_COUNTER]=$(xwininfo -name $WINDOW_NAME | grep "Window id" | cut -d ' ' -f4)
write_window wait_load $WINDOW_COUNTER
write_window wait_load "$WINDOW_COUNTER"
# Increases the number of windows
WINDOW_COUNTER=$(($WINDOW_COUNTER+1))
WINDOW_COUNTER=$((WINDOW_COUNTER+1))
}
write_window() {
......@@ -74,12 +74,12 @@ write_window() {
export DISPLAY=${DISPLAY_XORGS[$2]}
case $1 in
ok)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Monitor configurado, aguarde o restante ficar pronto" ;;
$WRITE_MESSAGE "${ID_WINDOWS[$2]}" "Monitor configurado, aguarde o restante ficar pronto" ;;
wait_load)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Aguarde" ;;
$WRITE_MESSAGE "${ID_WINDOWS[$2]}" "Aguarde" ;;
press_key)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Pressione a tecla F$(($2+1))" ;;
$WRITE_MESSAGE "${ID_WINDOWS[$2]}" "Pressione a tecla F$(($2+1))" ;;
press_mouse)
$WRITE_MESSAGE ${ID_WINDOWS[$2]} "Pressione o botão esquerdo do mouse" ;;
$WRITE_MESSAGE "${ID_WINDOWS[$2]}" "Pressione o botão esquerdo do mouse" ;;
esac
}
#!/bin/bash
# Script adapted from Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
#cd ../../
# roda o script que atualiza as configs do xorg
#POSTINST
#update-xorg-conf "Silicon.Motion" /etc/X11/xorg.conf.d/98-proinfo-*.conf
#systemctl enable le-multiterminal
#systemctl enable xorg-daemon.socket
#systemctl daemon-reload
......@@ -23,9 +23,9 @@
#### Written by: Thiago Abdo - tja14@c3sl.ufpr.br on 2017.
for i in /dev/input/*; do
if test -c $i; then
if udevadm info $i | grep -qw ID_INPUT_KEYBOARD; then
echo $i
if test -c "$i"; then
if udevadm info "$i" | grep -qw ID_INPUT_KEYBOARD; then
echo "$i"
fi
fi
done
......@@ -27,7 +27,9 @@
set -x
## Auxiliary scripts
# shellcheck disable=SC1091
source /usr/lib/find-devices
# shellcheck disable=SC1091
source /usr/lib/window-acess
## Path constants
......@@ -53,14 +55,13 @@ WINDOW_COUNTER=0 # how many windows were created
N_SEATS_LISTED=0 # how many seats are there in the system
ONBOARD=0 # if the onboard is connected
declare -a DISPLAY_XORGS # saves the display of the Xorg launched processes
declare -a ID_WINDOWS # saves the created window ids (used in window-acess)
declare -a PID_FIND_DEVICES # saves the pid from the launched configuration processes
create_onboard_window () {
# Checks if there is a device connected to the onboard card
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))
DISPLAY_XORGS[$WINDOW_COUNTER]=:$((WINDOW_COUNTER+10))
export DISPLAY=${DISPLAY_XORGS[$WINDOW_COUNTER]}
Xorg ${DISPLAY_XORGS[$WINDOW_COUNTER]} &
......@@ -84,7 +85,7 @@ create_onboard_window () {
exit 1
fi
N_ATTEMPT=$(($N_ATTEMPT+1))
N_ATTEMPT=$((N_ATTEMPT+1))
done
$CREATE_WINDOW
......@@ -105,7 +106,7 @@ create_secundarycard_windows () {
DISPLAY_XORGS[$WINDOW_COUNTER]=:$((WINDOW_COUNTER+10))
# Run Xephyr to type in this output
Xephyr ${DISPLAY_XORGS[$WINDOW_COUNTER]} -output $i -noxv &
Xephyr ${DISPLAY_XORGS[$WINDOW_COUNTER]} -output "$i" -noxv &
pid=$!
# Guarantees the Xephyr execution
......@@ -117,7 +118,7 @@ create_secundarycard_windows () {
xdpyinfo -display ${DISPLAY_XORGS[$WINDOW_COUNTER]}
EXIT_CODE=$?
if ! kill -0 "${pid}" >/dev/null 2>&1; then
Xephyr ${DISPLAY_XORGS[$WINDOW_COUNTER]} -output $i -noxv &
Xephyr ${DISPLAY_XORGS[$WINDOW_COUNTER]} -output "$i" -noxv &
pid=$!
fi
......@@ -126,7 +127,7 @@ create_secundarycard_windows () {
exit 1
fi
N_ATTEMPT=$(($N_ATTEMPT+1))
N_ATTEMPT=$((N_ATTEMPT+1))
done
# Export display and create a window to write on this output
......@@ -141,22 +142,23 @@ create_secundarycard_windows () {
configure_devices () {
COUNT=0
for WINDOW in `seq $WINDOW_ID_INIT $(($WINDOW_COUNTER-1))`; do
$FIND_KEYBOARD $(($WINDOW+1)) &
for WINDOW in $(seq $WINDOW_ID_INIT $((WINDOW_COUNTER-1))); do
$FIND_KEYBOARD $((WINDOW+1)) &
PID_FIND_DEVICES[$COUNT]=$!
COUNT=$(($COUNT+1))
COUNT=$((COUNT+1))
$WRITE_WINDOW press_key $WINDOW
$WRITE_WINDOW press_key "$WINDOW"
done
}
kill_jobs () {
# shellcheck disable=SC2010
if test -n "$(ls | grep lock)"; then
rm lock*
fi
if test -n "$(ls $MC3SL_DEVICES)"; then
rm -rf $MC3SL_DEVICES/
rm -rf ${MC3SL_DEVICES:?}/
fi
rm -rf $MC3SL_DEVICES
......@@ -187,7 +189,7 @@ while test $EXIT_CODE -ne 0; do
exit 1
fi
N_ATTEMPT=$(($N_ATTEMPT+1))
N_ATTEMPT=$((N_ATTEMPT+1))
done
udevadm trigger
......@@ -206,20 +208,19 @@ mkdir -p $MC3SL_DEVICES
configure_devices
# Wait until all seats are configured
N_SEATS_LISTED=$(($(loginctl list-seats | grep -c "seat-")+$ONBOARD))
N_SEATS_LISTED=$(($(loginctl list-seats | grep -c "seat-")+ONBOARD))
CONFIGURED_SEATS=0
while test $CONFIGURED_SEATS -lt $N_SEATS_LISTED; do
wait -n ${PID_FIND_DEVICES[*]}
EXIT_CODE=$?
if test $EXIT_CODE -eq 0; then
CONFIGURED_SEATS=$(($CONFIGURED_SEATS+1))
else if test $EXIT_CODE -eq 2; then
CONFIGURED_SEATS=$((CONFIGURED_SEATS+1))
elif test $EXIT_CODE -eq 2; then
echo "[Error] Can not configure output: find-devices failed."
rm -f $MC3SL_CONF
exit 1
fi
fi
done
# Move settings file created for lightdm folder
......
......@@ -28,4 +28,4 @@
devpath=$1
seat_id=seat-$2
loginctl attach ${seat_id} /sys/${devpath}
loginctl attach "${seat_id}" "/sys/${devpath}"
......@@ -31,19 +31,19 @@ while read -r line
do
# substitui : por .
address=$(echo "${line}" | awk '{ sub(/\./, ":", $1) } { print $1 }')
echo VIDEO_ADDRESS_${index} = ${address}
echo VIDEO_ADDRESS_${index} = "${address}"
for xorgconf in "${@}"
do
# atualiza busid no arquivo de configuração conforme o barramento da maquina atual
# sub coloca na sintaxe correta do xorg
awk -v n=${index} -v address=${address} \
awk -v n=${index} -v address="${address}" \
'$1 == "BusID" {
if (++count == n) {
sub(/[0-9]+:[0-9]+:[0-9]+/, address, $0)
}
}
{ print }' ${xorgconf} > ${xorgconf}.tmp && mv ${xorgconf}.tmp ${xorgconf}
{ print }' "${xorgconf}" > "${xorgconf}.tmp" && mv "${xorgconf}.tmp" "${xorgconf}"
done
index=$(( index + 1 ))
......
......@@ -12,12 +12,15 @@ shift
# This is a workaround for the case Xephyr is started before host Xorg
# server is ready for connections, despite the socket activation.
for i in $(seq ${tries})
do
#for i in $(seq ${tries})
i=0
while test $i -lt $tries; do
if xset q >/dev/null 2>&1
then
# shellcheck disable=SC2068
exec Xephyr -dpi 96 -xkb-rules evdev -xkb-layout br -xkb-model abnt2 ${no_xv} ${@}
fi
i=$((i+1))
done
exit 1
......@@ -3,6 +3,6 @@
# Script adapted from Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
num_cards=$(lspci | grep -c Silicon.Motion)
[ ${num_cards} -ne 1 ] && exit 2
[ "${num_cards}" -ne 1 ] && exit 2
exec Xorg ${1} -seat __fake-seat-${num_cards}__ -dpms -s 0 -nocursor
exec Xorg "${1}" -seat "__fake-seat-${num_cards}__" -dpms -s 0 -nocursor
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment