Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added usr directory to repository and updated related config and make…

…files
  • Loading branch information...
commit 76c0cbfabb8c4929bc91b5c1626d7d9a52ec7fcc 1 parent 46c2486
@shrirang shrirang authored
View
2  Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/config/rpm.am
include ${top_srcdir}/config/deb.am
include ${top_srcdir}/config/tgz.am
-USER_DIR = etc include
+USER_DIR = etc include usr
KERNEL_DIR = module
SUBDIRS = $(KERNEL_DIR) $(USER_DIR)
View
12 Makefile.in
@@ -41,9 +41,9 @@ DIST_COMMON = $(am__configure_deps) $(noinst_HEADERS) \
$(top_srcdir)/config/rpm.am $(top_srcdir)/configure \
$(top_srcdir)/etc/Makefile.in \
$(top_srcdir)/include/Makefile.in \
- $(top_srcdir)/module/Makefile.in config/config.guess \
- config/config.sub config/install-sh config/ltmain.sh \
- config/missing install-sh ltmain.sh
+ $(top_srcdir)/module/Makefile.in $(top_srcdir)/usr/Makefile.in \
+ config/config.guess config/config.sub config/install-sh \
+ config/ltmain.sh config/missing install-sh ltmain.sh
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/lzfs-build.m4 \
@@ -55,7 +55,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = lzfs_config.h
CONFIG_CLEAN_FILES = module/Makefile etc/Makefile include/Makefile \
- lzfs.spec
+ usr/Makefile lzfs.spec
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
@@ -249,7 +249,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-USER_DIR = etc include
+USER_DIR = etc include usr
KERNEL_DIR = module
SUBDIRS = $(KERNEL_DIR) $(USER_DIR)
AUTOMAKE_OPTIONS = foreign dist-zip
@@ -317,6 +317,8 @@ etc/Makefile: $(top_builddir)/config.status $(top_srcdir)/etc/Makefile.in
cd $(top_builddir) && $(SHELL) ./config.status $@
include/Makefile: $(top_builddir)/config.status $(top_srcdir)/include/Makefile.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+usr/Makefile: $(top_builddir)/config.status $(top_srcdir)/usr/Makefile.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
lzfs.spec: $(top_builddir)/config.status $(srcdir)/lzfs.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
View
74 configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.66.
+# Generated by GNU Autoconf 2.67.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -811,8 +811,9 @@ do
fi
case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -1459,7 +1460,7 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
configure
-generated by GNU Autoconf 2.66
+generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1531,7 +1532,7 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
+ test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
@@ -1594,7 +1595,7 @@ if ac_fn_c_try_cpp "$LINENO"; then :
else
ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
@@ -1931,7 +1932,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.66. Invocation command line was
+generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -2189,7 +2190,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
done
@@ -2513,7 +2514,7 @@ fi
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -2546,7 +2547,7 @@ fi
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -2579,7 +2580,7 @@ fi
$as_echo "$ac_cv_target" >&6; }
case $ac_cv_target in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
esac
target=$ac_cv_target
ac_save_IFS=$IFS; IFS='-'
@@ -2708,11 +2709,11 @@ am_lf='
'
case `pwd` in
*[\\\"\#\$\&\'\`$am_lf]*)
- as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
esac
# Do `set' in a subshell so we don't clobber the current shell's
@@ -3885,7 +3886,7 @@ fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -4000,7 +4001,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -4043,7 +4044,7 @@ else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -4102,7 +4103,7 @@ $as_echo "$ac_try_echo"; } >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
fi
fi
@@ -4154,7 +4155,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
@@ -4611,7 +4612,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -4627,11 +4628,11 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -4670,7 +4671,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -4686,18 +4687,18 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
ac_ext=c
@@ -5088,7 +5089,7 @@ fi
done
-ac_config_files="$ac_config_files Makefile module/Makefile etc/Makefile include/Makefile lzfs.spec"
+ac_config_files="$ac_config_files Makefile module/Makefile etc/Makefile include/Makefile usr/Makefile lzfs.spec"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -5617,7 +5618,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.66. Invocation command line was
+generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -5683,7 +5684,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.66,
+configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -5704,11 +5705,16 @@ ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
+ --*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$1
ac_optarg=$2
@@ -5730,6 +5736,7 @@ do
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
@@ -5811,9 +5818,10 @@ do
"module/Makefile") CONFIG_FILES="$CONFIG_FILES module/Makefile" ;;
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
"include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+ "usr/Makefile") CONFIG_FILES="$CONFIG_FILES usr/Makefile" ;;
"lzfs.spec") CONFIG_FILES="$CONFIG_FILES lzfs.spec" ;;
- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
esac
done
@@ -6129,7 +6137,7 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -6157,7 +6165,7 @@ do
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
@@ -6184,7 +6192,7 @@ $as_echo "$as_me: creating $ac_file" >&6;}
case $ac_tag in
*:-:* | *:-) cat >"$tmp/stdin" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
View
1  configure.ac
@@ -37,6 +37,7 @@ AC_CONFIG_FILES([
module/Makefile
etc/Makefile
include/Makefile
+ usr/Makefile
lzfs.spec
])
AC_OUTPUT
View
16 etc/Makefile.in
@@ -1,11 +1,12 @@
etcdir = /etc
initddir = $(etcdir)/init.d
+zfsdir = $(etcdir)/zfs
INSTALL = /usr/bin/install -c
all:
-install: install_initd
-uninstall: uninstall_initd
+install: install_initd install_zfs
+uninstall: uninstall_initd uninstall_zfs
install_initd:
if [ -f /etc/debian_version ]; then \
@@ -45,6 +46,17 @@ uninstall_initd_debian:
service zfsload stop
/usr/sbin/update-rc.d -f zfsload remove
+install_zfs:
+ test -z "$(zfsdir)" || /bin/mkdir -p "$(DESTDIR)$(zfsdir)"
+ $(INSTALL) -m 755 zfs/zfs_config \
+ $(DESTDIR)$(zfsdir)/
+ $(INSTALL) -m 755 zfs/zfs_serial \
+ $(DESTDIR)$(zfsdir)/
+
+uninstall_zfs:
+ /bin/rm -f /etc/zfs/zfs_config
+ /bin/rm -f /etc/zfs/zfs_serial
+
clean:
distclean:
View
4 etc/zfs/zfs_config
@@ -0,0 +1,4 @@
+user=
+password=
+server=
+port=
View
1  etc/zfs/zfs_serial
@@ -0,0 +1 @@
+asdfadsfpup8uyfauf8sdfj
View
6 lzfs.spec.in
@@ -177,7 +177,7 @@ License: GPL
URL: KQ
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id} -un)
Source: %{name}-%{version}.tar.gz
-Requires: %{requires} spl zfs
+Requires: %{requires} spl zfs python-dmidecode SOAPpy
%description
@@ -203,6 +203,10 @@ rm -rf $RPM_BUILD_ROOT
/lib/modules/*
%{_prefix}/src/*
%attr(0755,root,root) %{_sysconfdir}/init.d/zfsload
+/usr/sbin/zfs_manage.py
+/usr/sbin/SystemReport.sh
+/etc/zfs/zfs_config
+/etc/zfs/zfs_serial
%post
if [ -f /boot/System.map-%{kver} ]; then
View
29 usr/Makefile.in
@@ -0,0 +1,29 @@
+usrdir = /usr
+sbindir = $(usrdir)/sbin
+INSTALL = /usr/bin/install -c
+
+all:
+
+install: install_initd
+
+uninstall: uninstall_initd
+
+install_initd:
+ test -z "$(usrdir)" || /bin/mkdir -p "$(DESTDIR)$(sbindir)"
+ $(INSTALL) -m 755 sbin/zfs_manage.py \
+ $(DESTDIR)$(sbindir)/
+ $(INSTALL) -m 755 sbin/SystemReport.sh \
+ $(DESTDIR)$(sbindir)/
+
+uninstall_initd:
+ /bin/rm -f /usr/sbin/SystemReport.sh
+ /bin/rm -f /usr/sbin/zfs_manage.py
+
+clean:
+
+distclean:
+
+check:
+
+distdir:
+ find ./ | xargs /bin/cp -rt $$distdir/$$subdir;
View
913 usr/sbin/SystemReport.sh
@@ -0,0 +1,913 @@
+#!/usr/bin/env bash
+#
+# System Report Script, Version 1.05
+#
+# The purpose of this script is to use shell commands to build a set of html files in a
+# folder in the user's folder called home/username/SysReport where username is replaced with
+# the username of the logged on user. This set of files will load
+# via home/username/SysReport/index.html a frame set with navigation in the left frame,
+# and individual reports about different parts of the system in the right frame of the document.
+#
+#
+
+BASE=`pwd`
+
+function startup {
+ echo "Creating SysReport Folder"
+ if [ -e $BASE/SysReport ] && [ -d $BASE/SysReport ]
+ then : # if it exists and is a folder do nothing
+ else mkdir $BASE/SysReport
+ fi
+}
+
+function cleanup {
+ cd $BASE
+ tar -Pczf ./SysReport.tar.gz ./SysReport/
+ rm -rf ./SysReport/
+}
+
+function Ubuntu {
+startup
+
+#Creat index.html
+cat > $BASE/SysReport/index.html << EOF
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML><HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
+ <META NAME="Author" Content="Ray Parrish">
+ <TITLE>System Report</TITLE>
+</HEAD>
+<FRAMESET COLS = "21%,79% " >
+ <FRAME SRC="navigate.html" NAME="Navigate" RESIZE>
+ <FRAME SRC="Introduction.html" NAME="Modules" RESIZE>
+</FRAMESET>
+<NOFRAMES>
+<BODY>
+<P>
+</BODY>
+</NOFRAMES>
+</HTML>
+EOF
+
+##################################################################################
+#echo "Creating Introduction.html"
+# Here I create the introduction page.
+cat > $BASE/SysReport/Introduction.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Introduction to System Report</title>
+</head>
+<body>
+<center><p>Welcome, you are logged in as: $USER</center>
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td
+style="vertical-align: top; background-color: rgb(153, 255, 255);">Welcome
+to the script generated
+System Report for Ubuntu systems. This
+set of web pages is generated from many accessible files and commands
+on your
+system by the SystemReport.sh file. This set of pages was generated by Version 1.05 of SystemReport.sh<br>
+<br>
+Each report is listed in the navigation frame on the left and will load
+in this frame. Each section includes an explanation of what
+command or file was accessed to generate that section of the report.<br>
+<br>
+As I learn more about Ubuntu and Linux and scripting the
+SystemReport.sh file will grow and so will the number of html files it
+generates. Look for it at <a href="http://www.rayslinks.com/scripts/SysReport.html" target="blank">System Report Script</a> to see if there are new
+versions of it.<br>
+<br>
+The SystemReport.sh file is open source and so I encourage you to add
+to it yourself as long as you don't hold me responsible for any damages
+your changes cause. 8-)<br>
+<br>
+If you do add a section to one of the pages, or even a whole page to the set, please
+<a href="mailto:crp@cmc.net?subject=System Report changes">email me</a> your changes or additions only. Please don't send me the whole script to look through for your changes.
+<p>SystemReport.sh may be ran multiple times so that it may update these
+pages when you make changes to your system and so you can replace it
+with a newer version of the script and generate a new set of these web
+pages.<br>
+</td>
+</tr>
+</tbody>
+</table>
+<br>
+<br>
+</body>
+</html>
+EOF
+
+#########################################################################################################
+#Creat navigate.html
+cat > $BASE/SysReport/navigate.html << EOF
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head><title>Sysytem Report Navigation</title>
+<meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1">
+<meta content="Ray Parrish" name="Author"></head>
+<body>
+<ul>
+ <li><a href="Introduction.html" target="Modules">Introduction to System Report</a> </li>
+ <li><a href="cpuinfo.html" target="Modules">CPU Information</a> </li>
+ <li><a href="drive.html" target="Modules">Drive Information</a> </li>
+ <li><a href="environment.html" target="Modules">Environment Variables</a> </li>
+ <li><a href="software.html" target="Modules">Installed Packages</a> </li>
+ <li><a href="logfiles.html" target="Modules">Log Files</a> </li>
+ <li><a href="memory.html" target="Modules">Memory</a> </li>
+ <li><a href="modules.html" target="Modules">Modules Loaded</a> </li>
+ <li><a href="network.html" target="Modules">Network</a> </li>
+ <li><a href="opsys.html" target="Modules">Operating Systems</a> </li>
+ <li><a href="PCIBus.html" target="Modules">PCI Bus</a> </li>
+ <li><a href="usb.html" target="Modules">USB Devices</a> </li>
+ <li><a href="varlogmsg.html" target="Modules">MESSAGES</a> </li>
+ <li><a href="dmesg.html" target="Modules">DMESG</a> </li>
+ <li><a href="syslog.html" target="Modules">SYSLOG</a> </li>
+ <li><a href="kernlog.html" target="Modules">KERN.LOG</a> </li>
+</ul>
+EOF
+
+#######################################################################################################
+# create cpuinfo.html
+cat > $BASE/SysReport/cpuinfo.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>CPU Information</title>
+</head>
+<bo
+dy>
+<p>CPU Information.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /proc/cpuinfo
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+cat /proc/cpuinfo >> $BASE/SysReport/cpuinfo.html
+cat >> $BASE/SysReport/cpuinfo.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<br>
+To get the out put of this command in terminal use the following form:
+<br>
+<br>cat /proc/cpuinfo
+<p>This will output the information to the terminal screen. You can't open the file cpuinfo in Gedit but the cat command gives you access to the contents of it. It is actually a place in memory, not an actual file on your hard drive and that is why you cannot open it in a text editor.
+</body>
+</html>
+EOF
+
+#############################################################################
+# create drive.html
+cat > $BASE/SysReport/drive.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Drive Information</title>
+</head>
+<body>
+<br>
+Drive Information.
+<br>
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /proc/diskstats
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+cat /proc/diskstats >> $BASE/SysReport/drive.html
+cat >> $BASE/SysReport/drive.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<br>
+To get the out put of this command in terminal use the following form:
+<br>
+<br>cat /proc/diskstats
+<p>This will output the information to the terminal screen. I'm not sure who this information might be useful to, it's greek to me.
+<p>The following output is generated with this command:
+<p>df -h >> $BASE/SysReport/drive.html
+<p> The -h switch makes it generate human readable output grouped in G, M, and K bytes 8-) You can get the out put in bytes only by using the -b switch instead of -h
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+df -h
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# generate the out put from system file
+df -h >> $BASE/SysReport/drive.html
+# try to prompt user to hit enter
+cat >> $BASE/SysReport/drive.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>There is another command you can use to get your partition information but this script cannot run it as it doesn't have super user permission. To have your partition information included in this document, run the following command in terminal, then re-run SystemReport.sh to have that information added in here.
+<p>sudo fdisk -l > $BASE/SysReport/fdisk.txt
+<p>You will be prompted for your password, type it in and hit enter. You won't see any characters echoed by terminal when you type your password, but just keep typing, it's getting them.
+<p>This will create a text file of the fdisk command output which when you re-run SystemReport.sh will be detected and added into this file. Don't forget to update fdisk.txt if you change your partitions around.
+EOF
+
+# If the user has ran the ""sudo fdisk -l > $BASE/SysReport/fdisk.txt" command, add the content
+# of fdisk.txt into drive.html
+if [ -e $BASE/SysReport/fdisk.txt ]
+ then
+ cat >> $BASE/SysReport/drive.html << EOF
+<P> I see you've created fdisk.txt so here is the information from it below.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+sudo fdisk - l
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+ cat $BASE/SysReport/fdisk.txt >> $BASE/SysReport/drive.html
+ cat >> $BASE/SysReport/drive.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Of course you can get your partition information at any time by opening a terminal window and running the following command. You will be prompted for your password, then the output will go to the terminal window.
+<p>sudo fdisk -l
+</body>
+</html>
+EOF
+fi
+# Create the PCIBus.html file with the lspci command
+# first write the top of the file to disk
+#echo "Creating PCIBus.html"
+cat > $BASE/SysReport/PCIBus.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>PCI Bus Information</title>
+</head>
+<body>
+<p> Hardware Listi.
+<p> PCI bus Information and the things connected to it.
+<p>lspci -t -vv
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+lspci -t -vv
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# generate the out put into the PCIBus.html file
+lspci -t -vv >> $BASE/SysReport/PCIBus.html
+# Now add the next section of the file
+cat >> $BASE/SysReport/PCIBus.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Bus centric Information about Hardware.
+<p>lspci -b -v
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+lspci -b -v
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+lspci -b -v >> $BASE/SysReport/PCIBus.html
+# now write then end of the file
+cat >> $BASE/SysReport/drive.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+
+</body>
+</html>
+EOF
+# generate a memory report file
+# first write the top of the file to disk
+#echo "Creating memory.html"
+cat > $BASE/SysReport/memory.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Memory Information</title>
+</head>
+<body>
+<p>free -m
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+free -m
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+free -m >> $BASE/SysReport/memory.html
+# now write the next part of the file
+cat >> $BASE/SysReport/memory.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Swappiness is a measure of how aggressively Ubuntu swaps memory out to the swap file or partition. This next command checks the value of swappiness.
+<p>cat /proc/sys/vm/swappiness
+<p>Swappiness can be set from 0 to 100 with 100 being the most aggressively paged out. A low number like 10 is recommended for desktops, while 60 is the default in Ubuntu. 60 is also recommended for servers.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /proc/sys/vm/swappiness
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+#
+# out put the next command to disk
+cat /proc/sys/vm/swappiness >> $BASE/SysReport/memory.html
+# now write the end of the file
+cat >> $BASE/SysReport/memory.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Here is the <A HREF="https://help.ubuntu.com/community/SwapFaq" Target="blank">Ubuntu Swap Partition FAQ</a> so you can get up to speed on swap files. Among other things it talks about, the article tells how to adjust swappiness.
+</body></html>
+EOF
+# generate a network report file
+# first write the top of the file to disk
+#echo "Creating network.html"
+cat > $BASE/SysReport/network.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Network Information</title>
+</head>
+<body>
+<p> Network Information.
+<p>ifconfig -a
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+ifconfig -a
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+ifconfig -a >> $BASE/SysReport/network.html
+# now write then end of the file
+cat >> $BASE/SysReport/network.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>This next command checks to see if you are connected to a network currently.
+<p>cat /sys/class/net/eth0/carrier
+<p>This location returns a 0 if you are not connected, and a 1 if you are connected to a network.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /sys/class/net/eth0/carrier
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+#
+# out put the next command to disk
+cat /sys/class/net/eth0/carrier >> $BASE/SysReport/network.html
+# now write the end of the file
+cat >> $BASE/SysReport/network.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+</body></html>
+EOF
+#
+# create the opsys.html file
+# write the head of the file
+#echo "Creating opsys.html"
+cat > $BASE/SysReport/opsys.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Operating System Information</title>
+</head>
+<body>
+<p>OS distro and version.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /etc/issue
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+cat /etc/issue >> $BASE/SysReport/opsys.html
+cat >> $BASE/SysReport/opsys.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Contents of your grub.cfg
+<p>cat /boot/grub/grub.cfg
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /boot/grub/grub.conf
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# test for existence of menu.lst file and do output accordingly
+if [ -e /boot/grub/grub.cfg ]
+ then cat /boot/grub/grub.cfg >> $BASE/SysReport/opsys.html
+else
+ echo "No menu.lst file found" >> $BASE/SysReport/opsys.html
+fi
+# now write the next part of the file
+cat >> $BASE/SysReport/opsys.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+
+<p>Linux kernel Version.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+uname -a
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+
+EOF
+uname -a >> $BASE/SysReport/opsys.html
+cat >> $BASE/SysReport/opsys.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>Bit more information about your version of OS.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+lsb_release -a
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+lsb_release -a 2> /dev/null >> $BASE/SysReport/opsys.html
+cat >> $BASE/SysReport/opsys.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+</body></html>
+EOF
+# create logfiles.html
+# module added 9/22/08 by C Ray Parrish
+#echo "Creating logfiles.html"
+cat > $BASE/SysReport/logfiles.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Log Files</title>
+</head>
+<body>
+<p>This file is the rsyslog.conf file which determines what messages from the system get sent to which log file. You can look up what log files are available for inspection in this file.
+<p>cat /etc/syslog.conf
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /etc/syslog.conf
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+cat /etc/rsyslog.conf >> $BASE/SysReport/logfiles.html
+# now write the next part of the file
+cat >> $BASE/SysReport/logfiles.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>The syslog.conf file can be edited with a text editor but may need to be started with gksu priveleges to write to file any changes you make. Use the following command -
+<p>gksu gedit /etc/syslog.conf
+<p>You will be prompted for your password when you run the above command.
+</body></html>
+EOF
+# create software.html
+# module added 9/22/08 by C Ray Parrish
+#echo "Creating software.html"
+cat > $BASE/SysReport/software.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Log Files</title>
+</head>
+<body>
+<p>Installed packages
+<p><a href=#versions>Jump down to Software Version Information</a>
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cd /usr/share/doc<br>
+ls -a --group-directories-first
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+#echo " inventory of /usr/share/doc"
+# out put the next command to disk
+# first change to the right folder
+cd /usr/share/doc
+# and put a list of it's folders into software.html
+ls -a --group-directories-first >> $BASE/SysReport/software.html
+# now write the next part of the file
+cat >> $BASE/SysReport/software.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<a name="versions"
+<p><a href="#updates">Jump to updateable packages</a>
+<p>There is another command which you can install on your system which will give you the current version of all installed software along with whether or not it is up to date. To install this package issue the following command in terminal -
+<p> sudo apt-get install apt-show-versions
+<p>You will be prompted for your password and then the package will be installed.
+<p>Now re-run the SystemReport.sh script to add the software version information into this document below.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+apt-show-versions
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+if [ -e "/usr/bin/apt-show-versions" ]; then
+ echo " generating version list"
+ touch $BASE/SysReport/versions.txt
+ chmod 777 $BASE/SysReport/versions.txt
+ apt-show-versions > $BASE/SysReport/versions.txt
+ echo " Sorting version list"
+ sort $BASE/SysReport/versions.txt >> $BASE/SysReport/software.html
+else
+ echo "apt-show-versions not found, follow directions above to get this output" >> $BASE/SysReport/software.html
+fi
+cat >> $BASE/SysReport/software.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<A NAME="updates">
+<p>In this next output section we are looking to see which packages on our system need updating.
+<p>To do this we add a -u switch to the command from the last section as you can see at the top of the table below.
+<p>If there is no out put in the following section, all software on your system is up to date.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+apt-show-versions -u
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# now we add the output of packages which need updating if any
+echo " generating list of updates"
+# first be sure they have the command installed
+if [ -e /usr/bin/apt-show-versions ]
+ # check to see if output of command is empty
+ then texttest=$(apt-show-versions -u 2> /dev/null)
+ if [ "$texttest" == "" ]
+ # if it's empty, all software is up to date
+ then echo "Your software is all up to date." >> $BASE/SysReport/software.html
+ # otherwise add list of packages which need updating
+ else apt-show-versions -u 2> /dev/null >> $BASE/SysReport/software.html
+ fi
+ # if they don't have the command installed tell them
+ else echo "you must install apt-show-versions to get this output" >> $BASE/SysReport/software.html
+fi
+cat >> $BASE/SysReport/software.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>This next section isn't the result of a command, it is merely a link to a file on your system which keeps a lot of information about installed software in it. It includes the version, what packages it depends on to operate, which packages they conflict with, and a description of the packages function.
+<p>Note that even if you are viewing the sample System Report online the following link is to a file on your system and is not part of the sample report.
+<p>You can open the following file with your text editor.
+<p>The reason I don't cat this file into the web page report is that on my system it is 1.4 megabytes large so it isn't practical to import it.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+/var/lib/dpkg/status
+</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);">
+<a href="file:///var/lib/dpkg/status">Software Information File</a>
+</td>
+</tr>
+</tbody>
+</table>
+</body></html>
+EOF
+# create environment.html
+# module added 9/22/08 by C Ray Parrish
+#echo "Creating environment.html"
+cat > $BASE/SysReport/environment.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Environment Variables</title>
+</head>
+<body>
+<p>Environment Variables
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+printenv</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+printenv >> $BASE/SysReport/environment.html
+# now write the next part of the file
+cat >> $BASE/SysReport/environment.html << EOF
+</pre>
+</td>
+</tr>
+</tbody>
+</table>
+<p>To learn more about environment variables and how to set them have a look at <a href="https://help.ubuntu.com/community/EnvironmentVariables" target="blank">Environment Variables - Ubuntu Community documentation</a>
+</body></html>
+EOF
+# create modules.html
+# module added 9/29/08 by C Ray Parrish
+#echo "Creating modules.html"
+cat > $BASE/SysReport/modules.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>Environment Variables</title>
+</head>
+<body>
+<p>Loaded Modules Information.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+lsmod</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+lsmod >> $BASE/SysReport/modules.html
+# now write the next part of the file
+cat >> $BASE/SysReport/modules.html << EOF
+</pre></td></tr></tbody></table></body></html>
+EOF
+
+#########################################################################
+# create usb.html
+cat > $BASE/SysReport/usb.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>USB Devices</title>
+</head>
+<body>
+<p>Lists of USB devices attached system.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+lsusb -v</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+lsusb -v 2>/dev/null >> $BASE/SysReport/usb.html
+# now write the next part of the file
+cat >> $BASE/SysReport/usb.html << EOF
+</pre></td></tr></tbody></table></body></html>
+EOF
+
+
+#######################################################
+# create varlogmsg.html
+cat > $BASE/SysReport/varlogmsg.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>VAR_LOG_MESSAGES</title>
+</head>
+<body>
+<p>Log messages list from /var/log/messages.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /var/log/messages</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+cat /var/log/messages 2>/dev/null >> $BASE/SysReport/varlogmsg.html
+# now write the next part of the file
+cat >> $BASE/SysReport/varlogmsg.html << EOF
+</pre></td></tr></tbody></table></body></html>
+EOF
+
+
+#######################################################
+# create dmesg.html
+cat > $BASE/SysReport/dmesg.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>DMESG</title>
+</head>
+<body>
+<p>Log messages list from /var/log/dmesg.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /var/log/dmesg </td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+cat /var/log/dmesg 2>/dev/null >> $BASE/SysReport/dmesg.html
+# now write the next part of the file
+cat >> $BASE/SysReport/dmesg.html << EOF
+</pre></td></tr></tbody></table></body></html>
+EOF
+
+
+#######################################################
+# create syslog.html
+cat > $BASE/SysReport/syslog.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>SYSLOG</title>
+</head>
+<body>
+<p>Log message list from /var/log/syslog.
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /var/log/syslog </td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+cat /var/log/syslog 2>/dev/null >> $BASE/SysReport/syslog.html
+# now write the next part of the file
+cat >> $BASE/SysReport/syslog.html << EOF
+</pre></td></tr></tbody></table></body></html>
+EOF
+
+#######################################################
+# create kernlog.html
+cat > $BASE/SysReport/kernlog.html << EOF
+<html>
+<head>
+<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
+<title>KERN.LOG</title>
+</head>
+<body>
+<p>Log message list from /var/log/kern.log
+<table style="text-align: left; width: 100%;" border="2" cellpadding="2"
+cellspacing="2">
+<tbody>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 153, 255);">
+cat /var/log/kern.log</td></tr>
+<tr>
+<td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
+EOF
+# out put the next command to disk
+cat /var/log/kern.log 2>/dev/null >> $BASE/SysReport/kernlog.html
+# now write the next part of the file
+cat >> $BASE/SysReport/kernlog.html << EOF
+</pre></td></tr></tbody></table></body></html>
+EOF
+
+cleanup
+}
+
+function Fedora {
+ startup
+ sysreport > $BASE/sysreport.log
+ cleanup
+ return $?
+}
+
+function distro_vector {
+ for OS in `cat /etc/issue` ; do echo -e "Operating system: " $OS `uname -r` ; break ; done
+ case $OS in
+ 'Fedora')
+ Fedora
+ return $?
+ ;;
+ 'Ubuntu')
+ Ubuntu
+ return $?
+ ;;
+ 'Red')
+ # same sysreport tool for redhat
+ Fedora
+ return $?
+ ;;
+ *)
+ echo "failure. unexpected distro found. Resolve dependencies manually."
+ ;;
+ esac
+}
+
+function main {
+ distro_vector
+ return $?
+}
+
+main
+exit $?
View
301 usr/sbin/zfs_manage.py
@@ -0,0 +1,301 @@
+#!/usr/bin/python
+import os
+import sys
+import md5
+import dbus
+import getopt
+import string
+import commands
+import dmidecode
+import gettext
+_ = gettext.gettext
+
+import xml.etree.cElementTree as ElementTree
+
+# test argument
+#args = '-u myasduser --user=masdyuser -p mypaadfss --password=mypaasdfss -k serasdasdialkey --key=serasdfialkey -s myservasdfer --server=masdfyserver --unregister --help'.split()
+
+ZFS_USER_CONFIG = '/etc/zfs/zfs_config'
+ZFS_SERIAL = '/etc/zfs/zfs_serial'
+
+class XmlDictConfig(dict):
+ def __init__(self, aDict):
+ bDict = {}
+ for element in aDict:
+ if element:
+ if len(element) == 1 or element[0].tag != element[1].tag:
+ bDict = {element.tag: XmlDictConfig(element)}
+ else:
+ bDict = {element[0].tag : XmlDictConfig(element)}
+ if element.items():
+ bDict.update(dict(element.items()))
+ elif element.items():
+ bDict.update({element.tag: dict(element.items())})
+ else:
+ bDict.update({element.tag: element.text})
+ self.update(bDict)
+
+
+class XmlParser():
+ def xmlToDict(self, parent_element):
+ aDict = {}
+ if parent_element.items():
+ aDict.update(dict(parent_element.items()))
+ for element in parent_element:
+ if element:
+ if len(element) == 1 or element[0].tag != element[1].tag:
+ bDict = XmlDictConfig(element)
+ else:
+ bDict = {element[0].tag: XmlDictConfig(element)}
+ if element.items():
+ bDict.update(dict(element.items()))
+ aDict.update({element.tag: bDict})
+ elif element.items():
+ aDict.update({element.tag: dict(element.items())})
+ else:
+ aDict.update({element.tag: element.text})
+ return aDict
+
+ def dictToXml(self, aDict):
+ elem = ElementTree.Element("context")
+ for key, value in aDict.items():
+ if isinstance(value, type(0)):
+ ElementTree.SubElement(elem, key, type="int").text = str(value)
+ elif isinstance(value, dict):
+ test = self.dictToString(ElementTree.Element(key), value)
+ ElementTree.SubElement(elem, key).text = test
+ else:
+ ElementTree.SubElement(elem, key).text = value
+ dictAsXML = ElementTree.tostring(elem)
+ dictAsXML = dictAsXML.replace("&lt;", "<")
+ dictAsXML = dictAsXML.replace("&gt;",">")
+ return dictAsXML
+
+ def dictToString(self, elem, aDict):
+ aList=[]
+ for key, value in aDict.items():
+ if isinstance(value, type(0)):
+ ElementTree.SubElement(elem, key, type="int").text = str(value)
+ elif isinstance(value, dict):
+ print "Element is a dict"
+ ElementTree.SubElement(elem, key).text = self.dictToString(key, value)
+ else:
+ ElementTree.SubElement(elem, key).text = value
+ aList.append("<" + key + ">" + value + "</" + key + ">")
+ return ''.join(aList)
+
+# this does not change, we can cache it
+_dmi_data = None
+_dmi_not_available = 0
+
+def dmi_warnings():
+ if not hasattr(dmidecode, 'get_warnings'):
+ return None
+
+ return dmidecode.get_warnings()
+
+def _initialize_dmi_data():
+ """ Initialize _dmi_data unless it already exist and returns it """
+ global _dmi_data, _dmi_not_available
+ if _dmi_data is None:
+ if _dmi_not_available:
+ # do not try to initialize it again and again if not available
+ return None
+ else :
+ dmixml = dmidecode.dmidecodeXML()
+ dmixml.SetResultType(dmidecode.DMIXML_DOC)
+ # Get all the DMI data and prepare a XPath context
+ try:
+ data = dmixml.QuerySection('all')
+ dmi_warn = dmi_warnings()
+ if dmi_warn:
+ dmidecode.clear_warnings()
+ log = up2dateLog.initLog()
+ log.log_debug("dmidecode warnings: " % dmi_warn)
+ except:
+ # DMI decode FAIL, this can happend e.g in PV guest
+ _dmi_not_available = 1
+ dmi_warn = dmi_warnings()
+ if dmi_warn:
+ dmidecode.clear_warnings()
+ return None
+ _dmi_data = data.xpathNewContext();
+ return _dmi_data
+
+def get_dmi_data(path):
+ """ Fetch DMI data from given section using given path.
+ If data could not be retrieved, returns empty string.
+ General method and should not be used outside of this module.
+ """
+ dmi_data = _initialize_dmi_data()
+ if dmi_data is None:
+ return ''
+ data = dmi_data.xpathEval(path)
+ if data != []:
+ return data[0].content
+ else:
+ # The path do not exist
+ return ''
+
+def dmi_system_uuid():
+ """ Return UUID from dmidecode system information.
+ If this value could not be fetch, returns empty string.
+ """
+ # if guest was created manualy it can have empty UUID, in this
+ # case dmidecode set attribute unavailable to 1
+ uuid = get_dmi_data("/dmidecode/SystemInfo/SystemUUID[not(@unavailable='2')]")
+ if not uuid:
+ uuid = ''
+ return uuid
+
+
+def get_smbios():
+ """ Returns dictionary with values we are interested for.
+ For historical reason it is in format, which use HAL.
+ Currently in dictionary are keys:
+ smbios.system.uuid, smbios.bios.vendor, smbios.system.serial,
+ smbios.system.manufacturer.
+ """
+ _initialize_dmi_data()
+ if _dmi_not_available:
+ return {}
+ else:
+ return {
+ 'smbios.system.uuid': dmi_system_uuid(),
+ 'smbios.bios.vendor': get_dmi_data('/dmidecode/BIOSinfo/Vendor'),
+ 'smbios.system.serial': get_dmi_data('/dmidecode/SystemInfo/SerialNumber'),
+ 'smbios.system.manufacturer': get_dmi_data('/dmidecode/BaseBoardInfo/Manufacturer'),
+ 'smbios.system.product': get_dmi_data('/dmidecode/SystemInfo/ProductName'),
+ }
+
+
+
+def main():
+ index = -1
+ try :
+ index = sys.argv.index("--help")
+ except:
+ print
+ if index != -1:
+ print "Usage is: "
+ print sys.argv[0] + ' -u <username> --user=<username> -p <password> --password=<oassword> -k <serialkey> --key=<serialkey> -s <server> --server=<server> -o <operation> --operation=<operation> --help --dumpxml'
+ print "<operation> => register , unregister, support (default is register)"
+ sys.exit(0)
+
+ zfs_config = {"user":"",
+ "password":"",
+ "key":"",
+ "server":"",
+ "operation":"register",
+ "help":"",
+ "dumpxml":""}
+ opt_zfs_config = {"-u":"user","--user":"user",
+ "-p":"password", "--password":"password",
+ "-k":"key", "--key":"key",
+ "-s":"server","--server":"server",
+ "-o":"operation","--operation":"operation",
+ "--help":"help",
+ "--dumpxml":"dumpxml"}
+
+ # get default configurations
+ sdata=""
+ try:
+ fd = open(ZFS_USER_CONFIG)
+ sdata=fd.read().split()
+ if sdata!="":
+ for i in sdata:
+ try:
+ splitData = i.split('=')
+ zfs_config[splitData[0]] = splitData[1]
+ except:
+ print "No such confituration Data : " + str(splitData)
+ except:
+ print "No configuration file availabel"
+
+ optlist, args = getopt.gnu_getopt(sys.argv, 'du:p:k:s:o:n:',["user=", "password=", "key=", "server=", "operation=","unregister", "help","dumpxml"])
+ for ele in optlist:
+ zfs_config[opt_zfs_config[ele[0]]] = ele[1]
+ # set md5 checksum of password as password
+ zfs_config['password'] = md5.md5(zfs_config['password']).hexdigest()
+
+ import SOAPpy
+ ns = 'http://tempuri.org/KQInfotech'
+ #rl = 'http://test.aksharbharati.org/UserMachineDetailsService.asmx'
+ url = 'http://192.168.1.175/ZFS.KQInfotech.WebService/UserMachineDetailsService.asmx'
+ server = SOAPpy.SOAPProxy( url, namespace=ns )
+ server.config.buildWithNamespacePrefix = 0
+
+ # remove unnecessary option from zfs_config
+ zfs_config.pop('dumpxml')
+ zfs_config.pop('help')
+ zfs_config.pop('server')
+ zfs_config["machine"] = get_smbios()
+
+ if zfs_config['operation'] == 'support' :
+ try:
+ fd = open(ZFS_SERIAL)
+ zfs_config['key'] = fd.read()
+ fd.close()
+ # generate xml for zfs user registration info
+ xmldata= XmlParser().dictToXml(zfs_config)
+ fd = open("dumpInfo.xml","w")
+ fd.write(xmldata)
+ fd.close()
+ ret = commands.getstatusoutput("./SystemReport.sh")
+ if ret[0] != 0 :
+ print "sysreport generation failed"
+ print "please send email to 'support@kqinfotech.com' with subject 'support' and attachment files 'dumpInfo.xml' and 'SysReport.tar.gz'"
+ return
+ except:
+ print "No serial available"
+ sys.exit(-1)
+
+ if zfs_config['operation'] == 'unregister' :
+ try:
+ fd = open(ZFS_SERIAL)
+ zfs_config['key'] = fd.read()
+ fd.close()
+ # generate xml for zfs user registration info
+ xmldata= XmlParser().dictToXml(zfs_config)
+ fd = open("dumpInfo.xml","w")
+ fd.write(xmldata)
+ fd.close()
+ print "please send email to 'support@kqinfotech.com' with subject 'unregister' and attachment file 'dumpInfo.xml' "
+ return
+ except:
+ print "No serial available(unregister)"
+ sys.exit(-1)
+
+
+ xmldata= XmlParser().dictToXml(zfs_config)
+ index = -1
+ try :
+ index = sys.argv.index("--dumpxml")
+ except:
+ print
+ if index != -1 :
+ try:
+ fd = open("dumpInfo.xml","w")
+ fd.write(xmldata)
+ print 'xml data available ata dumpInfo.xml'
+ fd.close()
+ except:
+ print 'can`t open dumpInfo.xml for writing'
+ print server._sa( '%s/SendMachineDetails' %ns ).SendMachineDetails( inputxmlfile=xmldata )
+
+ try:
+ fd = open(ZFS_SERIAL,"w")
+ fd.write(zfs_config['key'])
+ fd.close()
+ except:
+ print "can't open serial file"
+ return -1
+ sys.exit(0)
+
+
+
+
+if __name__ == '__main__':
+
+ main()
+ sys.exit(0)
Please sign in to comment.
Something went wrong with that request. Please try again.