This commit is contained in:
j3d1 2020-01-31 15:29:45 +01:00
parent 1a0bda34de
commit aaf8c2b72c
2 changed files with 32 additions and 2 deletions

View file

@ -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
}

View file

@ -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))
}