From 7f71f9d962ec1aee3738bd1dc93661d55d835515 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Wed, 25 Oct 2023 14:19:25 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E6=97=A5=E5=BF=97=E7=BD=91=E9=A1=B5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=BC=82=E6=AD=A5=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logviewer-nginx.conf | 17 +++++++ logviewer.html | 105 +++++++++++++++++++++++++++++++++++++++++++ trans.sh | 37 +++------------ 3 files changed, 127 insertions(+), 32 deletions(-) create mode 100644 logviewer-nginx.conf create mode 100644 logviewer.html diff --git a/logviewer-nginx.conf b/logviewer-nginx.conf new file mode 100644 index 0000000..4aee3f1 --- /dev/null +++ b/logviewer-nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80; + listen [::]:80; + root /; + + location = / { + try_files /logviewer.html 404; + } + + location = /reinstall.log { + try_files $uri 404; + } + + location / { + return 404; + } +} \ No newline at end of file diff --git a/logviewer.html b/logviewer.html new file mode 100644 index 0000000..122e976 --- /dev/null +++ b/logviewer.html @@ -0,0 +1,105 @@ + + + + + Reinstall Logs + + + + +
+ + + + + + \ No newline at end of file diff --git a/trans.sh b/trans.sh index 929de98..0c707a5 100644 --- a/trans.sh +++ b/trans.sh @@ -120,20 +120,10 @@ is_use_cloud_image() { setup_nginx() { apk add nginx - cat </etc/nginx/http.d/default.conf - server { - listen 80 default_server; - listen [::]:80 default_server; + # shellcheck disable=SC2154 + wget $confhome/logviewer.html -O /logviewer.html + wget $confhome/logviewer-nginx.conf -O /etc/nginx/http.d/default.conf - location = / { - root /; - try_files /reinstall.html /reinstall.html; - # types { - # text/plain log; - # } - } - } -EOF # rc-service nginx start if pgrep nginx >/dev/null; then nginx -s reload @@ -182,27 +172,10 @@ get_xda() { } setup_tty_and_log() { - cat </reinstall.html - - - - - - - - - -
-EOF
     # 显示输出到前台
     # script -f /dev/tty0
     dev_ttys=$(get_ttys /dev/)
-    exec > >(tee -a $dev_ttys /reinstall.html) 2>&1
+    exec > >(tee -a $dev_ttys /reinstall.log) 2>&1
 }
 
 extract_env_from_cmdline() {
@@ -235,7 +208,7 @@ mod_motd() {
     cat </etc/motd
 Reinstalling...
 To view logs run:
-tail -fn+1 /reinstall.html
+tail -fn+1 /reinstall.log
 EOF
 }