diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0fa945d..a93f8b0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,21 @@
-before_script:
-  - sudo apt-get update -qq && sudo apt-get install -y -qq build-essential dpkg-dev libssl-dev debhelper
-stages:
-  - build
-
-
-debian_386_amd64:
+debian_amd64:
   stage: build
   script:
     - make debian-package
+    - cp ../cronos*.deb .
+    - rm ../cronos*
+  only:
+    - master
+  artifacts:
+    paths:
+    - cronos*.deb
+  tags:
+    - debian
+    - amd64
+    
+debian_386:
+  stage: build
+  script:
     - ARCH=i386 make debian-package
     - cp ../cronos*.deb .
     - rm ../cronos*
@@ -19,4 +27,18 @@ debian_386_amd64:
   tags:
     - debian
     - i386
-    - amd64
\ No newline at end of file
+
+debian_armhf:
+  stage: build
+  script:
+    - make debian-package
+    - cp ../cronos*.deb .
+    - rm ../cronos*
+  only:
+    - master
+  artifacts:
+    paths:
+    - cronos*.deb
+  tags:
+    - debian
+    - armv6
\ No newline at end of file
diff --git a/Makefile b/Makefile
index cb924ba..4ac91b3 100644
--- a/Makefile
+++ b/Makefile
@@ -7,10 +7,11 @@ PREFIX = $(DESTDIR)/opt/CronosAgent
 
 ifeq ($(OS), Linux)
   FLAGS += -rdynamic
-  KIND := $(shell grep -E "^6.0" /etc/debian_version > /dev/null ; echo $?)
-ifneq ($(KIND), 0)
+ifeq ($(shell lsb_release -i -s), Debian)
+ifeq ($(shell grep -E "^6.0" /etc/debian_version > /dev/null ; echo $?), 0)
   LIBRARIES += rt
 endif
+endif
 ifeq ($(USE_OPENSSL), yes)
   FLAGS += -DUSE_OPENSSL
   DEPENDENCIES += openssl
diff --git a/OpenWRT/Makefile b/OpenWRT/Makefile
index b62948d..b5cbffc 100644
--- a/OpenWRT/Makefile
+++ b/OpenWRT/Makefile
@@ -1,10 +1,12 @@
 include $(TOPDIR)/rules.mk
 
+X_DOLLAR:=$$
+X_SOURCE_DIR:=$(CURDIR)/source
+
 PKG_NAME:=cronosagent
 PKG_VERSION:=$(shell grep -o -E '[0-9]+' $(CURDIR)/source/Version.h)
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_BUILD_DEPENDS:=
-X_SOURCE_DIR:=$(CURDIR)/source
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -52,10 +54,10 @@ define Package/cronosagent/postinst
 /etc/init.d/cronosagent start
 
 grep cronosagent /etc/crontabs/root > /dev/null
-if [ "$?" -eq "1" ]
+if [ "$(X_DOLLAR)?" -eq "1" ]
 then
 cat << EOF >> /etc/crontabs/root
-*/10 * * * * test -n "$(ls /etc/rc.d/S??cronosagent)" -a -z "$(pidof cronosagent)" && /etc/init.d/cronosagent start
+*/10 * * * * test -n "$(X_DOLLAR)(ls /etc/rc.d/S??cronosagent)" -a -z "$(X_DOLLAR)(pidof cronosagent)" && /etc/init.d/cronosagent start
 EOF
 fi