From f29a7bd688608e3866d52148b561b0176f86f777 Mon Sep 17 00:00:00 2001 From: throwaway96 <68320646+throwaway96@users.noreply.github.com> Date: Sat, 20 Apr 2024 14:19:01 -0400 Subject: [PATCH] copy log to USB drive --- README.md | 5 ++++- autoroot.sh | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3ddf254..1e484db 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,16 @@ rebooting. **Do not** install it while your TV is rooted. If the script fails, you must delete `autoroot.once` from the USB drive before it will run again. +A log file named `autoroot.log` should be created on the USB drive. + ## Support You can find more information at [webosbrew.org](https://www.webosbrew.org/). If you need help rooting your TV, try the [OpenLGTV Discord](https://discord.gg/hXMHAgJC5R). Before you ask a question, -check the FAQ (#faq) to see if it is answered there! +check the FAQ (#faq) to see if it is answered there! Attach your `autoroot.log` +when asking for help. ## Credits diff --git a/autoroot.sh b/autoroot.sh index a498f0a..794009d 100755 --- a/autoroot.sh +++ b/autoroot.sh @@ -75,10 +75,13 @@ if ! tempdir="$(mktemp -d -- '/tmp/autoroot.XXXXXX')"; then fi logfile="${tempdir}/log" +touch -- "${logfile}" -loglink='/tmp/autoroot.log' -rm -rf -- "${loglink}" -ln -s -- "${logfile}" "${loglink}" +if [ -n "${DEBUG}" ]; then + loglink='/tmp/autoroot.log' + rm -rf -- "${loglink}" + ln -s -- "${logfile}" "${loglink}" +fi log 'hi' @@ -93,6 +96,8 @@ oncefile="${USB_PATH}/autoroot.once" touch -- "${oncefile}" +trap -- "cp -f -- '${logfile}' '${USB_PATH}/autoroot.log'" EXIT + webos_ver="$(get_sdkversion)" log "webOS version: ${webos_ver}"