Skip to content

Commit

Permalink
Non-arch: fix logging (#940)
Browse files Browse the repository at this point in the history
shell-output.log wasn't getting created at all
  • Loading branch information
AdelKS committed May 11, 2024
1 parent 7776f93 commit 34498b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
29 changes: 15 additions & 14 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@
# Stop the script at any ecountered error
set -e

# save current environment before losing it to the script call
declare -p -x > current_env

# If current run is not using 'script' for logging, do it
if [[ "$_logging_use_script" =~ ^(Y|y|Yes|yes)$ && -z "$SCRIPT" ]]; then
export SCRIPT=1
/usr/bin/script -q -e -c "$0 $@" shell-output.log
exit_status="$?"
sed -i 's/\x1b\[[0-9;]*m//g' shell-output.log
sed -i 's/\x1b(B//g' shell-output.log
mv -f shell-output.log logs/shell-output.log.txt
exit $exit_status
fi

###################### Definition of helper variables and functions

_where=`pwd`
Expand Down Expand Up @@ -51,6 +37,13 @@ plain() {

################### Config sourcing

# We are either not using script or not within the script sub-command yet
# we don't export the environment in the script sub-command so sourcing current_env will
# get us the actual environment
if [[ -z "$SCRIPT" ]]; then
declare -p -x > current_env
fi

source customization.cfg

if [ -e "$_EXT_CONFIG_PATH" ]; then
Expand All @@ -60,6 +53,14 @@ fi

. current_env

if [[ "$_logging_use_script" =~ ^(Y|y|Yes|yes)$ && -z "$SCRIPT" ]]; then
# using script is enabled, but we are not within the script sub-command
export SCRIPT=1
msg2 "Using script"
/usr/bin/script -q -e -c "$0 $@" shell-output.log
exit
fi

source linux-tkg-config/prepare

####################################################################
Expand Down
7 changes: 7 additions & 0 deletions linux-tkg-config/prepare
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,13 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\r

exit_cleanup() {

# Move eventual shell-output.log file to logs folder
if [ -f "$_where/shell-output.log" ]; then
mv -f "$_where"/shell-output.log "$_where"/logs/shell-output.log.txt
sed -i 's/\x1b\[[0-9;]*m//g' "$_where"/logs/shell-output.log.txt
sed -i 's/\x1b(B//g' "$_where"/logs/shell-output.log.txt
fi

# Remove temporarily copied files
rm -rf "$_where"/*.patch
rm -rf "$_where"/*-profile.cfg
Expand Down

0 comments on commit 34498b7

Please sign in to comment.