#!/bin/bash
# Pup-SysInfo 2.6
# Copyright 2015 GPL3
# Roger Grider (radky)

export TEXTDOMAIN=Pup-SysInfo
export OUTPUT_CHARSET=UTF-8

[ "`whoami`" != "root" ] && exec sudo -A ${0} ${@}

export VERSION="2.6"
export WORKDIR="/usr/local/Pup-SysInfo"
export PREFDIR="$WORKDIR/preferences"
export SYSDATE="`date +'%y%m%d'`"
export DEF_LANG=$LANG
[ "${LANG%_*}" = "en" ] && LANG=C #faster parsing, but invoke only in English locale

mkdir -p "$PREFDIR" "/tmp/pupsysinfo" "/tmp/${USER}/"

if [ -f /tmp/PSI-summary 2>/dev/null ]; then # Summary report
 . $WORKDIR/func -sysinfo_summary
 rm -f /tmp/PSI-summary &
elif [ -f /tmp/PSI-network 2>/dev/null ]; then # Network report
 . $WORKDIR/func -sysinfo_netsummary
 . $WORKDIR/func -sysinfo_netcomplete
 cat /tmp/sysinfo-network | sed -e 's/^Session/\nSession/' -e 's/^External/\nHostname: '"$(hostname)"'\nExternal/' >> /tmp/pup-sysinfo.txt
 rm -f /tmp/PSI-network &
elif [ -f /tmp/PSI-video 2>/dev/null ]; then # Video report
 . $WORKDIR/func -sysinfo_video
 rm -f /tmp/PSI-video &
else
 echo "$(gettext 'Please select a menu item...')" > /tmp/pup-sysinfo.txt
fi

# define gtkdialog
if [ "`which gtkdialog4`" ]; then
 GTKDIALOG=gtkdialog4
elif [ "`which gtkdialog3`" ]; then
 GTKDIALOG=gtkdialog3
else
 GTKDIALOG=gtkdialog
fi
export GTKDIALOG

# define filemanager
if [ "`which rox`" ]; then
 FILEMANAGER="rox"
elif [ "`which Thunar`" ]; then
 FILEMANAGER="Thunar"
elif [ "`which spacefm`" ]; then
 FILEMANAGER="spacefm"
elif [ "`which pcmanfm`" ]; then
 FILEMANAGER="pcmanfm"
fi

# define title-bar icon
ln -sf $WORKDIR/icons/Pup-SysInfo48.png /usr/share/icons/hicolor/48x48/apps && gtk-update-icon-cache -f -i /usr/share/icons/hicolor 2>/dev/null

#auto-adjust header text color for light or dark GTK themes
if [ "`grep 'Stardust_dark' $HOME/.gtkrc-2.0 2>/dev/null`" ]; then #gold text for unique Stardust dark-grey-orange themes
  COLOR=#D7B740
else #light-blue text for common dark themes, otherwise medium blue
  [ "`grep -Ei 'black|dark|night' $HOME/.gtkrc-2.0 2>/dev/null`" ] && COLOR=#84aad9 || COLOR=#3272C0
fi
export COLOR

# splash dialog
echo 0 > /tmp/pupsysinfo/pupsysinfo-splash
export PSI_SPLASH='
<window title="PSI" icon-name="Pup-SysInfo48" resizable="false" decorated="true">'"
<vbox>
 <pixmap><input file>$WORKDIR/icons/Pup-SysInfo48.png</input></pixmap>
 <text use-markup=\"true\"><label>\"<b><span size='"'x-large'"'>      Pup</span><span size='"'x-large'"' color='"$COLOR"'>SysInfo      </span></b>\"</label></text>"'
 <text><label>Loading...</label></text>
 <progressbar visible="false">
  <input>while [ "$M" != "100" ]; do M=`cat /tmp/pupsysinfo/pupsysinfo-splash`; echo $M; usleep 500000; done</input>
  <action type="exit">Ready</action>
 </progressbar>
</vbox></window>'
$GTKDIALOG --center -p PSI_SPLASH &

# define fixed-width font for display window
PSI_FONTSIZE=$(cat $PREFDIR/psi_fontsize 2>/dev/null)
[ "$PSI_FONTSIZE" = "" ] && PSI_FONTSIZE="11" && echo "11" > $PREFDIR/psi_fontsize
echo 'style "specialmono"
{
  font_name="Mono '"$PSI_FONTSIZE"'"
}
widget "*mono" style "specialmono"
class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono

export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0 

# define icon for current fontsize
if [ "$PSI_FONTSIZE" = "10" ]; then
 FONTSIZE10_ICON="stock-id=\"gtk-media-play\""
 FONTSIZE11_ICON=""
 FONTSIZE12_ICON=""
elif [ "$PSI_FONTSIZE" = "11" ]; then
 FONTSIZE10_ICON=""
 FONTSIZE11_ICON="stock-id=\"gtk-media-play\""
 FONTSIZE12_ICON=""
elif [ "$PSI_FONTSIZE" = "12" ]; then
 FONTSIZE10_ICON=""
 FONTSIZE11_ICON=""
 FONTSIZE12_ICON="stock-id=\"gtk-media-play\""
fi

# set height of display window
VERT_RES="`xdpyinfo | grep -E dimensions | cut -d " " -f7 | cut -d "x" -f2`" # vertical screen resolution
if [ `which xdpyinfo` ]; then
 if [ "$VERT_RES" -lt "600" ]; then # set reduced-height display window
  HEIGHT="268"
 else # set standard-height display window
  HEIGHT="412"
 fi
elif [ ! `which xdpyinfo` ]; then
  HEIGHT="412"
fi

# define current log reports
if [ "`cat /initrd/tmp/bootinit.log 2>/dev/null`" ]; then
	bootINIT="
   <menuitem tooltip-text=\" $(gettext 'bootinit.log') \" stock=\"gtk-justify-fill\" label=\"bootinit\">
    <action>echo -e "'"▶—— /initrd/tmp/bootinit.log ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_bootinit </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	bootINIT=""
fi

if [ "`cat /tmp/bootsysinit.log 2>/dev/null`" ]; then
	bootSYSINIT="
   <menuitem tooltip-text=\" $(gettext 'bootsysinit.log') \" stock=\"gtk-justify-fill\" label=\"bootsysinit\">
    <action>echo -e "'"▶—— /tmp/bootsysinit.log ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_bootsysinit </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	bootSYSINIT=""
