lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 565e243 10/10: Write log files elsewhere


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 565e243 10/10: Write log files elsewhere
Date: Thu, 28 May 2020 20:34:10 -0400 (EDT)

branch: master
commit 565e2435cfe65b2e48865d66e586b31a60a28c68
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Write log files elsewhere
    
    Write logs to /srv/cache_for_lmi/logs/ because it an "identity mount"
    representing a location on the host system. Formerly, logs were written
    to directories inside a (possibly nested) chroot, and preserved by
    copying them to the host (by nesting-dependent commands).
    
    Add a common timestamp suffix to these logs' names, and archive them.
---
 install_centos.sh | 18 +++++++++++++-----
 install_redhat.sh | 18 +++++++++++++-----
 lmi_setup_00.sh   | 18 +++++++++++++-----
 lmi_setup_20.sh   |  6 ++++--
 lmi_setup_42.sh   |  4 +++-
 5 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/install_centos.sh b/install_centos.sh
index 262a9b1..78eb2dd 100755
--- a/install_centos.sh
+++ b/install_centos.sh
@@ -90,14 +90,22 @@ set -evx
 assert_su
 assert_not_chrooted
 
-./lmi_setup_00c.sh
+# Timestamp suffix for log file names (no colons, for portability).
+fstamp=$(date -u +"%Y%m%dT%H%MZ" -d "$stamp0")
+
+logdir=/srv/cache_for_lmi/logs
+mkdir -p "${logdir}"
+./lmi_setup_00c.sh >"${logdir}"/chroot-log_"${fstamp}" 2>&1
 
 # Copy log files that may be useful for tracking down problems with
 # certain commands whose output is voluminous and often uninteresting.
