Commit aa0746c7 authored by Alessandro Elias's avatar Alessandro Elias
Browse files

Change the way is logged to a file.


Signed-off-by: Alessandro Elias's avatarAlessandro Elias <ae11@c3sl.ufpr.br>
parent 71fa8ea4
......@@ -13,23 +13,15 @@ emergency_shell() {
exit 1
}
log() {
local _TYPE=$1
local _TXT=$(echo $@ | cut -d' ' -f2-)
local _FILE=${PREFIX}/log/${DIST}/${_TYPE}-create-iso.log
if [ "$_TXT" ]; then
if [ "$LOGINFO" ]; then
echo "${_TYPE}: ${_TXT}" | tee -a $_FILE
else
echo "${_TYPE}: ${_TXT}"
fi
fi
if [ "${_TYPE}" == "ERROR" ]; then
emergency_shell
fi
function log() {
local type=$1
local msg=$2
echo "$msg" 1>&2 >> "$LOG_FILE"
}
initChroot() {
set -x
local chrootdir="$1"
local logfile="$2"
......@@ -102,6 +94,19 @@ execChroot() {
[ ! -x "$chrootdir/tmp/$SCRIPT_NAME" ] && chmod +x "$chrootdir/tmp/$SCRIPT_NAME"
read a
chroot "$chrootdir" "/tmp/$SCRIPT_NAME"
rm -rf "$chrootdir/tmp/$SCRIPT_NAME" &>/dev/null
return $?
}
function cleanup() {
local chrootdir="$1"
local tmp="$2"
umount --lazy "${chrootdir}/etc/resolv.conf"
umount --lazy "${chrootdir/$LOG_FILE"
umount --lazy "${chrootdir}/{dev/pts,proc,sys,dev}"
rm -rf "$chrootdir"
rm -rf "$tmp"
}
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