fi

	kernelLOG="
   <menuitem tooltip-text=\" $(gettext 'Boot-time kernel log 
 with no timestamps.') \" stock=\"gtk-justify-fill\" label=\"$(gettext 'Kernel Log')\">
    <action>echo -e "'"▶—— $(gettext "''Boot-time Kernel Log (dmesg)''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>dmesg | tail -n 2000 | sed -e 's/[©®]//g' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>"

	LOGIN="
   <menuitem tooltip-text=\" $(gettext 'User login report') \" stock=\"gtk-justify-fill\" label=\"$(gettext 'Login Report')\">
    <action>. $WORKDIR/func -sysinfo_login </action>
    <action>refresh:INFO</action>
   </menuitem>"

	sysLOG="
   <menuitem tooltip-text=\" $(gettext 'General system activity log includes 
 output of dmesg (with timestamps).') \" stock=\"gtk-justify-fill\" label=\"$(gettext 'System Log')\">
    <action>. $WORKDIR/func -sysinfo_log </action>
    <action>refresh:INFO</action>
   </menuitem>"

if [ "`cat /tmp/xerrs.log 2>/dev/null`" ]; then
	xerrsLOG="
   <menuitem tooltip-text=\" $(gettext 'X errors log') \" stock=\"gtk-justify-fill\" label=\"$(gettext 'xerrs.log')\">
    <action>echo -e "'"▶—— /tmp/xerrs.log ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_xerrslog </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	xerrsLOG=""
fi

if [ "`cat /var/log/Xorg.0.log 2>/dev/null`" ]; then
	xorgLOG="
   <menuitem tooltip-text=\" $(gettext 'X11 device log') \" stock=\"gtk-justify-fill\" label=\"$(gettext 'Xorg.0.log')\">
    <action>echo -e "'"▶—— /var/log/Xorg.0.log ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /var/log/Xorg.0.log | tail -n 2200 | sed '/./,/^$/!d' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	xorgLOG=""
fi

# if gparted is available, add to Devices-> Drive Storage submenu
if [ "`which gparted 2>/dev/null`" ]; then
	GPARTED="
   <menuitem tooltip-text=\" $(gettext 'Partition manager') \" stock=\"gtk-execute\" label=\"$(gettext 'GParted')\">
    <action>gparted &</action>
   </menuitem>"
else
	GPARTED=""
fi

# if $HOME/.pup_event detects partitions, add DriveTest to Devices-> Drive Storage submenu
if [ "`grep -R 'Summary' $HOME/.pup_event 2>/dev/null`" ]; then
	DRIVETEST="
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Evaluate drive read-speed (hdparm)') \" stock=\"gtk-refresh\" label=\"$(gettext 'DriveTest')\">
    <action>. $WORKDIR/func -sysinfo_drivetest </action>
    <action>cat /tmp/sysinfo-drivetest > /tmp/pup-sysinfo.txt </action>
    <action>cat /tmp/sysinfo-drivetest > $PREFDIR/drivetest </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'View recent drive test') \" stock=\"gtk-justify-center\" label=\"$(gettext 'Prior Test')\">
    <action>[ ! -f $PREFDIR/drivetest ] && echo -e "'"▶—— $(gettext "''DRIVE READ-SPEED''") ——◀\n\nNo prior drive test available."'" > $PREFDIR/drivetest </action>
    <action>cat $PREFDIR/drivetest > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	DRIVETEST=""
fi

# if smartctl is available, add to Devices-> Drive Storage submenu
if [ "`which smartctl 2>/dev/null`" ]; then
	SMARTCTL="
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'S.M.A.R.T hard drive report') \" stock=\"gtk-harddisk\" label=\"$(gettext 'SmartCtl')\">
    <action>echo "'"▶—— $(gettext "''S.M.A.R.T HARD DRIVE REPORT (smartctl)''") ——◀"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_hddsmartctl </action>
    <action>cat /tmp/sysinfo-hddsmartctl >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	SMARTCTL=""
fi

# define data source for Summary report in Devices-> USB Devices submenu
if [ "`which usb-devices 2>/dev/null`" ]; then
 USBSCR="usb-devices"
elif [ -f /proc/bus/usb/devices ]; then
 USBSCR="\/proc\/bus\/usb\/devices"
elif [ "`which lsusb 2>/dev/null`" ]; then
 USBSCR="lsusb"
fi

# if lsusb supports verbose option, add Complete report to Devices-> USB Devices submenu
if [ "`lsusb -v 2>/dev/null | grep -i Descriptor`" ]; then
	LSUSB="
   <menuitem tooltip-text=\" $(gettext 'Complete view of USB devices') \" stock=\"gtk-zoom-in\" label=\"$(gettext 'Complete')\">
    <action>. $WORKDIR/func -sysinfo_usbcomplete </action>
    <action>cat /tmp/sysinfo-usbcomplete > /tmp/pup-sysinfo.txt</action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	LSUSB=""
fi

# define blacklisted kernel modules in Drivers-> Reports submenu
if [ "`cat /etc/modprobe.d/blacklist.conf 2>/dev/null`" ]; then
	BLACKLIST="
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Blacklisted kernel modules are denied 
 loading permission when the PC boots.') \" stock=\"gtk-close\" label=\"$(gettext 'Black List')\">
    <action>. $WORKDIR/func -sysinfo_kmodblacklist</action>
    <action>cat /tmp/sysinfo-kernel > /tmp/pup-sysinfo.txt</action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	BLACKLIST=""
fi

# define Battery report in Devices menu
export sysBAT=`ls /sys/class/power_supply/* 2>/dev/null`
export procBAT=`ls /proc/acpi/battery/* 2>/dev/null`
export BATTERY0=$(cat $PREFDIR/psi_bat0 2>/dev/null)
export BATTERY1=$(cat $PREFDIR/psi_bat1 2>/dev/null)
if [ "$sysBAT" -o "$procBAT" ]; then
	BATTERY="
   <menu stock-id=\"gtk-info\" label=\"$(gettext 'Battery')\">
   <menuitem tooltip-text=\" $(gettext 'Notebook battery status') \" stock=\"gtk-info\" label=\"$(gettext 'Report:') $BATTERY0 $BATTERY1\">
    <action>rm -f /tmp/pup-sysinfo.txt 2>/dev/null</action>
    <action>. $WORKDIR/func -sysinfo_bat0</action>
    <action>cat /tmp/sysinfo-battery | sed 's/DEVICES: //' >> /tmp/pup-sysinfo.txt</action>
    <action>[ "$BATTERY1" ] && . $WORKDIR/func -sysinfo_bat1 </action>
    <action>[ "$BATTERY1" ] && cat /tmp/sysinfo-battery | sed 's/DEVICES: //' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Notebook battery identification') \" stock=\"gtk-preferences\" label=\"$(gettext 'Preferences')\">
    <action>launch:PSI_PREF</action>
    <action type=\"exit\">quit_now</action>
   </menuitem>
   </menu>"