-# Embed a timestamp in the copies' names (no colons, for portability).
-fstamp=$(date -u +"%Y%m%dT%H%MZ" -d "$stamp0")
-cp -a /srv/chroot/centos7lmi/srv/chroot/${CHRTNAME}/home/"${NORMAL_USER}"/log 
/home/"${NORMAL_USER}"/lmi_rhlog_"${fstamp}"
-cp -a 
/srv/chroot/centos7lmi/srv/chroot/${CHRTNAME}/tmp/${CHRTNAME}-apt-get-log 
/home/"${NORMAL_USER}"/apt-get-log-"${fstamp}"
+# Archive them for easy sharing.
+(cd "${logdir}"
+for z in "${CHRTNAME}"-apt-get-log lmi-log; do
+  mv "${z}" "${z}_${fstamp}"
+done
+tar -cJvf chroot-logs_"${fstamp}".tar.xz ./*"${fstamp}"
+)
 
 stamp1=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
 echo "Finished: $stamp1"
diff --git a/install_redhat.sh b/install_redhat.sh
index 3ce035a..b0ce7d4 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -90,14 +90,22 @@ set -evx
 assert_su
 assert_not_chrooted
 
-./lmi_setup_01r.sh
+# Timestamp suffix for log file names (no colons, for portability).
+fstamp=$(date -u +"%Y%m%dT%H%MZ" -d "$stamp0")
+
+logdir=/srv/cache_for_lmi/logs
+mkdir -p "${logdir}"
+./lmi_setup_01r.sh >"${logdir}"/chroot-log_"${fstamp}" 2>&1
 
 # Copy log files that may be useful for tracking down problems with
 # certain commands whose output is voluminous and often uninteresting.
-# Embed a timestamp in the copies' names (no colons, for portability).
-fstamp=$(date -u +"%Y%m%dT%H%MZ" -d "$stamp0")
-cp -a /srv/chroot/${CHRTNAME}/home/"${NORMAL_USER}"/log 
/home/"${NORMAL_USER}"/lmi_rhlog_"${fstamp}"
-cp -a /srv/chroot/${CHRTNAME}/tmp/${CHRTNAME}-apt-get-log 
/home/"${NORMAL_USER}"/apt-get-log-"${fstamp}"
+# Archive them for easy sharing.
+(cd "${logdir}"
+for z in "${CHRTNAME}"-apt-get-log lmi-log; do
+  mv "${z}" "${z}_${fstamp}"
+done
+tar -cJvf chroot-logs_"${fstamp}".tar.xz ./*"${fstamp}"
+)
 
 stamp1=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
 echo "Finished: $stamp1"
diff --git a/lmi_setup_00.sh b/lmi_setup_00.sh
index 5485464..c182c3b 100755
--- a/lmi_setup_00.sh
+++ b/lmi_setup_00.sh
@@ -90,14 +90,22 @@ set -evx
 assert_su
 assert_not_chrooted
 
-./lmi_setup_01.sh
+# Timestamp suffix for log file names (no colons, for portability).
+fstamp=$(date -u +"%Y%m%dT%H%MZ" -d "$stamp0")
+
+logdir=/srv/cache_for_lmi/logs
+mkdir -p "${logdir}"
+./lmi_setup_01.sh >"${logdir}"/chroot-log_"${fstamp}" 2>&1
 
 # Copy log files that may be useful for tracking down problems with
 # certain commands whose output is voluminous and often uninteresting.
-# Embed a timestamp in the copies' names (no colons, for portability).
-fstamp=$(date -u +"%Y%m%dT%H%MZ" -d "$stamp0")
-cp -a /srv/chroot/${CHRTNAME}/home/"${NORMAL_USER}"/log 
/home/"${NORMAL_USER}"/lmi_rhlog_"${fstamp}"
-cp -a /srv/chroot/${CHRTNAME}/tmp/${CHRTNAME}-apt-get-log 
/home/"${NORMAL_USER}"/apt-get-log-"${fstamp}"
+# Archive them for easy sharing.
+(cd "${logdir}"
+for z in "${CHRTNAME}"-apt-get-log lmi-log; do
+  mv "${z}" "${z}_${fstamp}"
+done
+tar -cJvf chroot-logs_"${fstamp}".tar.xz ./*"${fstamp}"
+)
 
 stamp1=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
 echo "Finished: $stamp1"
diff --git a/lmi_setup_20.sh b/lmi_setup_20.sh
index 5655233..e6a58ae 100755
--- a/lmi_setup_20.sh
+++ b/lmi_setup_20.sh
@@ -111,15 +111,17 @@ mount -t proc -o rw,nosuid,nodev,noexec,relatime proc 
/proc
 # of scripts installs a debian chroot on any host system, and builds
 # only in that chroot.
 
+logdir=/srv/cache_for_lmi/logs
+mkdir -p "${logdir}"
 apt-get update
 apt-get --assume-yes install wget g++-mingw-w64 automake libtool make \
  pkg-config git cvs zsh bzip2 unzip sudo wine default-jre jing trang \
  g++-multilib libxml2-utils libxslt1-dev vim-gtk vim-doc shellcheck \
  bc libarchive-tools xsltproc rsync curl \
- >"${CHRTNAME}"-apt-get-log 2>&1
+ >"${logdir}/${CHRTNAME}"-apt-get-log 2>&1
 
 # This command should produce little output:
-<"${CHRTNAME}"-apt-get-log tr -d '\r' | sed \
+< "${logdir}/${CHRTNAME}"-apt-get-log tr -d '\r' | sed \
  -e'0,/^Preconfiguring/d' \
  -e'/^Fetched\|^Preparing\|^Unpacking\|^Configuring\|^Selecting/d' \
  -e'/^Setting up\|^Processing\|^Adding\|^update-alternatives\|^[Dd]one./d' \
diff --git a/lmi_setup_42.sh b/lmi_setup_42.sh
index 70b7817..8cc82fc 100755
--- a/lmi_setup_42.sh
+++ b/lmi_setup_42.sh
@@ -34,7 +34,9 @@ assert_chrooted
 cd ~ || { printf 'failed: cd\n'; exit 3; }
 wget -N -nv "${GIT_URL_BASE}"/install_msw.sh
 chmod +x install_msw.sh
-./install_msw.sh >log 2>&1
+logdir=/srv/cache_for_lmi/logs
+mkdir -p "${logdir}"
+./install_msw.sh >"${logdir}"/lmi-log 2>&1
 
 # Now everything should work much as it does in native msw. To run an
 # msw program, prefix its command line with 'wine'. Test the chroot by



reply via email to

[Prev in Thread] Current Thread [Next in Thread]