Merge "Unify tidy up logs in lib/img-functions"

This commit is contained in:
Jenkins 2017-02-03 00:29:48 +00:00 committed by Gerrit Code Review
commit 111cb51055
3 changed files with 12 additions and 30 deletions

View File

@ -1,30 +0,0 @@
#!/bin/bash
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# Truncate /var/log files in preparation for first boot
sudo find $TARGET_ROOT/var/log -type f -exec cp /dev/null '{}' \;
# also /root logs
sudo find $TARGET_ROOT/root -name \*.log -type f -delete

View File

@ -110,6 +110,10 @@ function finalise_base () {
unmount_dir $TMP_MOUNT_PATH/tmp
fi
find $TMP_MOUNT_PATH/tmp -maxdepth 1 -mindepth 1 | xargs sudo rm -rf --one-file-system
# Truncate /var/log files in preparation for first boot
sudo find ${TMP_MOUNT_PATH}/var/log -type f -exec cp /dev/null '{}' \;
# also /root logs
sudo find ${TMP_MOUNT_PATH}/root -name \*.log -type f -delete
}
function compress_and_save_image () {

View File

@ -0,0 +1,8 @@
---
features:
- Cleaning logs was split, some was done in the
img-functions.finalise_base, some was done in the base element.
The version unifies tidy up logs in the lib/img-functions.
Especially when building docker container images the base element
cannot be used. This patch removes about some hundreds KB of
useless logs in cases when the base element is not used.