diff --git a/.build.sh b/.build.sh
index b9ec3cb7f3962ef2b9c22479467a7a48d5bfdc6a..6ac9c0ea4fb2113cc66b854df5166d75fcd1338e 100755
--- a/.build.sh
+++ b/.build.sh
@@ -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/
diff --git a/.deploy.sh b/.deploy.sh
index d02eac5c5b4f503eaf15e5d3c814b5eecb161bd2..d0bb086f3232debae9d302143b0b59e7333b26f2 100755
--- a/.deploy.sh
+++ b/.deploy.sh
@@ -1,23 +1,33 @@
 #!/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
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd4329bd4d6169897d84be2cd343e82737ab608a..09b85362bc1eab5700db2b70b3f54df40468b591 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,10 +1,25 @@
 ## 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
-
diff --git a/.linter_shell.sh b/.linter_shell.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ba497c762840177e434ab133ad50b0fabc082553
--- /dev/null
+++ b/.linter_shell.sh
@@ -0,0 +1,22 @@
+#!/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
diff --git a/package/debian/changelog b/package/debian/changelog
index 5a46740142ddb24f3ef26fe44206e06b46f54a16..02bf5d51a19fa79999ec26611e6f49357a9090a0 100644
--- a/package/debian/changelog
+++ b/package/debian/changelog
@@ -1,3 +1,15 @@
+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.
diff --git a/package/debian/install b/package/debian/install
index 250a19d63b59688eaed6b6b58c3347bc13c650d7..3b859582a5e5e490b62e0236fa18f31e5e284fd9 100644
--- a/package/debian/install
+++ b/package/debian/install
@@ -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/
diff --git a/package/etc/security/limits.d/maxlogins.conf b/package/etc/security/limits.d/maxlogins.conf
new file mode 100644
index 0000000000000000000000000000000000000000..a0bc59065baf93e0778b26e47bff5bfd53a9675f
--- /dev/null
+++ b/package/etc/security/limits.d/maxlogins.conf
@@ -0,0 +1,3 @@
+#limit all users to one login only
+* hard maxlogins 1
+
diff --git a/package/usr/lib/find-devices b/package/usr/lib/find-devices
index fb5674910875d3896dbcf2769252a9c0e2e3ca80..2858d9b1acef1d1ea42705b79bc0a4d739122dcb 100755
--- a/package/usr/lib/find-devices
+++ b/package/usr/lib/find-devices
@@ -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
 
diff --git a/package/usr/lib/window-acess b/package/usr/lib/window-acess
index 93b01d34afcf57198378b844e8bb941ad347281c..8b0d5a1e411dd73c778516a109088541792e3560 100755
--- a/package/usr/lib/window-acess
+++ b/package/usr/lib/window-acess
@@ -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
 }
diff --git a/package/usr/sbin/configurar-multiterminal b/package/usr/sbin/configurar-multiterminal
deleted file mode 100755
index 5cf87c8ad173c33ed87e1adb9849cc2225cf364e..0000000000000000000000000000000000000000
--- a/package/usr/sbin/configurar-multiterminal
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/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
diff --git a/package/usr/sbin/detect-keyboard b/package/usr/sbin/detect-keyboard
index 9642a91320f0363f2a6628c00657137897631f7b..2de836d0d872ee0f0767760a032eab6f4bb1ab99 100755
--- a/package/usr/sbin/detect-keyboard
+++ b/package/usr/sbin/detect-keyboard
@@ -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
diff --git a/package/usr/sbin/multiseat-controller b/package/usr/sbin/multiseat-controller
index 5a509cbdf9f5e37a9cc17f9794a8ab3a5fae2f5d..e6089e7998d68e7c8e2cbfeb8a8bff03a216d947 100755
--- a/package/usr/sbin/multiseat-controller
+++ b/package/usr/sbin/multiseat-controller
@@ -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
diff --git a/package/usr/sbin/read-devices b/package/usr/sbin/read-devices
index f9f95a695ff7b7d3758b0f9bdd666546daaeecc2..25dada621332f622c5cd1321127058ab4f440c82 100755
Binary files a/package/usr/sbin/read-devices and b/package/usr/sbin/read-devices differ
diff --git a/package/usr/sbin/seat-attach-assistant b/package/usr/sbin/seat-attach-assistant
index deed35460e80fa2ef3b62625d93f9f6d0021e6d9..02f93f84bcba7e916a9c2d01014c1cacd981e0e3 100755
--- a/package/usr/sbin/seat-attach-assistant
+++ b/package/usr/sbin/seat-attach-assistant
@@ -28,4 +28,4 @@
 devpath=$1
 seat_id=seat-$2
 
-loginctl attach ${seat_id} /sys/${devpath}
+loginctl attach "${seat_id}" "/sys/${devpath}"
diff --git a/package/usr/sbin/seat-parent-window b/package/usr/sbin/seat-parent-window
index 5e964faef2b55910e4203586aafdeb1ffdc46033..839fcfc3626cc81321c14531875002ef94bd6fa3 100755
Binary files a/package/usr/sbin/seat-parent-window and b/package/usr/sbin/seat-parent-window differ
diff --git a/package/usr/sbin/update-xorg-conf b/package/usr/sbin/update-xorg-conf
index e65f136e2d6aa3d037cfb6e81953ac6a8c25a48b..26ad2158cbd7f1e848102ebfa5eaf631e40b26f6 100755
--- a/package/usr/sbin/update-xorg-conf
+++ b/package/usr/sbin/update-xorg-conf
@@ -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 ))
diff --git a/package/usr/sbin/write-message b/package/usr/sbin/write-message
index 27bf43c5567a4d4c7bc18541899a31fe63c5f4e6..879c49a6d30dc37f0b1de8f6be1c7f6ae6272a29 100755
Binary files a/package/usr/sbin/write-message and b/package/usr/sbin/write-message differ
diff --git a/package/usr/sbin/xephyr-wrapper b/package/usr/sbin/xephyr-wrapper
index ecf3722b7c193e8b3330548737b02c2c164ec9f7..f22756d65b672899c23b5e344a031388e7423bfa 100755
--- a/package/usr/sbin/xephyr-wrapper
+++ b/package/usr/sbin/xephyr-wrapper
@@ -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
diff --git a/package/usr/sbin/xorg-daemon b/package/usr/sbin/xorg-daemon
index eba7e46d6741cfd592696ce4d09b39dec209805b..00e2fb6d0ea76ad4fe1c4029ddff1e07d3f094dd 100755
--- a/package/usr/sbin/xorg-daemon
+++ b/package/usr/sbin/xorg-daemon
@@ -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