diff --git a/unbox.sh b/unbox.sh
index a925af0..1dcbe4c 100755
--- a/unbox.sh
+++ b/unbox.sh
@@ -24,6 +24,12 @@ function unbox_outer_stage(){
 
     mkdir -p target
     export TARGET=$(pwd)/target
+    export UNBOX_ENV_FILE=$(pwd)/.env
+    
+    if [ -e .env ]; then
+        rm .env
+    fi
+    
 
     if type -t first_stage > /dev/null; then
         first_stage
@@ -51,18 +57,31 @@ function unbox_outer_stage(){
     else
         echo no post_install_stage found
     fi
+    if [ -e ${UNBOX_ENV_FILE} ]; then
+        rm ${UNBOX_ENV_FILE}
+    fi
     exit 0
 }
 
 function unbox_inner_stage(){
     echo "-----------SECOND STAGE-----------"
-    #echo $@
-    source repo/entry.sh
+    export UNBOX_ENV_FILE=$(pwd)/.env
+    if [ -e ${UNBOX_ENV_FILE} ]; then
+        source ${UNBOX_ENV_FILE}
+    fi
+    if [ -e repo/entry.sh ]; then
+        source repo/entry.sh
+    else
+        echo chosen repository does not contain entry.sh file
+    fi
     if type -t second_stage > /dev/null; then
         second_stage
     else
         echo second stage not found
     fi
+    if [ -e ${UNBOX_ENV_FILE} ]; then
+        rm ${UNBOX_ENV_FILE}
+    fi
     exit 0
 }
 
diff --git a/utils.sh b/utils.sh
index b2ec8dd..6046b53 100755
--- a/utils.sh
+++ b/utils.sh
@@ -6,6 +6,17 @@ function prefix_time(){
 	done
 }
 
+function export_env(){
+	if [ $# -lt 2 ]; then
+		echo not enogh arguments for export_env
+		exit 1
+	fi
+	VAR=${1}
+	shift
+	echo ${VAR}=${@} >> ${UNBOX_ENV_FILE}
+	export ${VAR}=${@}
+}
+
 function mem_size(){
 	echo $(($(cat /proc/meminfo | grep MemTotal | awk '{print $2}')*1024))
 }