| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2002-2003 by NCHC, Steven Shiau, K. L. Huang |
| 4 | # (steven _at_ clonezilla org, klhaung _at_ gmail com) |
| 5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation; either version 2, or (at your option) |
| 9 | # any later version. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program; if not, write to the Free Software |
| 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | # |
| 20 | |
| 21 | # Load DRBL setting and functions |
| 22 | # Setting |
| 23 | # Source function library. |
| 24 | [ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions |
| 25 | |
| 26 | # Load DRBL setting and functions |
| 27 | DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}" |
| 28 | . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions |
| 29 | |
| 30 | # get the distribution name and type: OS_Version and OS_type |
| 31 | check_distribution_name |
| 32 | |
| 33 | # Settings |
| 34 | # PKG_FROM_DRBL is loaded from drbl.conf, we append "drbl, partimage, ntfsprogs lzop..." |
| 35 | PKG_FROM_DRBL="drbl $PKG_FROM_DRBL partimage ntfsprogs gzip bzip2 lzop pigz pbzip2 udpcast syslinux" |
| 36 | |
| 37 | echo -n "Acquiring some info about the system." |
| 38 | # |
| 39 | echo -n . |
| 40 | case "$OS_Version" in |
| 41 | RH*|FC*|CO*|MDK*|MDV*|SUSE*) |
| 42 | for ipkg in $PKG_FROM_DRBL; do |
| 43 | ipkg_ver="" |
| 44 | ipkg_ver="$(rpm -q $ipkg)" |
| 45 | [ -n $ipkg_ver ] && installed_pkgs="$installed_pkgs $ipkg_ver" |
| 46 | done |
| 47 | |
| 48 | # Extra: glibc and mkpxeinitrd-net |
| 49 | glibc_ver="$(rpm -q glibc)" |
| 50 | LC_ALL=C rpm -q --qf '%{ARCH}' glibc > /dev/null && glibc_arch=`rpm -q --qf '%{ARCH}' glibc` |
| 51 | ;; |
| 52 | DBN*) |
| 53 | for ipkg in $PKG_FROM_DRBL; do |
| 54 | ipkg_ver="" |
| 55 | ipkg_ver="$(LC_ALL=C dpkg -l $ipkg | tail -n 1 | awk -F" " '{print $2"-"$3}')" |
| 56 | [ -n $ipkg_ver ] && installed_pkgs="$installed_pkgs $ipkg_ver" |
| 57 | done |
| 58 | ;; |
| 59 | *) |
| 60 | echo "This version in this distribution is NOT supported by DRBL, maybe you can try to use the drbl in testing or unstable repository. Program terminated!" |
| 61 | exit 1 |
| 62 | esac |
| 63 | |
| 64 | echo -n . |
| 65 | ARCH="$(LC_ALL=C uname -m)" |
| 66 | Kernel_VER="$(LC_ALL=C uname -r)" |
| 67 | SERVER_CPU="$(LC_ALL=C awk -F":" '/^model name/ {print $2}' /proc/cpuinfo | sort | uniq)" |
| 68 | |
| 69 | echo -n . |
| 70 | if [ -f $pxecfg_pd/kernel_version_in_initrd.txt ]; then |
| 71 | client_kernel_ver="$(LC_ALL=C cat $pxecfg_pd/kernel_version_in_initrd.txt)" |
| 72 | fi |
| 73 | |
| 74 | if [ -f $pxecfg_pd/client_kernel_arch.txt ]; then |
| 75 | client_kernel_arch="$(LC_ALL=C cat $pxecfg_pd/client_kernel_arch.txt)" |
| 76 | fi |
| 77 | |
| 78 | echo -n . |
| 79 | # server memory |
| 80 | server_mem_size="$(LC_ALL=C cat /proc/meminfo | grep "^MemTotal:" | awk -F" " '{print $2" " $3}')" |
| 81 | |
| 82 | # |
| 83 | echo -n . |
| 84 | total_client_no="$(LC_ALL=C get-client-ip-list | wc -l)" |
| 85 | |
| 86 | # To strip the line feed, we use echo `` |
| 87 | echo -n . |
| 88 | private_NIC="$(LC_ALL=C get-all-nic-ip --private-ip-port)" |
| 89 | echo -n . |
| 90 | private_IP="$(LC_ALL=C get-all-nic-ip --private-ip-address)" |
| 91 | echo -n . |
| 92 | client_IP="$(echo `get-client-ip-list`)" |
| 93 | |
| 94 | |
| 95 | echo " done!" |
| 96 | |
| 97 | # output the results: |
| 98 | time_now="$(LC_ALL=C date +%Y%m%d-%H%M)" |
| 99 | output_filename="DRBL-BUG-RPT-${time_now}.txt" |
| 100 | |
| 101 | # dump it |
| 102 | cat <<-REP_END > $output_filename |
| 103 | To report the bug, fill out the contents in the following table, then send it to DRBL mailing list or post it on the DRBL forum." |
| 104 | -------CUT BEGIN HERE-------------------------------------------- |
| 105 | Description of problem: |
| 106 | |
| 107 | How reproducible: |
| 108 | |
| 109 | Steps to Reproduce: |
| 110 | |
| 111 | Actual results: |
| 112 | |
| 113 | Expected results: |
| 114 | |
| 115 | |
| 116 | Some info about the DRBL environment (PLEASE DO NOT EDIT THEM!): |
| 117 | === |
| 118 | OS version: $FULL_OS_Version |
| 119 | Server arch: $ARCH |
| 120 | Server CPU: $SERVER_CPU |
| 121 | Server memory size: $server_mem_size |
| 122 | Server Kernel version: $Kernel_VER |
| 123 | Installed DRBL-related packages: $installed_pkgs |
| 124 | REP_END |
| 125 | |
| 126 | # This is only necessary for RH-like |
| 127 | if [ -n "$glibc_ver" ]; then |
| 128 | cat <<-REP_END >> $output_filename |
| 129 | Server glibc ver and arch: $glibc_ver $glibc_arch |
| 130 | REP_END |
| 131 | fi |
| 132 | |
| 133 | cat <<-REP_END >> $output_filename |
| 134 | Client kernel version: $client_kernel_ver |
| 135 | Client kernel arch: $client_kernel_arch |
| 136 | NICs with private IP address in server: $private_NIC |
| 137 | Private IP address in server: $private_IP |
| 138 | Total client no: $total_client_no |
| 139 | Client IP address: $client_IP |
| 140 | === |
| 141 | -------CUT END HERE---------------------------------------------- |
| 142 | REP_END |
| 143 | |
| 144 | [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
| 145 | echo "The results are in file $output_filename" |
| 146 | [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
| 147 | echo "To report the bug, fill the contents in file $output_filename then send it to DRBL mailing list or post it on the DRBL forum." |