-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetlog
executable file
·56 lines (48 loc) · 2.12 KB
/
getlog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
##################################################################################
# Copyright 2022 steadfasterX <steadfasterX |at| gmail - com>
# Copyright 2023 steadfasterX <steadfasterX |at| gmail - com>
#
# 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.
##################################################################################
VARS="${0%/*}/grm.vars"
source $VARS
FUNCS="${0%/*}/grm.func"
source $FUNCS
F_LOG "getlog script started"
F_WAITBOX getlog "... fetching logs from $REPOSERVER"
PKPID="$!"
KPID=$(cat /tmp/getlog_F_WAITBOX.pid)
F_FETCHLOG
kill $KPID $PKPID
PRETTYPAT=$(echo "$RMPATTERN" | tr ' ' ',')
cat $LOG | $FYAD --title="$YTITLE - DEBUGLOG" --width=800 --height=500 --wrap --text "The following pattern will be automatically removed before uploading:\n<i>$PRETTYPAT</i>\n" --text-info --button="Upload/Paste this log":99 --button=Close:0
ANSW=$?
# remove sensitive data from log before uploading
F_CLEANLOG
# upload log to a paste service
if [ $ANSW -eq 99 ];then
for pastes in haste ix transfer; do
PASTEURL=$($APASTE -s -p $pastes ${LOG}.paste | egrep "Direct")
PASTEURL=${PASTEURL/Direct: /}
echo "${PASTEURL}" | grep -q http
PASTEERR=$?
if [ $PASTEERR -eq 0 ];then
F_MSGOK 700 "Log uploaded successfully!\n\nPlease share this link:\n\n<a href=\"${PASTEURL}\">${PASTEURL}</a>\n(right click, copy link address)\n"
break
else
ERROR=$($APASTE -p $pastes $LOG 2>&1)
F_MSGE 800 "Error in module '$pastes' $PASTEURL while uploading logfile..\n\n$ERROR\n\nClick EXIT for trying next paste service...\n\n"
fi
done
fi