+# args: $1 - debug data type: sys|xorg|disk
+debug_data_collector()
+{
+ local xiin_app='' xiin_data_file='' xiin_download='' error='' b_run_xiin='false'
+ local debug_data_dir='' bsd_string=''
+ local completed_gz_file='' xiin_file='xiin.py' ftp_upload='ftp.techpatterns.com/incoming'
+ local Line='-------------------------'
+ local start_directory=$( pwd )
+
+ if [[ -n $BSD_TYPE ]];then
+ bsd_string="$BSD_TYPE-"
+ fi
+
+ debug_data_dir="inxi-$bsd_string$(tr ' ' '-' <<< $HOSTNAME | tr '[A-Z]' '[a-z]' )-$1-$(date +%Y%m%d)"
+
+ if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
+ if [[ -n $ALTERNATE_FTP ]];then
+ ftp_upload=$ALTERNATE_FTP
+ fi
+ echo "Starting debugging data collection type: $1"
+ echo -n "Checking/creating required directories... "
+ if [[ ! -d $SCRIPT_DATA_DIR ]];then
+ mkdir $SCRIPT_DATA_DIR
+ fi
+ echo 'completed'
+ cd $SCRIPT_DATA_DIR
+ if [[ -d $SCRIPT_DATA_DIR/$debug_data_dir ]];then
+ echo 'Deleting previous xiin data directory...'
+ rm -rf $SCRIPT_DATA_DIR/$debug_data_dir
+ fi
+ mkdir $SCRIPT_DATA_DIR/$debug_data_dir
+ if [[ -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz ]];then
+ echo 'Deleting previous tar.gz file...'
+ rm -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz
+ fi
+
+ echo 'Collecting system info: sensors, lsusb, lspci, lspci -v data, plus /proc data'
+ echo 'also checking for dmidecode data: note, you must be root to have dmidecode work.'
+ echo "Data going into: $SCRIPT_DATA_DIR/$debug_data_dir"
+ # bsd tools
+ pciconf -vl &> $debug_data_dir/bsd-pciconf-vl.txt
+ sysctl -a &> $debug_data_dir/bsd-sysctl-a.txt
+
+ dmidecode &> $debug_data_dir/dmidecode.txt
+
+ lscpu &> $debug_data_dir/lscpu.txt
+ lspci &> $debug_data_dir/lspci.txt
+ lspci -n &> $debug_data_dir/lspci-n.txt
+ lspci -v &> $debug_data_dir/lspci-v.txt
+ lsusb &> $debug_data_dir/lsusb.txt
+ ps aux &> $debug_data_dir/ps-aux.txt
+ runlevel &> $debug_data_dir/runlevel.txt
+ systemctl list-units &> $debug_data_dir/systemctl-list-units.txt
+ systemctl list-units --type=target &> $debug_data_dir/systemctl-list-units-target.txt
+ initctl list &> $debug_data_dir/initctl-list.txt
+ sensors &> $debug_data_dir/sensors.txt
+ strings --version &> $debug_data_dir/strings.txt
+ nvidia-smi -q &> $debug_data_dir/nvidia-smi-q.txt
+ nvidia-smi -q -x &> $debug_data_dir/nvidia-smi-xq.txt
+
+ ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt
+ gcc --version &> $debug_data_dir/gcc-version.txt
+ cat /etc/issue &> $debug_data_dir/etc-issue.txt
+ cat $FILE_LSB_RELEASE &> $debug_data_dir/lsb-release.txt
+ cat $FILE_OS_RELEASE &> $debug_data_dir/os-release.txt
+ cat $FILE_ASOUND_DEVICE &> $debug_data_dir/proc-asound-device.txt
+ cat $FILE_ASOUND_VERSION &> $debug_data_dir/proc-asound-version.txt
+ cat $FILE_CPUINFO &> $debug_data_dir/proc-cpu-info.txt
+ cat $FILE_MEMINFO &> $debug_data_dir/proc-meminfo.txt
+ cat $FILE_MODULES &> $debug_data_dir/proc-modules.txt
+ cat /proc/net/arp &> $debug_data_dir/proc-net-arp.txt
+ # bsd data
+ cat /var/run/dmesg.boot &> $debug_data_dir/bsd-var-run-dmesg.boot.txt
+
+ check_recommends_user_output &> $debug_data_dir/check-recommends-user-output.txt
+ # first download and verify xiin
+ if [[ $B_UPLOAD_DEBUG_DATA == 'true' || $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
+ touch $SCRIPT_DATA_DIR/$debug_data_dir/xiin-error.txt
+ echo "Downloading required tree traverse tool $xiin_file..."
+ if [[ -f xiin && ! -f $xiin_file ]];then
+ mv -f xiin $xiin_file
+ fi
+ # -Nc is creating really weird download anomolies, so using -O instead
+ xiin_download="$( wget -q -O - http://inxi.googlecode.com/svn/branches/xiin/$xiin_file )"
+ # if nothing got downloaded kick out error, otherwise we'll use an older version
+ if [[ $? -gt 0 && ! -f $xiin_file ]];then
+ echo -e "ERROR: Failed to download required file: $xiin_file\nMaybe the remote site is down or your networking is broken?"
+ echo "Continuing with incomplete data collection."
+ echo "$xiin_file download failed and no existing $xiin_file" >> $debug_data_dir/xiin-error.txt
+ elif [[ -n $( grep -s '# EOF' <<< "$xiin_download" ) || -f $xiin_file ]];then
+ if [[ -n $( grep -s '# EOF' <<< "$xiin_download" ) ]];then
+ echo "Updating $xiin_file from remote location"
+ echo "$xiin_download" > $xiin_file
+ else
+ echo "Using local $xiin_file due to download failure"
+ fi
+ b_run_xiin='true'
+ else
+ echo -e "ERROR: $xiin_file downloaded but the program file data is corrupted.\nContinuing with incomplete data collection."
+ echo "$xiin_file downloaded but the program file data is corrupted." >> $debug_data_dir/xiin-error.txt
+ fi
+ fi
+ # note, only bash 4> supports ;;& for case, so using if/then here
+ if [[ $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
+ xiin_data_file=$SCRIPT_DATA_DIR/$debug_data_dir/xiin-sys.txt
+ echo 'Collecting networking data...'
+ ifconfig &> $debug_data_dir/ifconfig.txt
+ ip addr &> $debug_data_dir/ip-addr.txt
+ if [[ $b_run_xiin == 'true' && -z $BSD_TYPE ]];then
+ echo $Line
+ echo "Running $xiin_file tool now on /sys..."
+ echo "Using Python version:" && python --version
+ python --version &> $debug_data_dir/python-version.txt
+ python ./$xiin_file -d /sys -f $xiin_data_file
+ if [[ $? -ne 0 ]];then
+ error=$?
+ echo -e "ERROR: $xiin_file exited with error $error - removing data file.\nContinuing with incomplete data collection."
+ echo "Continuing with incomplete data collection."
+ rm -f $xiin_data_file
+ echo "$xiin_file data generation failed with python error $error" >> $debug_data_dir/xiin-error.txt
+ fi
+ echo $Line
+ fi
+ fi
+ if [[ $1 == 'xorg' || $1 == 'all' ]];then
+ if [[ $B_RUNNING_IN_DISPLAY != 'true' ]];then
+ echo 'Warning: only some of the data collection can occur if you are not in X'
+ touch $debug_data_dir/warning-user-not-in-x
+ fi
+ if [[ $B_ROOT == 'true' ]];then
+ echo 'Warning: only some of the data collection can occur if you are running as Root user'
+ touch $debug_data_dir/warning-root-user
+ fi
+ echo 'Collecting Xorg log and xorg.conf files'
+ if [[ -e $FILE_XORG_LOG ]];then
+ cat $FILE_XORG_LOG &> $debug_data_dir/xorg-log-file.txt
+ else
+ touch $debug_data_dir/no-xorg-log-file
+ fi
+ if [[ -e /etc/X11/xorg.conf ]];then
+ cp /etc/X11/xorg.conf $SCRIPT_DATA_DIR/$debug_data_dir
+ else
+ touch $debug_data_dir/no-xorg-conf-file
+ fi
+ if [[ -n $( ls /etc/X11/xorg.conf.d/ 2>/dev/null ) ]];then
+ ls /etc/X11/xorg.conf.d &> $debug_data_dir/ls-etc-x11-xorg-conf-d.txt
+ cp /etc/X11/xorg.conf.d $SCRIPT_DATA_DIR/$debug_data_dir
+ else
+ touch $debug_data_dir/no-xorg-conf-d-files
+ fi
+ echo 'Collecting X, xprop, glxinfo, xrandr, xdpyinfo data...'
+ xprop -root &> $debug_data_dir/xprop_root.txt
+ glxinfo &> $debug_data_dir/glxinfo.txt
+ xdpyinfo &> $debug_data_dir/xdpyinfo.txt
+ xrandr &> $debug_data_dir/xrandr.txt
+ X -version &> $debug_data_dir/x-version.txt
+ Xorg -version &> $debug_data_dir/xorg-version.txt
+ echo $GNOME_DESKTOP_SESSION_ID &> $debug_data_dir/gnome-desktop-session-id.txt
+ # kde 3 id
+ echo $KDE_FULL_SESSION &> $debug_data_dir/kde3-ful-session.txt
+ echo $KDE_SESSION_VERSION &> $debug_data_dir/kde456-session-version.txt
+ echo "$(kded$KDE_SESSION_VERSION --version )" &> $debug_data_dir/kde-version-data.txt
+ echo $XDG_CURRENT_DESKTOP &> $debug_data_dir/xdg-current-desktop.txt
+ fi
+ if [[ $1 == 'disk' || $1 == 'all' ]];then
+ echo 'Collecting dev, label, disk, uuid data, df...'
+ ls -l /dev &> $debug_data_dir/dev-data.txt
+ ls -l /dev/disk &> $debug_data_dir/dev-disk-data.txt
+ ls -l /dev/disk/by-id &> $debug_data_dir/dev-disk-id-data.txt
+ ls -l /dev/disk/by-label &> $debug_data_dir/dev-disk-label-data.txt
+ ls -l /dev/disk/by-uuid &> $debug_data_dir/dev-disk-uuid-data.txt
+ ls -l /dev/disk/by-path &> $debug_data_dir/dev-disk-path-data.txt
+ ls -l /dev/mapper &> $debug_data_dir/dev-disk-mapper-data.txt
+ readlink /dev/root &> $debug_data_dir/dev-root.txt
+ df -h -T -P --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 --exclude-type=devfs --exclude-type=linprocfs --exclude-type=sysfs --exclude-type=fdescfs &> $debug_data_dir/df-h-T-P-excludes.txt
+ df -T -P --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 --exclude-type=devfs --exclude-type=linprocfs --exclude-type=sysfs --exclude-type=fdescfs &> $debug_data_dir/df-T-P-excludes.txt
+ df -H -T &> $debug_data_dir/bsd-df-H-T-no-excludes.txt
+ df -H &> $debug_data_dir/bsd-df-H-no-excludes.txt
+ # bsd tool
+ mount &> $debug_data_dir/mount.txt
+ gpart list &> $debug_data_dir/bsd-gpart-list.txt
+ gpart show &> $debug_data_dir/bsd-gpart-show.txt
+ gpart status &> $debug_data_dir/bsd-gpart-status.txt
+ swapctl -l &> $debug_data_dir/bsd-swapctl-l.txt
+ swapon -s &> $debug_data_dir/swapon-s.txt
+ sysctl -b kern.geom.conftxt &> $debug_data_dir/bsd-sysctl-b-kern.geom.conftxt.txt
+ sysctl -b kern.geom.confxml &> $debug_data_dir/bsd-sysctl-b-kern.geom.confxml.txt
+ zfs list &> $debug_data_dir/bsd-zfs-list.txt
+ zpool list &> $debug_data_dir/bsd-zpool-list.txt
+ zpool list -v &> $debug_data_dir/bsd-zpool-list-v.txt
+ df -P --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 &> $debug_data_dir/df-P-excludes.txt
+ df -P &> $debug_data_dir/bsd-df-P-no-excludes.txt
+ cat /proc/mdstat &> $debug_data_dir/proc-mdstat.txt
+ cat $FILE_PARTITIONS &> $debug_data_dir/proc-partitions.txt
+ cat $FILE_SCSI &> $debug_data_dir/proc-scsi.txt
+ cat $FILE_MOUNTS &> $debug_data_dir/proc-mounts.txt
+ cat /proc/sys/dev/cdrom/info &> $debug_data_dir/proc-cdrom-info.txt
+ ls /proc/ide/ &> $debug_data_dir/proc-ide.txt
+ cat /proc/ide/*/* &> $debug_data_dir/proc-ide-hdx-cat.txt
+ cat /etc/fstab &> $debug_data_dir/etc-fstab.txt
+ cat /etc/mtab &> $debug_data_dir/etc-mtab.txt
+ fi
+ echo 'Creating inxi output file now. This can take a few seconds...'
+ echo "Starting $SCRIPT_NAME from: $start_directory"
+ cd $start_directory
+ $SCRIPT_PATH/$SCRIPT_NAME -FRploudxxx -c 0 -@ 8 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRploudxxx.txt
+ cp $LOG_FILE $SCRIPT_DATA_DIR/$debug_data_dir
+ if [[ -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz ]];then
+ echo "Found and removing previous tar.gz data file: $debug_data_dir.tar.gz"
+ rm -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz
+ fi
+ cd $SCRIPT_DATA_DIR
+ echo 'Creating tar.gz compressed file of this material now. Contents:'
+ echo $Line
+ tar -cvzf $debug_data_dir.tar.gz $debug_data_dir
+ echo $Line
+ echo 'Cleaning up leftovers...'
+ rm -rf $debug_data_dir
+ echo 'Testing gzip file integrity...'
+ gzip -t $debug_data_dir.tar.gz
+ if [[ $? -gt 0 ]];then
+ echo 'Data in gz is corrupted, removing gzip file, try running data collector again.'
+ rm -f $debug_data_dir.tar.gz
+ echo "Data in gz is corrupted, removed gzip file" >> $debug_data_dir/gzip-error.txt
+ else
+ echo 'All done, you can find your data gzipped directory here:'
+ completed_gz_file=$SCRIPT_DATA_DIR/$debug_data_dir.tar.gz
+ echo $completed_gz_file
+ if [[ $B_UPLOAD_DEBUG_DATA == 'true' ]];then
+ echo $Line
+ if [[ $b_run_xiin == 'true' ]];then
+ echo "Running automatic upload of data to remote server $ftp_upload now..."
+ python ./$xiin_file --version
+ python ./$xiin_file -u $completed_gz_file $ftp_upload
+ if [[ $? -gt 0 ]];then
+ echo $Line
+ echo "Error: looks like the ftp upload failed. Error number: $?"
+ echo "The ftp upload failed. Error number: $?" >> $debug_data_dir/xiin-error.txt
+ fi
+ else
+ echo 'Unable to run the automoatic ftp upload because of an error with the xiin download.'
+ echo "Unable to run the automoatic ftp upload because of an error with the xiin download" >> $debug_data_dir/xiin-error.txt
+ fi
+ else
+ echo 'You can upload this here using most file managers: ftp.techpatterns.com/incoming'
+ echo 'then let a maintainer know it is uploaded.'
+ fi
+ fi
+ else
+ echo 'This feature only available in console or shell client! Exiting now.'
+ fi
+ exit 0
+}
+
+check_recommends_user_output()
+{
+ local Line='-----------------------------------------------------------------------------------------'
+ local gawk_version='N/A' sed_version='N/A' sudo_version='N/A' python_version='N/A'
+
+ if [[ $B_RUNNING_IN_SHELL != 'true' ]];then
+ print_screen_output "Sorry, you can't run this option in an IRC client."
+ exit 1
+ fi
+
+ initialize_paths
+
+ echo "$SCRIPT_NAME will now begin checking for the programs it needs to operate. First a check of"
+ echo "the main languages and tools $SCRIPT_NAME uses. Python is only for debugging data collection."
+ echo $Line
+ echo "Bash version: $( bash --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^GNU bash/ {print $4}' )"
+ if [[ -n $( type -p gawk ) ]];then
+ gawk_version=$( gawk --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^GNU Awk/ {print $3}' )
+ fi
+ if [[ -n $( type -p sed ) ]];then
+ sed_version=$( sed --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^GNU sed version/ {print $4}' )
+ if [[ -z $sed_version ]];then
+ # note: bsd sed shows error with --version flag
+ sed_version=$( sed --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^sed: illegal option/ {print "BSD sed"}' )
+ fi
+ fi
+ if [[ -n $( type -p sudo ) ]];then
+ sudo_version=$( sudo -V 2>&1 | awk 'BEGIN {IGNORECASE=1} /^Sudo version/ {print $3}' )
+ fi
+ if [[ -n $( type -p python ) ]];then
+ python_version=$( python --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^Python/ {print $2}' )
+ fi
+ echo "Gawk version: $gawk_version"
+ echo "Sed version: $sed_version"
+ echo "Sudo version: $sudo_version"
+ echo "Python version: $python_version"
+ echo $Line
+ echo "Test One: Required System Directories."
+ echo "If one of these system directories is missing, $SCRIPT_NAME cannot operate:"
+ echo
+ check_recommends_items 'required-dirs'
+ echo "Test Two: Required Core Applications."
+ echo "If one of these applications is missing, $SCRIPT_NAME cannot operate:"
+ echo
+ check_recommends_items 'required-apps'
+ echo 'Test Three: Script Recommends for Graphics Features. If you do not use X these do not matter.'
+ echo "If one of these applications is missing, $SCRIPT_NAME will have incomplete output:"
+ echo
+ check_recommends_items 'recommended-x-apps'
+ echo 'Test Four: Script Recommends for Remaining Features.'
+ echo "If one of these applications is missing, $SCRIPT_NAME will have incomplete output:"
+ echo
+ check_recommends_items 'recommended-apps'
+ echo 'Test Five: System Directories for Various Information.'
+ echo "If one of these directories is missing, $SCRIPT_NAME will have incomplete output:"
+ echo
+ check_recommends_items 'system-dirs'
+ echo 'All tests completed.'
+}
+# args: $1 - check item
+check_recommends_items()
+{
+ local item='' item_list='' item_string='' missing_items='' missing_string=''
+ local package='' application='' feature='' type='' starter='' finisher=''
+ local package_deb='' package_pacman='' package_rpm=''
+ local print_string='' separator=''
+ local required_dirs='/proc /sys'
+ # package-owner: 1 - debian/ubuntu; 2 - arch; 3 - yum/rpm
+ # pardus: pisi sf -q /usr/bin/package
+ local required_apps='
+ df:coreutils~coreutils~coreutils~:partition_data
+ gawk:gawk~gawk~gawk~:core_tool
+ grep:grep~grep~grep~:string_search
+ lspci:pciutils~pciutils~pciutils~:hardware_data
+ ps:procps~procps~procps~:process_data
+ readlink:coreutils~coreutils~coreutils~:
+ sed:sed~sed~sed~:string_replace
+ tr:coreutils~coreutils~coreutils~:character_replace
+ uname:uname~coreutils~coreutils~:kernel_data
+ uptime:procps~procps~procps~:
+ wc:coreutils~coreutils~coreutils~:word_character_count
+ '
+ local x_recommends='
+ glxinfo:mesa-utils~mesa-demos~glx-utils_(openSUSE_12.3_and_later_Mesa-demo-x)~:-G_glx_info
+ xdpyinfo:X11-utils~xorg-xdpyinfo~xorg-x11-utils~:-G_multi_screen_resolution
+ xprop:X11-utils~xorg-xprop~x11-utils~:-S_desktop_data
+ xrandr:x11-xserver-utils~xrandr~x11-server-utils~:-G_single_screen_resolution
+ '
+ local recommended_apps='
+ dmidecode:dmidecode~dmidecode~dmidecode~:-M_if_no_sys_machine_data
+ file:file~file~file~:-o_unmounted_file_system
+ hddtemp:hddtemp~hddtemp~hddtemp~:-Dx_show_hdd_temp
+ ifconfig:net-tools~net-tools~net-tools~:-i_ip_lan-deprecated
+ ip:iproute~iproute2~iproute~:-i_ip_lan
+ sensors:lm-sensors~lm_sensors~lm-sensors~:-s_sensors_output
+ strings:binutils~~~:-I_sysvinit_version
+ lsusb:usbutils~usbutils~usbutils~:-A_usb_audio;-N_usb_networking
+ modinfo:module-init-tools~module-init-tools~module-init-tools~:-Ax,-Nx_module_version
+ runlevel:sysvinit~sysvinit~systemd~:-I_runlevel
+ sudo:sudo~sudo~sudo~:-Dx_hddtemp-user;-o_file-user
+ '
+ local recommended_dirs='
+ /sys/class/dmi/id:-M_system,_motherboard,_bios
+ /dev:-l,-u,-o,-p,-P,-D_disk_partition_data
+ /dev/disk/by-label:-l,-o,-p,-P_partition_labels
+ /dev/disk/by-uuid:-u,-o,-p,-P_partition_uuid
+ /var/run/dmesg.boot:-C,-f_(BSD_only)
+ '
+
+ case $1 in
+ required-dirs)
+ item_list=$required_dirs
+ item_string='Required file system'
+ missing_string='system directories'
+ type='directories'
+ ;;
+ required-apps)
+ item_list=$required_apps
+ item_string='Required application'
+ missing_string='applications, and their corresponding packages,'
+ type='applications'
+ ;;
+ recommended-x-apps)
+ item_list=$x_recommends
+ item_string='Recommended X application'
+ missing_string='applications, and their corresponding packages,'
+ type='applications'
+ ;;
+ recommended-apps)
+ item_list=$recommended_apps
+ item_string='Recommended application'
+ missing_string='applications, and their corresponding packages,'
+ type='applications'
+ ;;
+ system-dirs)
+ item_list=$recommended_dirs
+ item_string='System directory'
+ missing_string='system directories'
+ type='directories'
+ ;;
+ esac
+ # great trick from: http://ideatrash.net/2011/01/bash-string-padding-with-sed.html
+ # left pad: sed -e :a -e 's/^.\{1,80\}$/& /;ta'
+ # right pad: sed -e :a -e 's/^.\{1,80\}$/ &/;ta'
+ # center pad: sed -e :a -e 's/^.\{1,80\}$/ & /;ta'
+
+ for item in $item_list
+ do
+ if [[ $( awk -F ":" '{print NF-1}' <<< $item ) -eq 0 ]];then
+ application=$item
+ package=''
+ feature=''
+ location=''
+ elif [[ $( awk -F ":" '{print NF-1}' <<< $item ) -eq 1 ]];then
+ application=$( cut -d ':' -f 1 <<< $item )
+ package=''
+ feature=$( cut -d ':' -f 2 <<< $item )
+ location=''
+ else
+ application=$( cut -d ':' -f 1 <<< $item )
+ package=$( cut -d ':' -f 2 <<< $item )
+ location=$( type -p $application )
+ if [[ $( awk -F ":" '{print NF-1}' <<< $item ) -eq 2 ]];then
+ feature=$( cut -d ':' -f 3 <<< $item )
+ else
+ feature=''
+ fi
+ fi
+ if [[ -n $feature ]];then
+ print_string="$item_string: $application (info: $( sed 's/_/ /g' <<< $feature ))"
+ else
+ print_string="$item_string: $application"
+ fi
+
+ starter="$( sed -e :a -e 's/^.\{1,75\}$/&./;ta' <<< $print_string )"
+ if [[ -z $( grep '^/' <<< $application ) && -n $location ]] || [[ -d $application ]];then
+ if [[ -n $location ]];then
+ finisher=" $location"
+ else
+ finisher=" Present"
+ fi
+ else
+ finisher=" Missing"
+ missing_items="$missing_items$separator$application:$package"
+ separator=' '
+ fi
+
+ echo "$starter$finisher"
+ done
+ echo
+ if [[ -n $missing_items ]];then
+ echo "The following $type are missing from your system:"
+ for item in $missing_items
+ do
+ application=$( cut -d ':' -f 1 <<< $item )
+ if [[ $type == 'applications' ]];then
+ # echo '--------------------------------------------------------'
+ echo
+ package=$( cut -d ':' -f 2 <<< $item )
+ package_deb=$( cut -d '~' -f 1 <<< $package )
+ package_pacman=$( cut -d '~' -f 2 <<< $package )
+ package_rpm=$( cut -d '~' -f 3 <<< $package )
+ echo "Application: $application"
+ echo "To add to your system, install the proper distribution package for your system:"
+ echo "Debian/Ubuntu: $package_deb :: Arch Linux: $package_pacman :: Redhat/Fedora/Suse: $package_rpm"
+ else
+ echo "Directory: $application"
+ fi
+ done
+ if [[ $item_string == 'System directory' ]];then
+ echo "These directories are created by the kernel, so don't worry if they are not present."
+ fi
+ else
+ echo "All the $( cut -d ' ' -f 1 <<< $item_string | sed -e 's/Re/re/' -e 's/Sy/sy/' ) $type are present."
+ fi
+ echo $Line
+}
+