else
	BATTERY="
   <menuitem tooltip-text=\" $(gettext 'Notebook battery status') \" stock=\"gtk-info\" label=\"$(gettext 'Battery')\">
    <action>echo -e "'"▶—— $(gettext "''BATTERY''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>echo "'"$(gettext "''No battery detected''")"'" >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>"
fi

# if lspci -k is supported, add Complete report to Devices-> Display submenu
if [ "`lspci -knn 2>/dev/null`" ]; then
	VIDEOCOMPLETE="
   <menuitem tooltip-text=\" $(gettext 'Complete video report') \" stock=\"gtk-zoom-in\" label=\"$(gettext 'Complete')\">
    <action>. $WORKDIR/func -sysinfo_videocomplete </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	VIDEOCOMPLETE=""
fi

# if video-info or report-video are available, add to Devices-> Display submenu
if [ "`which video-info 2>/dev/null`" ]; then
	VIDEOINFO="
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Lighthouse video-info utility') \" stock=\"gtk-info\" label=\"$(gettext 'Video-Info')\">
    <action>video-info &</action>
   </menuitem>"
elif [ "`which video-info-glx 2>/dev/null`" ]; then
	VIDEOINFO="
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Lighthouse video-info utility') \" stock=\"gtk-info\" label=\"$(gettext 'Video-Info')\">
    <action>video-info-glx &</action>
   </menuitem>"
elif [ "`which report-video 2>/dev/null`" ]; then
	VIDEOINFO="
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Standard report-video utility') \" stock=\"gtk-info\" label=\"$(gettext 'Video-Info')\">
    <action>report-video -q 2>/dev/null > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	VIDEOINFO=""
fi

# if PupKview is available, add to Drivers menu
if [ -f /usr/local/Pup-Kview/Pup-Kview ]; then
	PUPKVIEW="
   <menuitem tooltip-text=\" $(gettext 'Kernel module viewer') \" stock=\"gtk-find\" label=\"$(gettext 'Pup-Kview')\">
    <action>Pup-Kview &</action>
   </menuitem>
   <separator></separator>"
else
	PUPKVIEW=""
fi

# if ipinfo is scrollable, add to Network menu
if [ "`grep scrollable /usr/sbin/ipinfo 2>/dev/null`" ]; then
	IPINFO="
   <menuitem tooltip-text=\" $(gettext 'Network configuration') \" stock=\"gtk-network\" label=\"$(gettext 'IP Info')\">
    <action>ipinfo &</action>
   </menuitem>"
else
	IPINFO=""
fi

# if smbclient is available, add to Network menu
if [ "`which smbclient 2>/dev/null`" ]; then
	SAMBA="
   <menuitem tooltip-text=\" $(gettext 'Samba network sharing') \" stock=\"gtk-network\" label=\"$(gettext 'Samba')\">
    <action>. $WORKDIR/func -sysinfo_samba</action>
    <action>cat /tmp/sysinfo-samba > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	SAMBA=""
fi

[ "`grep scrollable /usr/sbin/ipinfo 2>/dev/null`" ] || [ "`which smbclient 2>/dev/null`" ] && SEPARATOR="<separator></separator>"

# if Lighthouse Sys-Info is available, add to Sys-Apps menu
if [ "`which sys-info 2>/dev/null`" ]; then
	LH_SYSINFO="
   <menuitem tooltip-text=\" $(gettext 'Lighthouse system information') \" stock=\"gtk-info\" label=\"$(gettext 'Sys-Info')\">
    <action>. $WORKDIR/func -sysinfo_lighthouse </action>
    <action>refresh:INFO</action>
   </menuitem>"
else
	LH_SYSINFO=""
fi

# if Pdiag is available, add to Sys-Apps menu
if [ "`which pdiag 2>/dev/null`" ]; then
	PDIAG="
   <menuitem tooltip-text=\" $(gettext 'Capture diagnostic system information') \" stock=\"gtk-info\" label=\"$(gettext 'Pdiag')\">
    <action>pdiag &</action>
   </menuitem>"
else
	PDIAG=""
fi

# if Top system monitor is available, add to Sys-Apps menu
if [ "`which top 2>/dev/null`" ]; then
	TOP="
   <menuitem tooltip-text=\" $(gettext 'View system processes in real-time') \" stock=\"gtk-find\" label=\"$(gettext 'Top View')\">
    <action>. $WORKDIR/func -sysinfo_top &</action>
   </menuitem>"
else
	TOP=""
fi

# define task manager for Sys-Apps menu
if [ "`which lxtask 2>/dev/null`" ]; then
 TASKMGR="lxtask"
elif [ "`which htop 2>/dev/null`" ]; then
 TASKMGR="rxvt +sb -fn 9x15 -bg black -fg white -title htop -n htop -e htop"
elif [ "`which xfce4-taskmanager 2>/dev/null`" ]; then
 TASKMGR="xfce4-taskmanager"
elif [ "`which pprocess 2>/dev/null`" ]; then
 TASKMGR="pprocess"
fi

# help dialog
pupsysinfo_help (){
export PUPSYSINFO_HELP="
<window title=\"PupSysInfo - $(gettext 'Help')\" icon-name=\"Pup-SysInfo48\" window-position=\"2\">
 <notebook labels=\"$(gettext 'About')|$(gettext 'License')\">
  <frame>
   <pixmap><input file>$WORKDIR/icons/Pup-SysInfo48.png</input><height>48</height><width>48</width></pixmap>
   <text use-markup=\"true\"><label>\"<b><span size='"'x-large'"'>Pup</span><span size='"'x-large'"' color='"$COLOR"'>SysInfo</span> $VERSION</b>\"</label></text>
   <text use-markup=\"true\"><label>\"<b>$(gettext 'System Information')</b>\"</label></text>
   <text><label>\"$(gettext 'Copyright (C) 2011-2015 Roger D. Grider')\"</label></text>
   <text height-request=\"10\"><label>\"\"</label></text>
   <hbox homogeneous=\"true\">
    <button width-request=\"170\">
     <label>\"$(gettext 'Local Help')\"</label>
     <action>defaultbrowser $WORKDIR/Help.html &</action>
    </button>
    <button width-request=\"170\">
     <label>\"$(gettext 'Online Forum')\"</label>
     <action>defaulthtmlviewer http://www.murga-linux.com/puppy/viewtopic.php?p=579411#579411 &</action>
    </button>
   </hbox>
  </frame>
  <frame>
   <text use-markup=\"true\"><label>\"$(gettext '<b>Pup-SysInfo</b> is free software which you can modify and/or redistribute under the terms of the <b>GNU General Public License</b> published by the Free Software Foundation; either GPLv3 or later version.')

$(gettext 'This program is distributed in the hope that it will be useful, but') <b><span color='"'red'"'>$(gettext 'WITHOUT ANY WARRANTY')</span></b>. $(gettext 'See the GNU General Public License homepage below for additional information.')\"</label></text>
   <hbox homogeneous=\"true\">
    <button>
     <label>\"   http://www.gnu.org/licenses/   \"</label>
     <action>defaulthtmlviewer http:\/\/www.gnu.org\/licenses\/</action>
    </button>
   </hbox>
  </frame>
 </notebook>
</window>"
$GTKDIALOG -p PUPSYSINFO_HELP
unset PUPSYSINFO_HELP
}
export -f pupsysinfo_help

# preferences dialog
BATTERY0=$(cat $PREFDIR/psi_bat0 2>/dev/null)
[ ! "$BATTERY0" ] && echo "BAT0" > $PREFDIR/psi_bat0
QUERY=$(cat $PREFDIR/psi_query 2>/dev/null)
[ ! "$QUERY" ] && echo "false" > $PREFDIR/psi_query
export PSI_PREF="
<window title=\"$(gettext 'PSI-Preferences')\" icon-name=\"gtk-preferences\" resizable=\"false\" window-position=\"2\">
 <vbox>
  <frame $(gettext 'Network Report:')>
	<hbox>
	 <checkbox tooltip-text=\" $(gettext 'Query icanhazip.com to identify my 
 current external (public) IP address.') \">
	  <label>$(gettext 'Probe local external IP address')  </label>
	  <variable>QUERY</variable>
	  <input>cat $PREFDIR/psi_query 2>/dev/null</input>
	  <action signal=\"toggled\">echo \$QUERY > $PREFDIR/psi_query</action>
	 </checkbox>
	</hbox>
  </frame>
  <frame $(gettext 'Notebook Battery ID:')>
	<vbox>
	<hbox>
	<text xalign=\"1\"><label>\"$(gettext 'Battery-0:') \"</label></text>
	 <entry tooltip-text=\" $(gettext 'Usually, the name of the 1st battery is BAT0 
 but may be proprietary (ex: C23A or CMB0).') \">
	  <variable>BATTERY0</variable>
	  <input>cat $PREFDIR/psi_bat0 2>/dev/null</input>
	  <action signal=\"changed\">echo \$BATTERY0 > $PREFDIR/psi_bat0</action>
	 </entry>
	</hbox>
	<hbox>
	<text xalign=\"1\"><label>\"$(gettext 'Battery-1:') \"</label></text>
	 <entry tooltip-text=\" $(gettext 'Usually, the name of the 2nd battery is BAT1 
 but may be proprietary  (ex: C23B or CMB1).') \">
	  <variable>BATTERY1</variable>
	  <input>cat $PREFDIR/psi_bat1 2>/dev/null</input>
	  <action signal=\"changed\">echo \$BATTERY1 > $PREFDIR/psi_bat1</action>
	 </entry>
	</hbox>
	</vbox>
  </frame>
	<hbox homogeneous=\"true\">
	 <button width-request=\"90\" tooltip-text=\" $(gettext 'Identify notebook battery') \">
	  <label>$(gettext 'Battery')</label>
	  <action>$WORKDIR/func -sysinfo_batID &</action>
	 </button>
	 <button width-request=\"90\">
	  <label>$(gettext 'OK')  </label>
	  <variable>CLOSE_PREF</variable>
	  <input file stock=\"gtk-ok\"></input>
	  <action>LANG=$DEF_LANG ; Pup-SysInfo &</action>
	  <action type=\"exit\">quit_now</action>
	 </button>
	</hbox>
 </vbox>
 <variable>PSI_PREF</variable>
 <action signal=\"delete-event\">EXIT:abort</action>
</window>"

# main dialog
export PUPSYSINFO_DIALOG="
<window title=\"PSI\" icon-name=\"Pup-SysInfo48\" resizable=\"true\" window-position=\"1\">
<vbox>
 <menubar>
  <menu use-underline=\"true\">
   <menuitem tooltip-text=\" $(gettext 'Export current report to default text editor. 
 (Set editor to fixed-width/monospace font)') \" stock=\"gtk-jump-to\" label=\"$(gettext 'Export Current Report')\">
    <action>. $WORKDIR/func -sysinfo_private </action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Go to reports in') /tmp/${USER}/ \" stock=\"gtk-open\" label=\"$(gettext 'Open Recent...')\">
    <action>$FILEMANAGER /tmp/${USER}/ &</action>
   </menuitem>
   <separator></separator>
   <menu stock-id=\"gtk-info\" label=\"$(gettext 'Hardware Reports')\">
   <menuitem tooltip-text=\" $(gettext 'Basic hardware scan') \" stock=\"gtk-zoom-fit\" label=\"$(gettext 'Summary')\">
    <action>. $WORKDIR/func -sysinfo_summary </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Comprehensive hardware scan') \" stock=\"gtk-zoom-in\" label=\"$(gettext 'Complete')\">
    <action>. $WORKDIR/func -sysinfo_hardware </action>
    <action>refresh:INFO</action>
   </menuitem>
   </menu>
   <menu stock-id=\"gtk-info\" label=\"$(gettext 'System Reports')\">
   <menuitem tooltip-text=\" $(gettext 'Export system logs to default text editor') \" stock=\"gtk-zoom-fit\" label=\"$(gettext 'Summary')\">
    <action>echo -e "'"▶—— $(gettext "''System Report (Summary)''") ——◀\n\n$(gettext "''Exported to default text editor and''") /tmp/${USER}/PSI-SYS-Summary-"'$SYSDATE'""'" > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
    <action>. $WORKDIR/func -sysinfo_activity </action>
    <action>defaulttexteditor /tmp/pup-sysinfo.txt &</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Export complete hardware report and 
 system logs to the default text editor.') \" stock=\"gtk-zoom-in\" label=\"$(gettext 'Complete')\">
    <action>echo -e "'"▶—— $(gettext "''System Report (Complete)''") ——◀\n\n$(gettext "''Exported to default text editor and''") /tmp/${USER}/PSI-SYS-Complete-"'$SYSDATE'""'" > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
    <action>. $WORKDIR/func -sysinfo_complete </action>
    <action>defaulttexteditor /tmp/pup-sysinfo.txt &</action>
   </menuitem>
   </menu>
   <separator></separator>
   <menu stock-id=\"gtk-dialog-question\" label=\"$(gettext 'Privacy Option')\">
   <menuitem checkbox=\"PSI_PRIVATE\" tooltip-text=\" $(gettext 'Exclude personal information from reports 
 generated or exported from the File menu. 
 (Example: serial numbers or IP addresses)') \">
    <label>$(gettext 'Create Private Reports')</label>
    <variable>PSI_PRIVATE</variable>
    <input>cat $PREFDIR/psi_private 2>/dev/null</input>
    <action>if true echo true > $PREFDIR/psi_private</action>
   <action>if false echo false > $PREFDIR/psi_private</action>
   </menuitem>
   </menu>
   <menuitem stock=\"gtk-preferences\" label=\"$(gettext 'Preferences...')\">
    <action>launch:PSI_PREF</action>
   </menuitem>
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Close Pup-SysInfo') \" stock=\"gtk-quit\" label=\"$(gettext 'Exit')\">
    <action type=\"exit\">quit_now</action>
   </menuitem>
   <label>$(gettext '_File')</label>
  </menu>

  <menu use-underline=\"true\">
   <menu stock-id=\"gtk-select-font\" label=\"$(gettext 'Font Size')\">
   <menuitem "$FONTSIZE10_ICON" label=\"10\">
    <action>echo "10" > $PREFDIR/psi_fontsize</action>
    <action>. $WORKDIR/func -sysinfo_pupsysinfo &</action>
    <action type=\"exit\">quit_now</action>
   </menuitem>
   <menuitem "$FONTSIZE11_ICON" label=\"11\">
    <action>echo "11" > $PREFDIR/psi_fontsize</action>
    <action>. $WORKDIR/func -sysinfo_pupsysinfo &</action>
    <action type=\"exit\">quit_now</action>
   </menuitem>
   <menuitem "$FONTSIZE12_ICON" label=\"12\">
    <action>echo "12" > $PREFDIR/psi_fontsize</action>
    <action>. $WORKDIR/func -sysinfo_pupsysinfo &</action>
    <action type=\"exit\">quit_now</action>
   </menuitem>
   </menu>
   <label>$(gettext '_View')</label>
  </menu>

  <menu use-underline=\"true\">
   <menuitem tooltip-text=\" $(gettext 'Basic Input/Output System') \" stock=\"gtk-info\" label=\"$(gettext 'BIOS')\">
    <action>echo -e "'"▶—— $(gettext "''BIOS''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>dmidecode -t 0 | grep -E 'Vendor:|Version:|Release Date:|Runtime Size:|ROM Size:' | sed -e 's/	//g' >> /tmp/pup-sysinfo.txt </action>
    <action>echo -e "'"\n--\n"'" >> /tmp/pup-sysinfo.txt </action>
    <action>biosdecode >> /tmp/pup-sysinfo.txt </action>
    <action>dmidecode -t 0 | grep -Ev 'Handle|dmidecode|SMBIOS' | sed -e '/^$/d' -e 's/Information/INFORMATION (dmidecode):/g' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Central Processing Unit') \" stock=\"gtk-info\" label=\"$(gettext 'CPU')\">
    <action>echo -e "'"▶—— $(gettext "''CPU''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_cpu </action>
    <action>cat /tmp/sysinfo-cpu >> /tmp/pup-sysinfo.txt </action>
    <action>echo -e "'"\n▶—— /proc/cpuinfo ——◀\n"'" >> /tmp/pup-sysinfo.txt </action>
    <action>cat /proc/cpuinfo >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Direct Memory Access') \" stock=\"gtk-info\" label=\"$(gettext 'DMA')\">
    <action>echo -e "'"▶—— $(gettext "''DMA''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /proc/dma >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Desktop Management Interface') \" stock=\"gtk-info\" label=\"$(gettext 'DMI')\">
    <action>echo -e "'"▶—— $(gettext "''DMI''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>dmidecode >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Input/Output Resources') \" stock=\"gtk-info\" label=\"$(gettext 'I/O')\">
    <action>. $WORKDIR/func -sysinfo_io </action>
    <action>cat /tmp/sysinfo-io > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Interrupt Requests') \" stock=\"gtk-info\" label=\"$(gettext 'IRQ')\">
    <action>echo -e "'"▶—— $(gettext "''IRQ''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /proc/interrupts >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <label>$(gettext '_Mainboard')</label>
  </menu>

  <menu use-underline=\"true\">
   <menu stock-id=\"gtk-info\" label=\"$(gettext 'Drive Storage')\">
   <menuitem tooltip-text=\" $(gettext 'Compact Disk & Digital Versatile Disk Drives') \" stock=\"gtk-info\" label=\"$(gettext 'CD/DVD')\">
    <action>echo "'"▶—— $(gettext "''CD/DVD DRIVE PARAMETERS''") (hdparm) ——◀"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_optical </action>
    <action>cat /tmp/sysinfo-optical >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Hard Disk Drives') \" stock=\"gtk-info\" label=\"$(gettext 'HDD')\">
    <action>echo "'"▶—— $(gettext "''HARD DRIVE PARAMETERS''") (hdparm) ——◀"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_hdd </action>
    <action>cat /tmp/sysinfo-hdd | sed -e 's/sda1/sda/g' -e 's/sdb1/sdb/g' -e 's/sdc1/sdc/g' -e 's/sdd1/sdd/g' -e 's/hda1/hda/g' -e 's/hdb1/hdb/g' -e 's/hdc1/hdc/g' -e 's/hdd1/hdd/g' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Redundant Array of Independent Disks') \" stock=\"gtk-info\" label=\"$(gettext 'RAID')\">
    <action>echo -e "'"▶—— $(gettext "''RAID DRIVES''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_raid </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Universal Serial Bus Drives') \" stock=\"gtk-info\" label=\"$(gettext 'USB')\">
    <action>. $WORKDIR/func -sysinfo_usbdrives </action>
    <action>cat /tmp/sysinfo-usbdrives > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Small Computer System Interface Drives') \" stock=\"gtk-info\" label=\"$(gettext 'SCSI')\">
    <action>. $WORKDIR/func -sysinfo_scsiStorage </action>
    <action>refresh:INFO</action>
   </menuitem>
   <separator></separator>
   $GPARTED
   <menuitem tooltip-text=\" $(gettext 'HDD/USB partition scan') \" stock=\"gtk-media-pause\" label=\"$(gettext 'PartScan')\">
    <action>echo -e "'"▶—— $(gettext "''HDD/USB PARTITIONS''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_partitions </action>
    <action>cat /tmp/sysinfo-partitions >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Partition size and free space') \" stock=\"gtk-find\" label=\"$(gettext 'PartView')\">
    <action>. $WORKDIR/func -partview &</action>
   </menuitem>
   $DRIVETEST
   $SMARTCTL
   </menu>
   <menu stock-id=\"gtk-info\" label=\"$(gettext 'PCI Devices')\">
   <menuitem tooltip-text=\" $(gettext 'Basic view of PCI devices') \" stock=\"gtk-zoom-fit\" label=\"$(gettext 'Summary')\">
    <action>. $WORKDIR/func -sysinfo_pci </action>
    <action>cat /tmp/sysinfo-pci | sed -e 's/DEVICES: //' -e 's/INTERFACES/DEVICES (lspci)/' > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Complete view of PCI devices') \" stock=\"gtk-zoom-in\" label=\"$(gettext 'Complete')\">
    <action>echo -e "'"▶—— $(gettext "''PCI DEVICES''") (lspci -v) ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>lspci -v | sed -e 's/[©®]//g' -e 's/devsel/device select/g' -e 's/, IRQ/\n	Interrupt Request (IRQ):/g' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'View PCI Vendor IDs in default browser') \" stock=\"gtk-info\" label=\"$(gettext 'Vendor ID')\">
    <action>defaultbrowser http://pci-ids.ucw.cz/read/PC/ &</action>
   </menuitem>
   </menu>
   <menu stock-id=\"gtk-info\" label=\"$(gettext 'USB Devices')\">
   <menuitem tooltip-text=\" $(gettext 'Basic view of USB devices') \" stock=\"gtk-zoom-fit\" label=\"$(gettext 'Summary')\">
    <action>rm -f /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_usb </action>
    <action>cat /tmp/sysinfo-usb | sed -e 's/DEVICES/DEVICES ("$USBSCR")/' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   $LSUSB
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'View USB Vendor IDs in default browser') \" stock=\"gtk-info\" label=\"$(gettext 'Vendor ID')\">
    <action>defaultbrowser https://usb-ids.gowdy.us/read/UD/ &</action>
   </menuitem>
   </menu>
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'Audio devices') \" stock=\"gtk-info\" label=\"$(gettext 'Audio')\">
    <action>echo -e "'"▶—— $(gettext "''Audio Devices''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_audio </action>
    <action>cat /tmp/sysinfo-audio >> /tmp/pup-sysinfo.txt </action>
    <action>[ "`which alsa-info.sh`" ] && alsa-info.sh --stdout > /tmp/alsainfo.txt && echo """" >> /tmp/pup-sysinfo.txt && cat /tmp/alsainfo.txt | head -n 2400 | sed -e 's/[©®]//g' -e '/upload=true/d' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   $BATTERY
   <menu stock-id=\"gtk-info\" label=\"$(gettext 'Display')\">
   <menuitem tooltip-text=\" $(gettext 'Basic video report') \" stock=\"gtk-zoom-fit\" label=\"$(gettext 'Summary')\">
    <action>. $WORKDIR/func -sysinfo_video </action>
    <action>refresh:INFO</action>
   </menuitem>
   $VIDEOCOMPLETE
   $VIDEOINFO
   </menu>
   <menuitem tooltip-text=\" $(gettext 'Input devices') \" stock=\"gtk-info\" label=\"$(gettext 'Input')\">
    <action>. $WORKDIR/func -sysinfo_input </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Memory and personal storage') \" stock=\"gtk-info\" label=\"$(gettext 'Memory')\">
    <action>. $WORKDIR/func -sysinfo_memory </action>
    <action>. $WORKDIR/func -sysinfo_memory2 </action>
    <action>cat /tmp/sysinfo-memory > /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Network devices') \" stock=\"gtk-info\" label=\"$(gettext 'Network')\">
    <action>echo -e "'"▶—— $(gettext "''Network Devices''") ——◀"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_netdevices </action>
    <action>cat /tmp/sysinfo-netdevices >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'List of printers') \" stock=\"gtk-info\" label=\"$(gettext 'Printers')\">
    <action>. $WORKDIR/func -sysinfo_printers </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'CPU status') \" stock=\"gtk-info\" label=\"$(gettext 'Sensors')\">
    <action>. $WORKDIR/func -sysinfo_sensors </action>
    <action>. $WORKDIR/func -sysinfo_cpu </action>
    <action>echo -e "'"▶—— $(gettext "''CPU Temperature''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /tmp/sysinfo-sensors >> /tmp/pup-sysinfo.txt</action>
    <action>echo -e "'"\n▶—— $(gettext "''CPU Frequency''") ——◀\n"'" >> /tmp/pup-sysinfo.txt </action>
    <action>cat /tmp/sysinfo-cpu | grep -Ev 'Socket|Manufacturer|Voltage|External|capable' >> /tmp/pup-sysinfo.txt</action>
    <action>refresh:INFO</action>
   </menuitem>
   <label>$(gettext '_Devices')</label>
  </menu>

  <menu use-underline=\"true\">
   $PUPKVIEW
   <menu stock-id=\"gtk-info\" label=\"$(gettext '_Reports')\">
   <menuitem tooltip-text=\" $(gettext 'Basic view of loaded kernel modules') \" stock=\"gtk-zoom-fit\" label=\"$(gettext 'Summary')\">
    <action>. $WORKDIR/func -sysinfo_kmodsummary </action>
    <action>cat /tmp/sysinfo-kernel > /tmp/pup-sysinfo.txt</action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Complete view of loaded kernel modules') \" stock=\"gtk-zoom-in\" label=\"$(gettext 'Complete')\">
    <action>. $WORKDIR/func -sysinfo_kmodcomplete </action>
    <action>cat /tmp/sysinfo-kernel > /tmp/pup-sysinfo.txt</action>
    <action>refresh:INFO</action>
   </menuitem>
   $BLACKLIST
  </menu>
   <label>$(gettext 'D_rivers')</label>
  </menu>

  <menu use-underline=\"true\">
   $bootINIT
   $bootSYSINIT
   $kernelLOG
   $LOGIN
   $sysLOG
   $xerrsLOG
   $xorgLOG
   <label>$(gettext '_Logs')</label>
  </menu>

  <menu use-underline=\"true\">
   $IPINFO
   $SAMBA
   $SEPARATOR
   <menuitem tooltip-text=\" $(gettext 'Network and firewall configuration') \" stock=\"gtk-info\" label=\"$(gettext 'Report')\">
    <action>echo -e "'"▶—— $(gettext "''Network Report''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_netsummary </action>
    <action>. $WORKDIR/func -sysinfo_netcomplete </action>
    <action>cat /tmp/sysinfo-network | sed -e 's/^Session/\nSession/' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <label>$(gettext '_Network')</label>
  </menu>

  <menu use-underline=\"true\">
   <menuitem tooltip-text=\" $(gettext 'Xdialog calendar') \" stock=\"gtk-justify-center\" label=\"$(gettext 'Calendar')\">
    <action>Xdialog --title PSI --no-cancel --calendar '"`date +'%d %B %Y'`"' 0 0 0 0 0 &</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Gtk stock icons') \" stock=\"gtk-about\" label=\"$(gettext 'Gtk Icons')\">
    <action>. $WORKDIR/gtk.icons &</action>
   </menuitem>
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'System information and benchmark tool') \" stock=\"gtk-info\" label=\"$(gettext 'Hardinfo')\">
    <action>. $WORKDIR/func -sysinfo &</action>
   </menuitem>
   $PDIAG
   <menuitem tooltip-text=\" $(gettext 'Hardware-interfaces information') \" stock=\"gtk-info\" label=\"$(gettext 'PupScan')\">
    <action>. $WORKDIR/func -pupscan &</action>
   </menuitem>
   $LH_SYSINFO
   <separator></separator>
   <menuitem tooltip-text=\" $(gettext 'View/Manage system tasks') \" stock=\"gtk-execute\" label=\"$(gettext 'Task Mgr')\">
    <action>$TASKMGR &</action>
   </menuitem>
   $TOP
   <label>$(gettext 'Sys-_Apps')</label>
  </menu>

  <menu use-underline=\"true\">
   <menuitem tooltip-text=\" $(gettext 'Built-in Puppy packages') \" stock=\"gtk-info\" label=\"$(gettext 'Built-in Files')\">
    <action>echo -e "'"▶—— $HOME/.packages/builtin_files ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>echo -e "'"PACKAGE LIST:\n"'" >> /tmp/pup-sysinfo.txt </action>
    <action>ls $HOME/.packages/builtin_files 2>/dev/null | sort -fu >> /tmp/pup-sysinfo.txt </action>
    <action>[ "`ls $HOME/.packages/builtin_files 2>/dev/null`" = "" ] && echo -e "'"No packages are detected in $HOME/.packages/builtin_files."'" >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'File-systems table') \" stock=\"gtk-info\" label=\"$(gettext 'fstab')\">
    <action>echo -e "'"▶—— /etc/fstab ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /etc/fstab >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Command-line history') \" stock=\"gtk-info\" label=\"$(gettext '.history')\">
    <action>. $WORKDIR/func -sysinfo_history </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext '/var/log/packages') \" stock=\"gtk-info\" label=\"$(gettext 'Packages')\">
    <action>. $WORKDIR/func -sysinfo_packages </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'User-installed Puppy packages') \" stock=\"gtk-info\" label=\"$(gettext 'PETS')\">
    <action>. $WORKDIR/func -sysinfo_pets </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Puppy pinboard parameters') \" stock=\"gtk-info\" label=\"$(gettext 'PuppyPin')\">
    <action>. $WORKDIR/func -sysinfo_pinboard </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'List of PupSave files') \" stock=\"gtk-info\" label=\"$(gettext 'PupSaves')\">
    <action>. $WORKDIR/func -sysinfo_pupsaves </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'State of current Puppy session') \" stock=\"gtk-info\" label=\"$(gettext 'PupState')\">
    <action>echo -e "'"▶—— /etc/rc.d/PUPSTATE ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /etc/rc.d/PUPSTATE | sed -e 's/^/ • /g' -e 's/^ • #//g' | sed -e 's/^\(.\)/\U\1/' -e '/^[ACTP]/{x;p;x;}' >> /tmp/pup-sysinfo.txt </action>
    <action>[ -s /etc/BOOTSTATE ] && echo -e "'"\n—— /etc/BOOTSTATE ——◀\n\n`cat /etc/BOOTSTATE`"'" >> /tmp/pup-sysinfo.txt </action>
    <action>echo -e "'"\n▶—— $(gettext "''Common Pupmodes''") ——◀\n"'" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 02 : full install"" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 03 : full install, flash drive"" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 05 : first boot [or pfix=ram]"" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 06 : pup_save is a partition"" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 07 : ditto, but flash drive"" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 12 : normal running puppy"" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 13 : ditto, but flash drive"" >> /tmp/pup-sysinfo.txt </action>
    <action>echo ""PUPMODE 77 : multisession cd/dvd [13+64]"" >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Files that auto-launch from /etc/rc.d/rc.local') \" stock=\"gtk-info\" label=\"$(gettext 'rc.local')\">
    <action>echo -e "'"▶—— /etc/rc.d/rc.local ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /etc/rc.d/rc.local >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Installed SFS files at /mnt/home') \" stock=\"gtk-info\" label=\"$(gettext 'SFS Files')\">
    <action>. $WORKDIR/func -sysinfo_extraSFS </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Files that auto-launch at system startup') \" stock=\"gtk-info\" label=\"$(gettext 'Startup')\">
    <action>. $WORKDIR/func -sysinfo_startup </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Whiteout (.wh) files marked as deleted') \" stock=\"gtk-info\" label=\"$(gettext '.wh Files')\">
    <action>. $WORKDIR/func -sysinfo_whfiles </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Configuration file for startup of X') \" stock=\"gtk-info\" label=\"$(gettext '.xinitrc')\">
    <action>echo -e "'"▶—— /root/.xinitrc ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>cat /root/.xinitrc 2>/dev/null >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Xorg configuration file') \" stock=\"gtk-info\" label=\"$(gettext 'xorg.conf')\">
    <action>echo -e "'"▶—— /etc/X11/xorg.conf ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_xorg.conf </action>
    <action>refresh:INFO</action>
   </menuitem>
   <label>$(gettext 'Sys-Fil_es')</label>
  </menu>

  <menu use-underline=\"true\">
   <menuitem tooltip-text=\" $(gettext 'Hardware summary report') \" stock=\"gtk-info\" label=\"$(gettext 'Base Report')\">
    <action>. $WORKDIR/func -sysinfo_summary </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Computer identification') \" stock=\"gtk-info\" label=\"$(gettext 'Computer ID')\">
    <action>echo -e "'"▶—— $(gettext "''Computer Identification''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>dmidecode -t 1 | grep -E 'Manufacturer:|Product Name:|Serial Number:|UUID:|Version:' | sed -e 's/Manufacturer:/Computer Vendor:/g' -e 's/	//g' >> /tmp/pup-sysinfo.txt </action>
    <action>echo >> /tmp/pup-sysinfo.txt </action>
    <action>dmidecode -t 2 | grep -E 'Asset Tag:|Manufacturer:|Product Name:|Serial Number:|Version:' | sed -e 's/Manufacturer:/Motherboard Vendor:/g' -e 's/	//g' >> /tmp/pup-sysinfo.txt </action>
    <action>echo >> /tmp/pup-sysinfo.txt </action>
    <action>dmidecode -t 0 | grep -E 'Vendor:|Version:|Release Date:|Runtime Size:|ROM Size:' | sed -e 's/Vendor:/BIOS Vendor:/' -e 's/	//g' >> /tmp/pup-sysinfo.txt </action>
    <action>echo >> /tmp/pup-sysinfo.txt </action>
    <action>dmidecode -t 3 | grep -E 'Chassis|Manufacturer|Type|Lock|Version|Serial Number|Asset|Boot-up|Power Supply|Thermal|Security|OEM' | sed 's/	/ /g' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Distro specifications') \" stock=\"gtk-info\" label=\"$(gettext 'Distro Specs')\">
    <action>echo ""▶—— $(gettext "''Distro Specifications''") ——◀"" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_distro </action>
    <action>echo -e "'"\n▶—— /etc/DISTRO_SPECS ——◀\n"'" >> /tmp/pup-sysinfo.txt </action>
    <action>cat /etc/DISTRO_SPECS | sed -e 's/^DISTRO/ • DISTRO/g' -e 's/^#//g' -e '/•/G' | sed -e 's/^\(.\)/\U\1/' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Filesystems allocation') \" stock=\"gtk-info\" label=\"$(gettext 'Filesystems')\">
    <action>echo -e "'"▶—— $(gettext "''Filesystems''") (df -h) ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_filesystems </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'List of available fonts') \" stock=\"gtk-info\" label=\"$(gettext 'Fonts')\">
    <action>. $WORKDIR/func -sysinfo_fonts </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Virtual interface between the user and PC hardware') \" stock=\"gtk-info\" label=\"$(gettext 'Kernel')\">
    <action>echo -e "'"▶—— $(gettext "''Linux Kernel''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_kernel </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Language/Region identifier') \" stock=\"gtk-info\" label=\"$(gettext 'Locale')\">
    <action>echo -e "'"▶—— $(gettext "''Locale Settings''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_country </action>
    <action>echo >> /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_countrylocale </action>
    <action>grep -v Num-Lock /tmp/pup-sysinfo.txt > /tmp/tmp && mv -f /tmp/tmp /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Puppy menu apps') \" stock=\"gtk-info\" label=\"$(gettext 'Menu')\">
    <action>echo -e "'"▶—— $(gettext "''Puppy Menu Apps''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>ls /usr/share/applications | sort -fu | sed 's/.desktop//g' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Searchable directory path to executable files') \" stock=\"gtk-info\" label=\"$(gettext 'Path')\">
    <action>echo -e "'"▶—— $(gettext "''Path''") ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>echo '$PATH' >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Current system processes') \" stock=\"gtk-info\" label=\"$(gettext 'Processes')\">
    <action>echo -e "'"▶—— $(gettext "''System Processes''") (top) ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>[ "`which top`" ] && top -b -n1 | sed '/^Load average/G' >> /tmp/pup-sysinfo.txt </action>
    <action>[ ! "`which top`" ] && ps auxww | cut -c1-37,45-51,65- | grep -vw cut >> /tmp/pup-sysinfo.txt </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Uninterrupted current session') \" stock=\"gtk-info\" label=\"$(gettext 'Uptime')\">
    <action>echo ""▶—— $(gettext "''Uptime''") ——◀"" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_uptime </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Environment variables') \" stock=\"gtk-info\" label=\"$(gettext 'Variables')\">
    <action>echo -e "'"▶—— $(gettext "''Environment Variables''") (env) ——◀\n"'" > /tmp/pup-sysinfo.txt </action>
    <action>. $WORKDIR/func -sysinfo_variables </action>
    <action>refresh:INFO</action>
   </menuitem>
   <menuitem tooltip-text=\" $(gettext 'Block device attributes') \" stock=\"gtk-info\" label=\"$(gettext 'Volumes')\">
    <action>. $WORKDIR/func -sysinfo_volumes </action>
    <action>refresh:INFO</action>
   </menuitem>
   <label>$(gettext 'Sys-_Specs')</label>
  </menu>

  <menu use-underline=\"true\">
   <menuitem tooltip-text=\" $(gettext 'Go to local help in default browser') \" stock=\"gtk-help\" label=\"$(gettext 'Help')\">
    <action>pupsysinfo_help &</action>
   </menuitem>
   <label>$(gettext '_Help')</label>
  </menu>
 </menubar>

  <text use-markup=\"true\"><label>\"<b><span size='"'x-large'"'>Pup</span><span size='"'x-large'"' color='"$COLOR"'>SysInfo</span></b>\"</label></text>

  <frame $(gettext 'Information')>
   <edit name=\"mono\" editable=\"false\">
    <variable>INFO</variable>
    <input file>/tmp/pup-sysinfo.txt</input>
    <height>"$HEIGHT"</height>
    <width>760</width>
   </edit>
  </frame>

</vbox> 
 <action signal=\"show\">echo 100 > /tmp/pupsysinfo/pupsysinfo-splash</action>
 <action signal=\"hide\">exit:Exit</action>
</window>"

$GTKDIALOG -p PUPSYSINFO_DIALOG > /dev/null 2>&1 </dev/null

rm -f /tmp/sysinfo-* 2>/dev/null
rm -f /tmp/KMODULE.tmp 2>/dev/null
unset PUPSYSINFO_DIALOG

LANG=$DEF_LANG
exit 0
