App details view log button if corrupted

pull/779/head
Botspot 4 years ago
parent 8578543a66
commit a932f33cad

@ -5,6 +5,9 @@
DIRECTORY="$(readlink -f "$(dirname "$(dirname "$0")")")" DIRECTORY="$(readlink -f "$(dirname "$(dirname "$0")")")"
file="$6" file="$6"
if [ -z "$file" ];then
file="$1"
fi
echo "$file" > "$DIRECTORY/data/current-viewed-logfile" echo "$file" > "$DIRECTORY/data/current-viewed-logfile"
if command -v mousepad ;then if command -v mousepad ;then
@ -20,7 +23,8 @@ else
pid=$! pid=$!
fi fi
while [ "$(cat "$DIRECTORY/data/current-viewed-logfile")" == "$file" ];do #while the user-selection stays the same, AND the text editor is still running, wait.
while [ "$(cat "$DIRECTORY/data/current-viewed-logfile")" == "$file" ] && kill -0 $pid;do
sleep 1 sleep 1
done done
kill $pid 2>/dev/null kill $pid 2>/dev/null

12
gui

@ -424,6 +424,13 @@ This app installed these packages: $(cat "${DIRECTORY}/data/installed-packages/$
#if disabled, display no buttons #if disabled, display no buttons
whichbutton+=("--button=<b>Enable</b>!!Force this app to install on your system."$'\n'"This app was disabled for a reason so if you enable it..."$'\n'"YOU HAVE BEEN WARNED.:12") whichbutton+=("--button=<b>Enable</b>!!Force this app to install on your system."$'\n'"This app was disabled for a reason so if you enable it..."$'\n'"YOU HAVE BEEN WARNED.:12")
else else
#if app status is 'corrupted', and a log file exists for this app, then display a button to view the log file
if [ "$(app_status "${output}")" == 'corrupted' ];then
logfile="$(ls "$DIRECTORY/logs"/* -t | grep "fail-${output}" | head -n1)"
if [ ! -z "$logfile" ];then
whichbutton+=("--button=Errors!${DIRECTORY}/icons/log-file.png!$output failed to $(echo "$(basename "$logfile")" | awk -F'-' '{print $1}'). Click this button to view the error output saved in the log file.:14")
fi
fi
#if status is corrupted or unknown, then show both buttons #if status is corrupted or unknown, then show both buttons
whichbutton+=("--button=!${DIRECTORY}/icons/uninstall.png:2" "--button=!${DIRECTORY}/icons/install.png:4") whichbutton+=("--button=!${DIRECTORY}/icons/uninstall.png:2" "--button=!${DIRECTORY}/icons/install.png:4")
fi fi
@ -483,6 +490,11 @@ This app installed these packages: $(cat "${DIRECTORY}/data/installed-packages/$
#remove status file containing 'disabled' #remove status file containing 'disabled'
rm -f "${DIRECTORY}/data/status/${app}" rm -f "${DIRECTORY}/data/status/${app}"
;; ;;
14)
echo "Viewing error log of $output..."
echo "Log filepath: $logfile"
"${DIRECTORY}/etc/viewlog" "$logfile"
;;
*) *)
error 'unknown button. Exiting now.' error 'unknown button. Exiting now.'
exit 1 exit 1

Loading…
Cancel
Save