|
@@ -4,6 +4,21 @@ set -o errexit #>Exit when a command fails (returns non-zero)
|
|
|
set -o pipefail #>Exit when a command within a pipeline fail (returns non-zero)
|
|
|
set -o nounset #>Forbid to use unse
|
|
|
|
|
|
+declare -A Paths
|
|
|
+Paths[sys]="$HOME"/lognconf_systeminfo.md
|
|
|
+Paths[log]="$HOME"/lognconf_logging.md
|
|
|
+Paths[url]="https://notabug.org/megavolt/random-scripts/raw/master/lognconf-report.sh"
|
|
|
+
|
|
|
+if [[ ! -t 0 ]] ; then
|
|
|
+ echo "Pipe detected!"
|
|
|
+ echo "Please don't pipe the script. Run it like that:"
|
|
|
+ echo "* bash <(curl -s "${Paths[url]}")"
|
|
|
+ echo "* curl -s ${Paths[url]} > /tmp/lncr.sh && bash /tmp/lncr.sh"
|
|
|
+ echo "* bash lognconf-report.sh"
|
|
|
+ echo "* chmod +x lognconf-report.sh && ./lognconf-report.sh"
|
|
|
+ exit
|
|
|
+fi
|
|
|
+
|
|
|
export LANG=C
|
|
|
|
|
|
declare -A BootConfigs
|
|
@@ -21,10 +36,6 @@ declare -A BootLogs
|
|
|
BootLogs[xorgsys]='/var/log/'
|
|
|
BootLogs[xorghme]="$HOME/.local/share/xorg/"
|
|
|
|
|
|
-declare -A Paths
|
|
|
-Paths[sys]="$HOME"/lognconf_systeminfo.md
|
|
|
-Paths[log]="$HOME"/lognconf_logging.md
|
|
|
-
|
|
|
OutPut=""
|
|
|
|
|
|
function GetINXI ()
|
|
@@ -169,20 +180,17 @@ InPut="$(GetSystemJournals current)"
|
|
|
InPut="$(GetSystemJournals previous)"
|
|
|
[[ -n "${InPut}" ]] && Logs+="\n\n#### Previous System Journals\n\n~~~\n${InPut}\n~~~\n\n"
|
|
|
|
|
|
-while true; do
|
|
|
- read -p "Would you like to view [v] the content? (View[v]/No[n]) " vn
|
|
|
- case $vn in
|
|
|
- [Vv]) echo -e "${OutPut}""${Logs}" | less ;;
|
|
|
- [Nn]) break ;;
|
|
|
- *) continue ;;
|
|
|
- esac
|
|
|
-done
|
|
|
-
|
|
|
-while true; do
|
|
|
- read -p "Would you like to upload [u] the content or write it to a file [s]? Save[s]/Upload[u] " us
|
|
|
- case $us in
|
|
|
- [Uu]) upload && exit ;;
|
|
|
- [Ss]) save && exit ;;
|
|
|
- *) continue ;;
|
|
|
- esac
|
|
|
-done
|
|
|
+read -p "Would you like to view [v] the content? (View[V]/No[n]) " vn
|
|
|
+case $vn in
|
|
|
+ [Vv]) less -f <(echo -e "${OutPut}${Logs}") ;;
|
|
|
+ [Nn]) echo -n "" ;;
|
|
|
+ *) less -f <(echo -e "${OutPut}${Logs}") ;;
|
|
|
+esac
|
|
|
+
|
|
|
+read -p "Would you like to upload [u] the content or write it to a file [s]? Save[s]/Upload[U]" us
|
|
|
+case $us in
|
|
|
+ [Uu]) upload ;;
|
|
|
+ [Ss]) save ;;
|
|
|
+ *) upload ;;
|
|
|
+esac
|
|
|
+
|