#!/bin/bash ## MAFoElffen, , 2021.08.19 ## ## Contributors: ## sudodus , 2021.08.25 ## Doug S, 2021.08.22 ## oldfred, 2021.08.20 ## Filename: support-info ## Description: Report Finds Machine System And Hardware Related Information. ## Purpose: For support use at "UbuntuForums.org". ######################################################################### # Copyright (c) 2012, 2021 # # GNU General Public License (GPL-3.0-or-later) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ######################################################################## #### Variables ######################################################################## # Versioning version="Version: 02.00-09, Script Date: 2023.11.28" exit_code=0 #md5_sum=$(md5sum $sname | sed 's/system.*//g' ) arg1=$1 arg2=$2 # Set Report filename and path to sname="${0##*/}" # flexible, needs quoting everywhere if spaces report="$HOME/${sname}.txt" # Get present Locale settings localectl_status=$(localectl status ) locale_state=$(locale ) LANG_Hx=$LANG LC_CTYPE_Hx=$LC_CTYPE # Set locale language settings LANG=C LC_CTYPE=C # Set a pretty ANSI screen decoration for displaying the report onscreen blueback="\0033[1;37;44m" redback="\0033[1;37;41m" faintvid="\0033[2m" resetvid="\0033[0m" # Check boot mode boot_mode=$( [ -d /sys/firmware/efi ] && echo "UEFI Firmware mode" || echo "Legacy mode (alias CSM alias BIOS mode)" ) boot_status=$( [ -d /sys/firmware/efi ] ); # Use boot mode as boolean test less_status="less" up_status= "true" debian_branch=0 # Report timestamp startt="$(date '+%F %T %Z (%z)')" # LST Name for package calc LTS_PKG="" # variables to keep track of missing programs... missing_programs="" check_paster=0 # Variable to track upload status as uploaded check_paste=1 missing_paster_progs="" # Variable to add more detail to Report detail_level='-v' bios_detail=1 zfs_detail=1 md_detail=1 lvm2_detail=1 btrfs_detail=1 # Logger settings # Change verbosity to show level of warnings. Range: -1 through 5. -1 is show nothing. verbosity=-1 silent_lvl=0 crt_lvl=1 err_lvl=2 wrn_lvl=3 inf_lvl=4 dbg_lvl=5 # Trap Control-C stty -echoctl # hide ^C trap 'other_commands' SIGINT # 'Trap Section' to clean up Temporary Files on unexpected EXIT's trap "rm -f $manually_installed" EXIT 2> /dev/null trap "rm -f $default_installed" EXIT 2> /dev/null trap "rm -f $user_installed" EXIT 2> /dev/null trap "rm -f $ssh_data" EXIT 2> /dev/null trap "ResetLocale" EXIT 2> /dev/null ######################################################################## #### Functions: ######################################################################## function other_commands() { tput setaf 1 printf "You can 'not' exit this script by pressing Control-C..." tput sgr0 printf "Continue with last 'asked' input..." } function CheckRoot() { clear -x; ## Check if ran as root. Runs at startup. Called by Main() if [[ "$EUID" == 0 ]] || [ $UID -eq 0 ] then echo -e "$redback Do not run this script with sudo or as root$resetvid" echo -e "If your Linux ditribution installs with only a Root User as a default, " echo -e "please create another User that has the ability to run elevated commands. " PassPhrase #exit_code=106 #exit $exit_code echo -e "Running Script: ${sname} $version" else echo -e "This script needs some parts of it to run with elevated permissions." nl ## Check if 'sudo' is installed... if type sudo > /dev/null 2> /dev/null then echo -e "Please enter your password for that to happen." sudo -k # revoke previously cached sudo password if sudo true then echo -e "Running Script: ${sname} $version" else echo -e "$redback ----------- This script is made to use 'sudo' ----------- $resetvid" echo -e "$redback ---- Password was incorrect for sudo elevated rights. --- $resetvid" PassPhrase echo -e "Continuing to run the script, but: Expect errors. " fi else echo -e "$redback ----------- This script is made to use 'sudo' ----------- $resetvid" echo -e "$redback This system does not have 'sudo' installed. $resetvid" echo -e "$redback If you install 'sudo' you will get much more information. $resetvid" Pause echo -e "Running Script: ${sname} $version" fi fi } function CheckArgs() { # Version or Help Panel. Called by Main(). if [[ "$arg1" == "-v" ]] then # Versioning: At the commandline: [ -v] returns , then exits. echo -e "$version"; ResetLocale exit; elif [[ "$arg1" == "-h" ]] || [[ "$arg1" == "--help" ]] then # Help Panel: At the commandline: [ -h or --help] returns this usage panel, then exits. echo "Running Script: ${sname} $version" echo -e "md5sum: "$(md5sum ${sname} | sed 's/system.*//g' ) nl echo -e "Description: The Ubuntu Forums \"system-info\" script queries the users " echo -e "computer and prepares a report, so that Ubuntu Forums Community Members " echo -e "can see what they are recommending solutions for." nl echo -e "Usage: ./${sname}