commit:     10e69db8ae7dc7ccfb1b4f5bad1e6f179c7d9bf1
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 23 19:11:23 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Jul 23 19:11:23 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=10e69db8

Log genkernel start and end time

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_determineargs.sh | 9 ++-------
 gen_funcs.sh         | 5 +++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 549fb59..eb0cd74 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -204,13 +204,8 @@ determine_real_args() {
                small_die "Cannot write to '${LOGFILE}'!"
        fi
 
-       if [ -f "${LOGFILE}" ]
-       then
-               # Truncate existing logfile
-               echo > "${LOGFILE}" 2>/dev/null || small_die "Could not write 
to '${LOGFILE}'!"
-       else
-               touch "${LOGFILE}" || small_die "Failed to create '${LOGFILE}'!"
-       fi
+       GK_TIME_START=$(date +%s)
+       echo ">>> Started genkernel v${GK_V} on: $(date +"%Y-%m-%d %H:%M:%S")" 
> "${LOGFILE}" 2>/dev/null || small_die "Could not write to '${LOGFILE}'!"
 
        dump_debugcache
 

diff --git a/gen_funcs.sh b/gen_funcs.sh
index 33b05b7..3c91372 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -370,6 +370,11 @@ cleanup() {
                print_info 3 "CACHE_DIR: ${CACHE_DIR}"
                print_info 3 "TMPDIR: ${TMPDIR}"
        fi
+
+       GK_TIME_END=$(date +%s)
+       let GK_TIME_RUNTIME_SECONDS=${GK_TIME_END}-${GK_TIME_START}
+       let GK_TIME_RUNTIME_DAYS=${GK_TIME_RUNTIME_SECONDS}/86400
+       TZ= printf ">>> Ended on: $(date +"%Y-%m-%d %H:%M:%S") (after %d 
days%(%k hours %M minutes %S seconds)T)\n" ${GK_TIME_RUNTIME_DAYS} 
${GK_TIME_RUNTIME_SECONDS} >> "${LOGFILE}" 2>/dev/null
 }
 
 clear_tmpdir() {

Reply via email to