pax_global_header 0000666 0000000 0000000 00000000064 13140374466 0014522 g ustar 00root root 0000000 0000000 52 comment=19e74e0a677122c2ec1385809ab8ac8b5a27e74d
UVP-Tools-2.2.0.316/ 0000775 0000000 0000000 00000000000 13140374466 0013603 5 ustar 00root root 0000000 0000000 UVP-Tools-2.2.0.316/.gitignore 0000664 0000000 0000000 00000000366 13140374466 0015600 0 ustar 00root root 0000000 0000000 # Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
UVP-Tools-2.2.0.316/LICENSE 0000664 0000000 0000000 00000043176 13140374466 0014623 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
UVP-Tools-2.2.0.316/Makefile 0000664 0000000 0000000 00000000157 13140374466 0015246 0 ustar 00root root 0000000 0000000 $(shell dos2unix build_tools)
$(shell chmod u+x build_tools)
all:
@./build_tools -b
clean:
@./build_tools -c
UVP-Tools-2.2.0.316/README.md 0000664 0000000 0000000 00000020751 13140374466 0015067 0 ustar 00root root 0000000 0000000 UVP Tools 2.2.0.xxx
The following is the readme file of UVP Tools 2.2.0. From the readme file, you will learn what a UVP Tools project is, how source code of UVP Tools is structured, and how UVP Tools is installed.
What Is a UVP Tools Project?
UVP Tools is a tool that integrates the Xen front-end driver and uvp-monitor (virtual machine monitoring program). It is designed for use on virtual machines (VMs) equipped with a 32-bit x86-based CPU (386 or higher) or x86_64 CPU.
The Xen front-end driver improves I/O processing efficiency of VMs. The uvp-monitor helps administrators gain visibility into VM running status.
Components of the Xen front-end driver:
- xen-platform-pci driver: Xen front-end pci driver, which provides xenbus access, establishes event channels, and grants references.
- xen-balloon driver: Xen front-end balloon driver, which adjusts VM memory through the host.
- xen-vbd/xen-blkfront driver: Xen front-end disk driver.
- xen-vnif/xen-netfront driver: Xen front-end NIC driver.
- xen-scsi/xen-scsifront driver: Xen front-end PV SCSI driver.
- xen-procfs driver: provides the xenbus driver and adapts to the VMs that use pvops kernel but does not provide /proc/xen/xenbus or /dev/xen/xenbus interfaces.
- vni driver: virtio driver.
Features of uvp-monitor:
- Collects information about resource usage of every VM and periodically writes the information into domain0 through xenstore. The resource usage information includes the total number of CPUs. CPU usage, memory capacity, memory usage, disk capacity, disk usage, and the number of packets received or sent by a NIC.
- Collects VM hostnames and writes them into domain0 through xenstore.
- Notifies domain0 whether the current VM supports hot-plug of memory, CPUs, and disks.
- Facilitates live migration of Xen VMs and triggers VMs to send gARP and ndp packets to the network at completion of live migration.
- Facilitates self-upgrade of UVP Tools on VMs. The uvp-monitor works with xenstore to notify domain0 of the UVP Tools version installed on VMs. If the UVP Tools version on a VM is different from the UVP Tools version on the host, the UVP Tools on the VM is then automatically upgraded to the version installed on the host.
Structure of UVP Tools source code:
UVP-Tools-2.2.0.xxx
|-- bin/ # Directory that stores tools required for installing and using UVP Tools, such as the tool used for acquiring Linux distribution information and the disk hot-plug tool.
|-- build_tools # Scripts used for building the UVP Tools package.
|-- config/ # Directory that stores UDEV rules used by UVP Tools.
|-- cpfile.sh # Tool for copying components of the UVP Tools compatible with the current Linux distribution during self-upgrade of UVP Tools.
|-- install # Scripts for installing, uninstalling, and upgrading the UVP Tools package.
|-- Makefile # File that define rules for building the UVP Tools package.
|-- README # Readme file of UVP Tools.
|-- upg.sh # Script for self-upgrading UVP Tools on a VM to the UVP Tools version installed on the host.
|-- uvp-monitor/ # Source code of uvp-monitor.
|-- uvp-xenpv/ # Source code of the Xen front-end driver.
| |-- uvp-classic_xen_driver-2.6.32to3.0.x/ # Source code of the classic Xen front-end driver, which works well with SLES 11 SP.
| |-- uvp-classic_xen_driver-3.12.xto3.16.x/ # Source code of the classic Xen front-end driver, which works well with SLES 12 SP and openSUSE 13.2.
| |-- uvp-pvops_xen_driver-2.6.32to4.0.x/ # Source code of the pvops front-end driver, which works well with CentOS/RHEL 6.x, Debian 8, and Fedora 22.
| |-- others/ # Source code of the classic Xen front-end driver, which works well with CentOS/RHEL 4.x/5.x, Fedora 9/12, SLES 10 SP, and Ubuntu 8/12.
|-- version.ini # Version information of UVP Tools source code.
Installing UVP Tools
- Obtain the UVP Tools source code package. Save the UVP Tools source code package to a directory on the Linux VM where UVP Tools will be installed, and unpack the UVP Tools source code package. Be sure that you have the permission to access this directory.
- If the downloaded UVP Tools source code package is an official release, run the following command:
tar -xzf UVP-Tools-2.2.0.xxx.tar.gz
Or
gunzip UVP-Tools-2.2.0.xxx.zip
- If the downloaded UVP Tools source code package is a source code package of the master branch, run the following command:
gunzip UVP-Tools-master.zip
The Linux VM where UVP Tools will be installed must come with gcc, make, libc, and kernel-devel. For simplicity purposes, the Linux VM where UVP Tools will be installed is referred to as the Linux VM.
- Go to the uvp-monitor directory. Run the following command to build uvp-monitor:
make
Note:
(1). When uvp-monitor is being built, the make tool automatically downloads the xen-4.1.2.tar.gz source code package from the Internet. If the download fails, uvp-monitor cannot be successfully built. If the Linux VM cannot access the Internet, manually obtain the xen-4.1.2.tar.gz source code package, and save it to the uvp-monitor directory.
(2). The uvp-monitor program used to statically build the libxenstore is provided along with the UVP Tools. Using such a uvp-monitor program can avoid the uvp-monitor failure due to defects in the default libxenstore.so shared library file of the Linux-based VM. For example, the default libxenstore.so file of the CoreOS 1010.5.0-based VM is defective and its directory /usr cannot be modified. To address this problem, install the uvp-monitor program that is used to statically build the libxenstore.
To install the uvp-monitor that is used to dynamically build the libxenstore, run the following command:
make install
To install the uvp-monitor that is used to statically build the libxenstore, run the following command:
make install_static
Note: If you need to build the uvp-monitor in a cross-compilation environment, put the source code of the uvp-monitor in the cross-compilation environment, and then install the built uvp-monitor on the target VM.
- Build the Xen front-end driver. Take SLES 11 SP3 x86_64 as an example.
- Go to the uvp-xenpv/uvp-classic_xen_driver-2.6.32to3.0.x directory.
- Run the following command to build the Xen front-end driver:
make KERNDIR="/lib/modules/$(uname -r)/build" BUILDKERNEL=$(uname -r)
After the Xen front-end driver is successfully built, run the following command to install the Xen front-end driver:
make KERNDIR="/lib/modules/$(uname -r)/build" BUILDKERNEL=$(uname -r) modules_install
Note: This operation may replace the Xen front-end driver provided by the OS vendor with the one provided by UVP Tools.
If the Xen front-end driver used by the Linux VM is not provided by UVP Tools, uninstall it. Take the SLES 11 SP3 x86_64 as an example.
- Run the following command to check whether the Linux VM is armed with the Xen front-end driver provided by the OS vendor.
rpm -qa | grep xen-kmp
- If a command output is returned, the Linux VM is armed with the Xen front-end driver provided by the OS vendor. Then, run the following command to uninstall the Xen front-end driver:
rpm -e xen-kmp-default-4.2.2_04_3.0.76_0.11-0.7.5
Note: "xen-kmp-default-4.2.2_04_3.0.76_0.11-0.7.5" is merely an example. Replace it with the Xen front-end driver installed on the Linux VM.
Alternatively, you can use the build_tools script to build a UVP Tools installation package for the Linux VM. Take SLES 11 SP3 x86_64 as an example.
- After the UVP Tools source code package is unpacked, run the following command in the UVP-Tools-2.2.0.xxx directory to build the UVP Tools installation package:
make all
A directory named uvp-tools-linux-2.2.0.xxx is generated in the current directory after the make all command is run. Go to the uvp-tools-linux-2.2.0.xxx directory and run the following command to execute the UVP Tools installation script install.
./install
Note: If you want to know what the install script has done, run the sh -x install command to print script execution information, or read through the script.
What can you do if a problem is encountered?
1. Briefly describe your problem. An one-line summary is recommended.
2. Describe your problem in detail, including environments, log information, and automatic handling of the problem.
3. Send the mail to uvptools@huawei.com for further assistance.
UVP-Tools-2.2.0.316/bin/ 0000775 0000000 0000000 00000000000 13140374466 0014353 5 ustar 00root root 0000000 0000000 UVP-Tools-2.2.0.316/bin/CheckKernelUpdate.sh 0000664 0000000 0000000 00000023023 13140374466 0020230 0 ustar 00root root 0000000 0000000 #!/bin/bash
###############################################################################
### error definition
###############################################################################
ERR_OK=0
ERR_NG=1
ERR_FILE_NOEXIST=20
Info='eval 2>&1 logger "[CheckKernelUpdate:$FUNCNAME:$LINENO]"'
grub_config()
{
### grub config
if [ -f '/boot/grub/grub.conf' ]
then
MENULIST=$(readlink -f "/boot/grub/grub.conf")
elif [ -f '/boot/grub/menu.lst' ]
then
MENULIST=$(readlink -f '/boot/grub/menu.lst')
elif [ -f '/boot/grub/grub.cfg' ]
then
MENULIST=$(readlink -f '/boot/grub/grub.cfg')
SYS="debian"
elif [ -f '/boot/burg/burg.cfg' ]
then
MENULIST=$(readlink -f '/boot/burg/burg.cfg')
SYS="debian"
elif [ -f '/boot/grub2/grub.cfg' ]
then
MENULIST=$(readlink -f '/boot/grub2/grub.cfg')
GRUBENV=$(readlink -f '/boot/grub2/grubenv')
SYS="grub2"
elif [ -f '/boot/efi/EFI/redhat/grub.conf' ]
then
MENULIST=$(readlink -f '/boot/efi/EFI/redhat/grub.conf')
elif [ -f '/etc/elilo.conf' ]
then
SYS="elilo"
MENULIST=$(readlink -f '/etc/elilo.conf')
fi
}
info_boot_entry()
{
local menu_lst=$1
entry_num=$2
local var_list="menu_default menu_start begin_line end_line title_line initrd_line"
local comment="init"
### set default parameter
if [ ! -f "$menu_lst" ]
then
$Info "can not find $menu_lst."
return $ERR_FILE_NOEXIST
fi
menu_default=$(sed -n '/\b\s*default\s*=\{0,1\}"\{0,1\}\s*[0-9]"\{0,1\}\+\s*$/=' $menu_lst | sed -n '$p')
if [ -z "$entry_num" ]
then
if [ -n "$menu_default" ]
then
if [ -z "$SYS" ]
then
entry_num=$(($(sed -n "${menu_default}p" $menu_lst | sed "s/^\s*default\s*=\{0,1\}\s*\([0-9]\+\)\s*$/\1/g")+1))
else
entry_num=$(($(sed -n "${menu_default}p" $menu_lst | sed "s/\b\s*set\s*default\s*=\{0,1\}\s*\"\{0,1\}\([0-9]\+\)\"\{0,1\}\s*$/\1/g")+1))
fi
else
$Info "can not find default boot entry in $menu_lst."
return $ERR_NG
fi
$Info "entry_num is $entry_num."
elif [ $entry_num -le 0 ]
then
return 1
fi
### initialize all variables
for var in $var_list
do
unset $var
done
if [ -z "$SYS" ]
then
menu_start=$(sed -n '/^\s*title\s\+/=' "${menu_lst}" | sed -n '1p')
else
menu_start=$(sed -n '/^\s*menuentry\s\+/=' "${menu_lst}" | sed -n '1p')
fi
if [ -z "$menu_start" ]
then
menu_start=$(sed -n '$=' $menu_lst)
return 0
fi
## process grub entry top
# get [title_line] of grub entry
if [ -z "$SYS" ]
then
title_line=$(grep -n "^[[:space:]]*title[[:space:]]\+" $menu_lst | sed -n "${entry_num}p" | awk -F ":" '{print $1}')
else
title_line=$(grep -n "^[[:space:]]*menuentry[[:space:]]\+" $menu_lst | sed -n "${entry_num}p" | awk -F ":" '{print $1}')
fi
if [ -z "$title_line" ]
then
$Info "can not find boot entry ${entry_num} in $menu_lst."
return $ERR_NG
fi
# get [begin_line] of grub entry
comment=$(sed -n "$(($title_line-1))p" $menu_lst | grep "^[[:space:]]*###.*YaST.*identifier:.*linux[[:space:]]*###[[:space:]]*$")
if [ -n "$comment" ] # include grub comment above
then
begin_line=$((title_line-1))
else
begin_line=$title_line
fi
## process grub entry bottom
# get [end_line] of grub entry
if [ -z "$SYS" ]
then
end_line=$(grep -n "^[[:space:]]*title[[:space:]]\+" $menu_lst | sed -n "$(($entry_num+1))p" | awk -F ":" '{print $1}')
else
end_line=$(grep -n "^[[:space:]]*menuentry[[:space:]]\+" $menu_lst | sed -n "$(($entry_num+1))p" | awk -F ":" '{print $1}')
fi
[ -z "$end_line" ] && end_line=$(sed -n '$=' "$menu_lst")
while [ -n "$(sed -n ${end_line}s/\(^\s*#.*\)/\1/p $menu_lst)" ] # omit grub comment below
do
end_line=$((end_line-1))
done
$Info "begin_line is $begin_line end_line is $end_line."
## get other line of grub entry
for ((line_num=$begin_line; line_num<=$end_line; line_num++))
do
line=$(sed -n "${line_num}p" $menu_lst)
if [ -n "$(echo -n "$line" | grep "^[[:space:]]*initrd[[:space:]]\+")" ] ; then initrd_line=$line_num ; fi
done
### return susess
return $ERR_OK
}
info_boot_entry_uefi()
{
local menu_lst=$1
entry_num=$2
local comment="init"
local var_list="menu_default menu_start begin_line end_line root_line kernel_line initrd_line"
### set default parameter
if [ ! -f "$menu_lst" ]
then
$Info "can not find $menu_lst."
return $ERR_FILE_NOEXIST
fi
menu_default=$(sed -n '/^\s*default\s*=\{0,1\}\s*\+\S\+\s*$/=' $menu_lst | sed -n '$p')
if [ -n "$menu_default" ]
then
entry_num=$(sed -n "${menu_default}p" $menu_lst | sed "s/^\s*default\s*=\{0,1\}\s*\(\S\+\)\s*$/\1/g")
else
$Info "can not find default boot entry in $menu_lst."
return $ERR_NG
fi
### initialize all variables
for var in $var_list
do
unset $var
done
menu_start=$(sed -n '/^\s*label\s\+/=' "${menu_lst}" | sed -n '1p')
if [ -z "$menu_start" ]
then
menu_start=$(sed -n '$=' $menu_lst)
return 0
fi
label_line=$(grep -n "^[[:space:]]*label[[:space:]]\+" $menu_lst | awk -F ":" '{print $1}')
for line in $label_line
do
if [ -n "$begin_line" ]
then
end_line=$line
break
fi
lable_val=$(sed -n "${line}p" $menu_lst | sed "s/^\s*label\s*=\{0,1\}\s*\(\S\+\)\s*$/\1/g")
if [ "$lable_val" = "$entry_num" ]
then
begin_line=$line
fi
done
while [ -z "$(sed -n ${begin_line}s/\^[[:space:]]*$/\1/p $menu_lst)" ]
do
begin_line=$((begin_line-1))
done
if [ -z "$end_line" ]
then
end_line=$(sed -n '$=' "$menu_lst")
else
while [ -z "$(sed -n ${end_line}s/\^[[:space:]]*$/\1/p $menu_lst)" ]
do
end_line=$((end_line-1))
done
fi
## get other line of grub entry
for ((line_num=$begin_line; line_num<=$end_line; line_num++))
do
line=$(sed -n "${line_num}p" $menu_lst)
if [ -n "$(echo -n "$line" | grep "^[[:space:]]*initrd[[:space:]]\+")" ] ; then initrd_line=$line_num ; fi
done
return 0
}
info_boot_entry_grub2()
{
local menu_lst=$1
local grubenv=$2
local var_list="default_entry end_line label_line lable_val tmpline initrd_line"
if [ ! -f "$menu_lst" ]
then
$Info "can not find $menu_lst."
return $ERR_FILE_NOEXIST
fi
if [ ! -f "$grubenv" ]
then
$Info "can not find $grubenv."
return $ERR_FILE_NOEXIST
fi
### initialize all variables
for var in $var_list
do
unset $var
done
### set default parameter
default_entry=$(sed -n '/saved_entry/p' $grubenv | sed -n 's/saved_entry=//gp')
if [ -z "$default_entry" ]
then
$Info "can not find default boot entry in $grubenv."
return $ERR_NG
fi
end_line=$(sed -n '$=' "$menu_lst")
label_line=$(grep -n "^[[:space:]]*menuentry[[:space:]]\+" $menu_lst | awk -F ":" '{print $1}')
for line in $label_line
do
lable_val=$(sed -n "${line}p" $menu_lst | sed -n '/^menuentry.*$/p' | sed -n "s/'/\n/gp" | sed -n 2p)
if [ "${default_entry}" = "${lable_val}" ]
then
for ((line_num=$line; line_num<=$end_line; line_num++))
do
tmpline=$(sed -n "${line_num}p" $menu_lst)
if [ -n "$(echo -n "$tmpline" | grep "^[[:space:]]*initrd[[:space:]]\+")" ] ; then initrd_line=$line_num ; return 0; fi
done
fi
done
return 0
}
boot_match()
{
if [ -e '/etc/gentoo-release' ]
then
return $ERR_OK
fi
grub_config
if [ "$SYS" = "grub2" ] && [ -f /etc/redhat-release ]
then
if [ ! -f "$GRUBENV" ]
then
$Info "can not find $GRUBENV."
return $ERR_FILE_NOEXIST
fi
match=$(cat /boot/grub2/grubenv | grep -w `uname -r`)
if [ -z "$match" ]
then
if [ -f /etc/euleros-release ] && [ "`cat /etc/euleros-release`" == "EulerOS V2.0" ]
then
return $ERR_OK
fi
$Info "the kernel is $kernel,do not match."
return $ERR_NG
fi
return $ERR_OK
fi
if [ "$SYS" = "elilo" ]
then
info_boot_entry_uefi "$MENULIST" ""
elif [ "$SYS" = "grub2" ]
then
# not support openSUSE 13.2
if [ $(echo -n ${kernel} |grep "3.16.6-2") ]
then
return $ERR_OK
fi
info_boot_entry_grub2 "$MENULIST" "$GRUBENV"
else
info_boot_entry "$MENULIST" ""
fi
if [ -z "$initrd_line" ]
then
$Info "initrd_line is null."
return $ERR_NG
fi
$Info "initrd_line is $initrd_line."
line=$(sed -n "${initrd_line}p" $MENULIST)
$Info "line is $line."
match=$(echo -n "$line" | grep "$kernel")
if [ -z "$match" ]
then
$Info "the kernel is $kernel,do not match $line."
return $ERR_NG
fi
return $ERR_OK
}
lib_match()
{
if [ ! -d "/lib/modules/`uname -r`" ]
then
$Info "can not find the kernel directory."
return $ERR_NG
fi
return $ERR_OK
}
main()
{
kernel=$(uname -r)
if ( lib_match && boot_match )
then
return $ERR_OK
else
return $ERR_NG
fi
}
main
UVP-Tools-2.2.0.316/bin/GuestOSFeature 0000664 0000000 0000000 00000014630 13140374466 0017147 0 ustar 00root root 0000000 0000000 #####################################################################
#first column is GuestOS type name,
#second column is the GuestOS support feature bitmap.
#
#current feature bitmap:
#memory hotplug 1
#online detach-disk 2
#vcpu hotplug 4
#####################################################################
#GuestOS Feature
#suse
suse10_sp1_x86 0
suse10_sp1_x86_64 0
suse10_sp2_x86 0
suse10_sp2_x86_64 0
suse10_sp3_x86 0
suse10_sp3_x86_64 0
suse10_sp4_x86 0
suse10_sp4_x86_64 0
suse11_sp0_x86 6
suse11_sp0_x86_64 7
suse11_sp1_x86 6
suse11_sp1_x86_64 7
suse11_sp2_x86 2
suse11_sp2_x86_64 7
suse11_sp3_x86 2
suse11_sp3_x86_64 2
opensuse_11.3_x86_64 0
opensuse_13.2_x86_64 0
suse10_sp2_customized_x86 0
suse10_sp3_customized_x86_64 0
suse10_sp4_customized_x86_64 0
suse11_sp1_customized_v1_x86_64 0
suse11_sp1_customized_v2_x86_64 0
suse11_sp1_customized_v3_x86_64 0
suse11_sp2_customized_v1_x86_64 0
suse11_sp2_customized_v2_x86_64 0
suse11_sp2_customized_v3_x86_64 0
suse11_sp2_customized_v4_x86_64 0
suse12_x86_64 0
#fedora
fedora6_x86 0
fedora6_x86_64 0
fedora8_x86 0
fedora8_x86_64 0
fedora9_x86 0
fedora12_x86 4
fedora14_x86_64 0
fedora22_x86_64 0
fedora23_x86_64 0
#oracle
oracle5.7_x86_64 1
oracle5.8_x86 0
oracle5.8_x86_64 0
oracle6.1_x86 0
oracle6.1_x86_64 0
oracle6.2_x86 0
oracle6.2_x86_64 0
oracle6.3_x86 0
oracle6.3_x86_64 0
oracle6.4_x86 0
oracle6.4_x86_64 0
oracle6.5_x86 0
oracle6.5_x86_64 0
#redhat && centos
redhat4.2_x86_64 0
redhat4.4_x86 0
redhat4.4_x86_64 0
redhat4.5_x86 0
redhat4.5_x86_64 0
redhat4.6_x86 0
redhat4.6_x86_64 0
redhat4.7_x86 0
redhat4.7_x86_64 0
redhat4.8_x86 0
redhat4.8_x86_64 0
redhat5.0_x86 2
redhat5.0_x86_64 2
redhat5.1_x86 2
redhat5.1_x86_64 2
redhat5.2_x86 2
redhat5.2_x86_64 2
redhat5.3_x86 2
redhat5.3_x86_64 3
redhat5.4_x86 2
redhat5.4_x86_64 3
redhat5.5_x86 2
redhat5.5_x86_64 7
redhat5.6_x86 2
redhat5.6_x86_64 7
redhat5.7_x86 2
redhat5.7_x86_64 3
redhat5.8_x86 2
redhat5.8_x86_64 3
redhat5.9_x86 2
redhat5.9_x86_64 2
redhat6.0_x86 2
redhat6.0_x86_64 7
redhat6.1_x86 2
redhat6.1_x86_64 7
redhat6.2_x86 2
redhat6.2_x86_64 7
redhat6.3_x86 2
redhat6.3_x86_64 7
redhat6.4_x86 2
redhat6.4_x86_64 7
redhat6.5_x86 2
redhat6.5_x86_64 7
redhat7.0_x86_64 0
kylin3.0_x86_64 0
#centos
centos5.5_x86_64 3
centos5.6_x86_64 7
centos5.9_x86 2
centos5.9_x86_64 2
centos6.0_x86_64 3
centos6.1_x86_64 3
centos6.2_x86_64 7
centos6.3_x86_64 7
centos6.4_x86_64 3
centos6.5_x86_64 3
#debian
debian5.0.10_x86_64 0
debian6_x86 0
debian6_x86_64 0
debian7_x86 0
debian7_x86_64 0
debian8_x86_64 0
#ubuntu
ubuntu8.04_x86_64 4
ubuntu8.04.4_x86_64 0
ubuntu9.10_x86 0
ubuntu9.10_x86_64 0
ubuntu10.04_server_x86_64 0
ubuntu10.04_desktop_x86_64 4
ubuntu10.04.1_x86 0
ubuntu10.04.1_x86_64 0
ubuntu10.04.2_x86_64 0
ubuntu10.04.3_x86_64 0
ubuntu10.04.4_x86_64 0
ubuntu10.10_x86_64 0
ubuntu11.04_x86 0
ubuntu11.04_x86_64 0
ubuntu11.10_x86 0
ubuntu11.10_x86_64 0
ubuntu12.04_x86_64 0
ubuntu12.04.1_x86_64 0
ubuntu12.04.2_x86 0
ubuntu12.04.2_x86_64 0
ubuntu12.04.3_x86 0
ubuntu12.04.3_x86_64 0
ubuntu12.04.4_x86 0
ubuntu12.04.4_x86_64 0
ubuntu12.10_x86 0
ubuntu12.10_x86_64 0
ubuntu13.04_x86 0
ubuntu13.04_x86_64 0
ubuntu13.10_x86 0
ubuntu13.10_x86_64 0
ubuntu14.04_x86 0
ubuntu14.04_x86_64 0
ubuntu14.04.1_x86 0
ubuntu14.04.1_x86_64 0
ubuntu10.04.2_customized_x86_64 0
ubuntu14.04.3_x86_64 0
#euleros
euleros2.1_x86_64 0
gentoo_customized_x86 0
default_x86 0
default_x86_64 0
#end
UVP-Tools-2.2.0.316/bin/get_uvp_kernel_modules 0000664 0000000 0000000 00000041342 13140374466 0021043 0 ustar 00root root 0000000 0000000 #!/bin/bash
SYS_TYPE=$1
KERN_RELEASE=$2
CPU_ARCH=$3
MACHINE_TYPE=$4
MODULES_PATH=`pwd`/lib/modules/xvf-
GUEST_INFO="default"
if [ -f "/etc/SuSE-release" ] && [ ! -f "/etc/EulerLinux.conf" ]
then
os_version=$(cat /etc/SuSE-release | awk -F" " 'NR==2 {print $3}')
os_patchlevel=$(cat /etc/SuSE-release | awk -F" " 'NR==3 {print $3}')
ker_rel_sysinfo=$(uname -r | awk -F"-" '{print $3}')
OS_DIST_SVER="${SYS_TYPE}${os_version}sp${os_patchlevel}"
fi
case "$SYS_TYPE" in
suse*)
if [ "suse10sp1" = "${OS_DIST_SVER}" ]; then
#suse10 sp1
KERN_RELEASE="2.6.16.46-0.12-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
GUEST_INFO='suse10_sp1'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.29-bigsmp"`" ]; then
#suse10 sp2 customized
SYS_TYPE='SLES10'
GUEST_INFO='suse10_sp2_customized'
elif [ "suse10sp2" = "${OS_DIST_SVER}" ]; then
#suse10 sp2
KERN_RELEASE="2.6.16.60-0.21-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
GUEST_INFO='suse10_sp2'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.16.60-0.74.7"`" ] && [ "x86_64" = "${CPU_ARCH}" ] && [ "smp" = "${ker_rel_sysinfo}" ]; then
#suse10 sp3 customized
KERN_RELEASE="2.6.16.60-0.54.5-smp"
SYS_TYPE='SLES10'
GUEST_INFO='suse10_sp3_customized'
elif [ "suse10sp3" = "${OS_DIST_SVER}" ]; then
#suse10 sp3
KERN_RELEASE="2.6.16.60-0.54.5-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
GUEST_INFO='suse10_sp3'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.16.60-0.99.1"`" ] && [ "x86_64" = "${CPU_ARCH}" ] && [ "smp" = "${ker_rel_sysinfo}" ]; then
#suse10 sp4 customized
KERN_RELEASE="2.6.16.60-0.85.1-smp"
SYS_TYPE='SLES10'
GUEST_INFO='suse10_sp4_customized'
elif [ "suse10sp4" = "${OS_DIST_SVER}" ]; then
#suse10 sp4
KERN_RELEASE="2.6.16.60-0.85.1-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
GUEST_INFO='suse10_sp4'
elif [ "suse11sp0" = "${OS_DIST_SVER}" ]; then
#suse11 sp0
KERN_RELEASE="2.6.27.19-5-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp0'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.54-0.3"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v1
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp1_customized_v1'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.59-0.3"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v2
KERN_RELEASE="2.6.32.59-0.3-default"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp1_customized_v2'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.59-0.7"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v3
KERN_RELEASE="2.6.32.59-0.7-default"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp1_customized_v3'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.59-0.17"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v3
KERN_RELEASE="2.6.32.59-0.7-default"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp1_customized_v3'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.59-0.19"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v3
KERN_RELEASE="2.6.32.59-0.7-default"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp1_customized_v3'
elif [ "suse11sp1" = "${OS_DIST_SVER}" ]; then
#suse11 sp1
KERN_RELEASE="2.6.32.12-0.7-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp1'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.58"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11 sp2 customized v1 v2
SYS_TYPE='SLES11'
if [ -n "`echo ${KERN_RELEASE} | grep "0.6.2"`" ]; then
GUEST_INFO='suse11_sp2_customized_v1'
elif [ -n "`echo ${KERN_RELEASE} | grep "0.6.6"`" ]; then
GUEST_INFO='suse11_sp2_customized_v2'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.80"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11 sp2 customized v3
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp2_customized_v3'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.93-0.5"`" ]; then
# suse11 sp2 customized v4
KERN_RELEASE="3.0.13-0.27-default"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp2_customized_v4'
elif [ "suse11sp2" = "${OS_DIST_SVER}" ];then
# suse11 sp2
KERN_RELEASE="3.0.13-0.27-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp2'
elif [ "suse11sp3" = "${OS_DIST_SVER}" ]; then
# suse11 sp3
KERN_RELEASE="3.0.76-0.11-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
GUEST_INFO='suse11_sp3'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.34"`" ]; then
#OpenSUSE 11.3
SYS_TYPE='openSUSE11.3'
GUEST_INFO='opensuse_11.3'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.16.6-2"`" ]; then
#OpenSUSE 13.2
SYS_TYPE='openSUSE13.2'
GUEST_INFO='opensuse_13.2'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.12.28"`" ]; then
SYS_TYPE='SLES12'
GUEST_INFO='suse12'
fi
;;
redhat*)
dist_arch="`uname -r | awk -F"." '{print $4}'`"
dist_bit="`uname -m`"
if [ "CentOS" = "$(cat /etc/redhat-release | awk -F" " '{print $1}')" ]
then
sys_ver=$(cat /etc/redhat-release | awk -F" " '{print $3}')
fi
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-1.2798"`" ]; then
#Fedora 6
SYS_TYPE='FEDORA6'
if [ "i686" == ${dist_bit} -a -f "/boot/config-${KERN_RELEASE}" -a -n "`cat /boot/config-${KERN_RELEASE} | grep M586=y`" ];then
KERN_RELEASE="2.6.18-1.2798.fc6.i586"
fi
GUEST_INFO='fedora6'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.23.1-42.fc8"`" ]; then
SYS_TYPE='FEDORA8'
GUEST_INFO='fedora8'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.25"`" ]; then
#Fedora 9
SYS_TYPE='FEDORA9'
GUEST_INFO='fedora9'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.31.5"`" ]; then
#Fedora 12
SYS_TYPE='FEDORA12'
GUEST_INFO='fedora12'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.35.6"`" ]; then
#Fedora 14
SYS_TYPE='FEDORA14'
GUEST_INFO='fedora14'
elif [ -n "`echo ${KERN_RELEASE} | grep "4.0.4-301"`" ]; then
#Fedora22_64
SYS_TYPE='FEDORA22'
GUEST_INFO='fedora22'
elif [ -n "`echo ${KERN_RELEASE} | grep "4.2.3-300"`" ]; then
#Fedora23_64
SYS_TYPE='FEDORA23'
GUEST_INFO='fedora23'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9-22"`" ]; then
#redhat 4.2
SYS_TYPE='RHEL4'
GUEST_INFO='redhat4.2'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9" | grep "AXS"`" ]; then
#red flag asianux 2sp4
SYS_TYPE='RHEL4'
KERN_RELEASE="2.6.9-89.${dist_arch}"
GUEST_INFO='redflag2_sp4'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9"`" ]; then
#redhat 4.4 4.5 4.6 4.7 4.8
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.9-42"`" ]; then
GUEST_INFO='redhat4.4'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9-55"`" ]; then
GUEST_INFO='redhat4.5'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9-67"`" ]; then
GUEST_INFO='redhat4.6'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9-78"`" ]; then
GUEST_INFO='redhat4.7'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9-89"`" ]; then
GUEST_INFO='redhat4.8'
fi
SYS_TYPE='RHEL4'
KERN_RELEASE="2.6.9-42.${dist_arch}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-SKL1.9.4.ky3.173.4.1"`" ]; then
#中标麒麟 3.0
SYS_TYPE='RHEL5'
GUEST_INFO='kylin3.0'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18.*.AXS"`" ]; then
#Red Flag 3 sp2 sp3
if [ -n "`echo ${KERN_RELEASE} | grep "128.7"`" ]; then
GUEST_INFO='redflag3_sp2'
elif [ -n "`echo ${KERN_RELEASE} | grep "194.1"`" ]; then
GUEST_INFO='redflag3_sp3'
fi
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-8.el5"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-194"`" ]; then
if [ "i686" == ${dist_bit} ]; then
#redhat 5.3
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-128.${dist_arch}"
else
#redhat 5.5
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-194.${dist_arch}"
fi
if [ "5.5" = "${sys_ver}" ]
then
GUEST_INFO='centos5.5'
else
GUEST_INFO='redhat5.5'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-[0-9]\{1,2\}\."`" ]; then
#redhat 5.0 5.1 5.2
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-8"`" ]; then
GUEST_INFO='redhat5.0'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-53"`" ]; then
GUEST_INFO='redhat5.1'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-92"`" ]; then
GUEST_INFO='redhat5.2'
fi
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-8.${dist_arch}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-[0-9]\{3\}\."`" ]; then
#redhat 5.3 5.4 5.6 5.7 5.8 5.9
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-128"`" ]; then
GUEST_INFO='redhat5.3'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-164"`" ]; then
GUEST_INFO='redhat5.4'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-238"`" ]; then
if [ "5.6" = "${sys_ver}" ]
then
GUEST_INFO='centos5.6'
else
GUEST_INFO='redhat5.6'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-274"`" ]; then
GUEST_INFO='redhat5.7'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-308"`" ]; then
GUEST_INFO='redhat5.8'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-348"`" ]; then
if [ "5.9" = "${sys_ver}" ]
then
GUEST_INFO='centos5.9'
else
GUEST_INFO='redhat5.9'
fi
fi
SYS_TYPE='RHEL5'
if [ -n "`uname -r | grep el5PAE`" ]; then
KERN_RELEASE="2.6.18-128.el5PAE"
else
KERN_RELEASE="2.6.18-128.el5"
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.39-200.24.1.el6uek"`" ]; then
#Oracle 6.3
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.39-200.24.1.el6uek.${dist_bit}"
GUEST_INFO='oracle6.3'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-300.10.1.el5uek"`" ]; then
#Oracle 5.8
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.32-300.10.1.el5uek"
GUEST_INFO='oracle5.8'
elif [ -n "`echo ${KERN_RELEASE} | grep "el5uek"`" ]; then
#Oracle 5.7 5.8
if [ -n "`echo ${KERN_RELEASE} | grep "200.13.1"`" ]; then
GUEST_INFO='oracle5.7'
elif [ -n "`echo ${KERN_RELEASE} | grep "300.10.1"`" ]; then
GUEST_INFO='oracle5.8'
fi
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.32-200.13.1.el5uek"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-300.3.1"`" ]; then
#Oracle 6.2
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-300.3.1.el6uek.${dist_bit}"
GUEST_INFO='oracle6.2'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.39-400.17.1.el6uek"`" ]; then
#Oracle 6.4
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.39-400.17.1.el6uek.${dist_bit}"
GUEST_INFO='oracle6.4'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.39-400.211.1.el6uek"`" ]; then
#Oracle 6.5 x86
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.39-400.211.1.el6uek.${dist_bit}"
GUEST_INFO='oracle6.5'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.8.13-16.2.1.el6uek"`" ]; then
##Oracle 6.5 x86_64
SYS_TYPE='RHEL6'
KERN_RELEASE="3.8.13-16.2.1.el6uek.${dist_bit}"
GUEST_INFO='oracle6.5'
elif [ -n "`echo ${KERN_RELEASE} | grep "el6uek"`" ]; then
#Oracle 6.1 6.4
if [ -n "`echo ${KERN_RELEASE} | grep "100.34.1"`" ]; then
GUEST_INFO='oracle6.1'
elif [ -n "`echo ${KERN_RELEASE} | grep "400.17.1"`" ]; then
GUEST_INFO='oracle6.4'
fi
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-100.34.1.el6uek.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-71"`" ]; then
#redhat 6.0
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-71.el6.${dist_bit}"
if [ "6.0" = "${sys_ver}" ]
then
GUEST_INFO='centos6.0'
else
GUEST_INFO='redhat6.0'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-279.2.1.el6.i686"`" ]; then
#RedFlag 4 sp2 x86
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-279.el6.i686"
GUEST_INFO='redflag4_sp2'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-131.0.15"`" ]; then
#redhat 6.1
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-131.0.15.el6.${dist_bit}"
if [ "6.1" = "${sys_ver}" ]
then
GUEST_INFO='centos6.1'
else
GUEST_INFO='redhat6.1'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-220"`" ]; then
#redhat 6.2 中标麒麟 6.0
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-220.el6.${dist_bit}"
if [ "6.2" = "${sys_ver}" ]
then
GUEST_INFO='centos6.2'
else
GUEST_INFO='redhat6.2'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-279"`" ]; then
#redhat 6.3
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-279.el6.${dist_bit}"
if [ "6.3" = "${sys_ver}" ]
then
GUEST_INFO='centos6.3'
else
GUEST_INFO='redhat6.3'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-358"`" ]; then
#redhat 6.4
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-358.el6.${dist_bit}"
if [ "6.4" = "${sys_ver}" ]
then
GUEST_INFO='centos6.4'
else
GUEST_INFO='redhat6.4'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32"`" ]; then
#redhat 6.5
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-131.0.15.el6.${dist_bit}"
if [ "6.5" = "${sys_ver}" ]
then
GUEST_INFO='centos6.5'
else
GUEST_INFO='redhat6.5'
fi
elif [ -f /etc/euleros-release -a -n "`echo ${KERN_RELEASE} | grep "3.10.0-229"`" ]; then
#euleros2.1
SYS_TYPE='RHEL7'
KERN_RELEASE="3.10.0-123.el7.${dist_bit}"
GUEST_INFO='euleros2.1'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.10.0"`" ]; then
#redhat 7.0
SYS_TYPE='RHEL7'
KERN_RELEASE="3.10.0-123.el7.${dist_bit}"
GUEST_INFO='redhat7.0'
fi
;;
debian*)
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.26-2"`" ]; then
#Debian 5.0.10
SYS_TYPE="Debian5"
GUEST_INFO='debian5.0.10'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-5"`" ]; then
#Debian 6
SYS_TYPE="Debian6"
GUEST_INFO='debian6'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.2.0-4"`" ]; then
#Debian 7
SYS_TYPE="Debian7"
GUEST_INFO='debian7'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.16.0-4"`" ]; then
#Debian 8.2
SYS_TYPE="Debian8"
GUEST_INFO='debian8'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.24"`" ]; then
#Ubuntu 8.04
SYS_TYPE="Ubuntu8"
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.24-16"`" ]; then
GUEST_INFO='ubuntu8.04'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.24-26"`" ]; then
GUEST_INFO='ubuntu8.04.4'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.31-14"`" ]; then
#Ubuntu 9.10
SYS_TYPE="Ubuntu9"
GUEST_INFO='ubuntu9.10'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.38-16-generic"`" ]; then
#Ubuntu 10.04.2 customized
SYS_TYPE="Ubuntu10"
GUEST_INFO='ubuntu10.04.2_customized'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32"`" ]; then
#Ubuntu 10.04 and 10.04.1 and 10.04.2 and 10.04.3
SYS_TYPE="Ubuntu10"
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-21"`" ]; then
GUEST_INFO='ubuntu10.04_server'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-38"`" ]; then
GUEST_INFO='ubuntu10.04_desktop'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-24"`" ]; then
GUEST_INFO='ubuntu10.04.1'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-28"`" ]; then
GUEST_INFO='ubuntu10.04.2'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-33"`" ]; then
GUEST_INFO='ubuntu10.04.3'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.35"`" ]; then
#Ubuntu 10.10
SYS_TYPE="Ubuntu10"
GUEST_INFO='ubuntu10.10'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.0-15"`" ]; then
#Ubuntu 10.04.4
SYS_TYPE="Ubuntu10"
GUEST_INFO='ubuntu10.04.4'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.0"`" ]; then
#Ubuntu 11.10
SYS_TYPE="Ubuntu11"
GUEST_INFO='ubuntu11.10'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.38-8"`" ]; then
#Ubuntu 11.04
SYS_TYPE="Ubuntu11"
GUEST_INFO='ubuntu11.04'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.2.0"`" ]; then
#Ubuntu 12.04 and 12.04.1
SYS_TYPE="Ubuntu12"
if [ -n "`echo ${KERN_RELEASE} | grep "3.2.0-23"`" ]; then
GUEST_INFO='ubuntu12.04'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.2.0-29"`" ]; then
GUEST_INFO='ubuntu12.04.1'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "3.5.0"`" ]; then
#Ubuntu 12.04.2 and 12.10
SYS_TYPE="Ubuntu12"
if [ -n "`echo ${KERN_RELEASE} | grep "3.5.0-23"`" ]; then
GUEST_INFO='ubuntu12.04.2'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.5.0-17"`" ]; then
GUEST_INFO='ubuntu12.10'
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "3.8.0-29"`" ]; then
#Ubuntu 12.04.3
SYS_TYPE="Ubuntu12"
GUEST_INFO='ubuntu12.04.3'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.11.0-15"`" ]; then
#Ubuntu 12.04.4
SYS_TYPE="Ubuntu12"
GUEST_INFO='ubuntu12.04.4'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.8.0"`" ]; then
#Ubuntu 13.04
SYS_TYPE="Ubuntu13"
GUEST_INFO='ubuntu13.04'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.11.0-12"`" ]; then
#Ubuntu 13.10
SYS_TYPE="Ubuntu13"
GUEST_INFO='ubuntu13.10'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.13.0-24"`" ]; then
#Ubuntu 14.04
SYS_TYPE="Ubuntu14"
GUEST_INFO='ubuntu14.04'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.13.0-32"`" ]; then
SYS_TYPE="Ubuntu14"
GUEST_INFO='ubuntu14.04.1'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.19.0-25"`" ]; then
#Ubuntu 14.04.3
SYS_TYPE="Ubuntu14"
GUEST_INFO='ubuntu14.04.3'
fi
;;
gentoo*)
if [ -n "`echo ${KERN_RELEASE} | grep -w "3.9.0"`" ]; then
#Gentoo customized
SYS_TYPE="Gentoo"
GUEST_INFO='gentoo_customized'
fi
;;
esac
cat > "./CurrentOS" << EOF
${GUEST_INFO}_${MACHINE_TYPE}
EOF
echo "$MODULES_PATH$KERN_RELEASE-$CPU_ARCH-$SYS_TYPE"
UVP-Tools-2.2.0.316/bin/mem_online.sh 0000664 0000000 0000000 00000001114 13140374466 0017026 0 ustar 00root root 0000000 0000000 #!/bin/bash
MEM_DEVTREE_PATH="/sys/devices/system/memory"
if [ ! -d ${MEM_DEVTREE_PATH} ]
then
echo "cannot access ${MEM_DEVTREE_PATH}: No such file or directory"
exit 1
fi
for mem_index in ${MEM_DEVTREE_PATH}/memory*
do
state=$(grep offline ${mem_index}/state)
if [ -n "$state" ]
then
echo online > ${mem_index}/state
echo "${mem_index}/state change to online."
fi
done
allonline=$(grep offline ${MEM_DEVTREE_PATH}/*/state)
if [ -z "$allonline" ]
then
echo "All hotplug memories have online."
else
echo "There are memories offline, please execute the script again."
fi
UVP-Tools-2.2.0.316/bin/modify_swappiness.sh 0000664 0000000 0000000 00000001246 13140374466 0020455 0 ustar 00root root 0000000 0000000 #!/bin/bash
log() {
local level="$1"
shift
logger -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2 &
}
if [ "$1" = "modify" ]
then
old=`cat /proc/sys/vm/swappiness`
if [ "$old" = "1" ]
then
exit 0
fi
cat /proc/sys/vm/swappiness > /etc/.uvp-monitor/swappiness_old
echo 1 > /proc/sys/vm/swappiness
new=`cat /proc/sys/vm/swappiness`
log info "modify in suspend,swappiness is $new"
else
if [ ! -e "/etc/.uvp-monitor/swappiness_old" ]
then
exit 0
fi
old=`cat /etc/.uvp-monitor/swappiness_old`
echo $old > /proc/sys/vm/swappiness
rm -rf /etc/.uvp-monitor/swappiness_old
old=`cat /proc/sys/vm/swappiness`
log info "restore in resume,swappiness is $old"
fi
UVP-Tools-2.2.0.316/bin/offline_copy_uvp_module 0000664 0000000 0000000 00000004255 13140374466 0021217 0 ustar 00root root 0000000 0000000 #!/bin/bash
CPUARCH=''
UVPTOOLSPATH=`pwd`
SYS_TYPE=''
INSTALLER_DIR=${UVPTOOLSPATH}
KERLIBMOD=''
VMTOOLRVFPATH=''
LCL_UVP_MODULES_PATH=''
get_linux_cpu_arch()
{
if [ ! -f "/sbin/depmod" ]
then
echo "Can not determine linux cpu arch."
exit 1
fi
if [ -n "$(file /sbin/depmod | grep "64-bit")" -o -n "$(file /bin/kmod | grep "64-bit")" ]
then
CPUARCH="x86_64"
elif [ -n "$(file /sbin/depmod | grep "32-bit")" -o -n "$(file /bin/kmod | grep "32-bit")" ]
then
CPUARCH="i686"
else
echo "Can not determine linux cpu arch 32 or 64 bit."
exit 1
fi
}
get_linux_dist()
{
issue='/etc/issue'
if [ -e '/etc/debian_version' -o -n "$(grep -i 'debian' $issue)" ]
then
SYS_TYPE='debian'
elif [ -e '/etc/redhat-release' -o -n "$(grep -i 'red *hat' $issue)" ]
then
SYS_TYPE='redhat'
elif [ -e '/etc/SuSE-release' -o -n "$(grep -i 'suse\|s\.u\.s\.e' $issue)" ]
then
SYS_TYPE='suse'
else
echo "cannot determine linux distribution"
exit 1
fi
}
match_patchkernel_version()
{
KERN_RELEASE=$1
get_uvp_kernel_modules_bin="${INSTALLER_DIR}/bin/offline/offline_get_uvp_kernel_modules"
LCL_UVP_MODULES_PATH=$(${get_uvp_kernel_modules_bin} "$SYS_TYPE" "$KERN_RELEASE" "$CPUARCH")
echo $LCL_UVP_MODULES_PATH
}
kernel_libmodule_path()
{
kernelversion=$1
KERLIBMOD="/lib/modules/$kernelversion/updates/pvdriver"
if [ ! -d ${KERLIBMOD} ];then
mkdir -p ${KERLIBMOD}
fi
}
copy_xvf_module()
{
UvptoolsModuleRvfPath=$1
UVPTOOLRVFPATH="${INSTALLER_DIR}/lib/modules/$UvptoolsModuleRvfPath"
echo $UVPTOOLRVFPATH
if [ -d "${UVPTOOLRVFPATH}" ];then
cp -rf $UVPTOOLRVFPATH/* $KERLIBMOD
else
echo "Unsupported Linux Version."
exit 1
fi
}
find_module()
{
get_linux_cpu_arch
get_linux_dist
for kernelversion in `ls /lib/modules/`
do
illegal_kern="`echo ${kernelversion} | awk -F"." '{print $1}'`"
if [ "${illegal_kern}" = ^[0-9] ];then
echo "illegal kernel"
continue
fi
match_patchkernel_version ${kernelversion}
VmtoolsModuleRvfPath="${LCL_UVP_MODULES_PATH}"
echo $VmtoolsModuleRvfPath
kernel_libmodule_path ${kernelversion}
copy_xvf_module ${LCL_UVP_MODULES_PATH}
for mod in $(find $KERLIBMOD -type f -name "*.ko")
do
echo $mod
done
done
}
find_module
UVP-Tools-2.2.0.316/bin/offline_get_uvp_kernel_modules 0000664 0000000 0000000 00000024446 13140374466 0022553 0 ustar 00root root 0000000 0000000 #!/bin/bash
SYS_TYPE=$1
KERN_RELEASE=$2
CPU_ARCH=$3
MODULES_PATH=xvf-
if [ -f "/etc/SuSE-release" ] && [ ! -f "/etc/EulerLinux.conf" ]
then
os_version=$(cat /etc/SuSE-release | awk -F" " 'NR==2 {print $3}')
os_patchlevel=$(cat /etc/SuSE-release | awk -F" " 'NR==3 {print $3}')
ker_rel_sysinfo=$(echo ${KERN_RELEASE} | awk -F"-" '{print $3}')
OS_DIST_SVER="${SYS_TYPE}${os_version}sp${os_patchlevel}"
fi
case "$SYS_TYPE" in
suse*)
if [ "suse10sp1" = "${OS_DIST_SVER}" ]; then
#suse10 sp1
KERN_RELEASE="2.6.16.46-0.12-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.29-bigsmp"`" ]; then
#suse10 sp2 customized
SYS_TYPE='SLES10'
elif [ "suse10sp2" = "${OS_DIST_SVER}" ]; then
#suse10 sp2
KERN_RELEASE="2.6.16.60-0.21-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.16.60-0.74.7"`" ] && [ "x86_64" = "${CPU_ARCH}" ] && [ "smp" = "${ker_rel_sysinfo}" ]; then
#suse10 sp3 customized
KERN_RELEASE="2.6.16.60-0.54.5-smp"
SYS_TYPE='SLES10'
elif [ "suse10sp3" = "${OS_DIST_SVER}" ]; then
#suse10 sp3
KERN_RELEASE="2.6.16.60-0.54.5-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.16.60-0.99.1"`" ] && [ "x86_64" = "${CPU_ARCH}" ] && [ "smp" = "${ker_rel_sysinfo}" ]; then
#suse10 sp4 customized
KERN_RELEASE="2.6.16.60-0.85.1-smp"
SYS_TYPE='SLES10'
elif [ "suse10sp4" = "${OS_DIST_SVER}" ]; then
#suse10 sp4
KERN_RELEASE="2.6.16.60-0.85.1-${ker_rel_sysinfo}"
SYS_TYPE='SLES10'
elif [ "suse11sp0" = "${OS_DIST_SVER}" ]; then
#suse11 sp0
KERN_RELEASE="2.6.27.19-5-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.54-0.3"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v1
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.59-0.3"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v2
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.59-0.7"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v3
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32.59-0.17"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11sp1_customized_v3
KERN_RELEASE="2.6.32.59-0.7-default"
SYS_TYPE='SLES11'
elif [ "suse11sp1" = "${OS_DIST_SVER}" ]; then
#suse11 sp1
KERN_RELEASE="2.6.32.12-0.7-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.58"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11 sp2 customized v1 v2
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.80"`" ] && [ "x86_64" = "${CPU_ARCH}" ]; then
# suse11 sp2 customized v3
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.93-0.5"`" ]; then
# suse11 sp2 customized v4
KERN_RELEASE="3.0.13-0.27-default"
SYS_TYPE='SLES11'
elif [ "suse11sp2" = "${OS_DIST_SVER}" ];then
# suse11 sp2
KERN_RELEASE="3.0.13-0.27-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
elif [ "suse11sp3" = "${OS_DIST_SVER}" ]; then
# suse11 sp3
KERN_RELEASE="3.0.76-0.11-${ker_rel_sysinfo}"
SYS_TYPE='SLES11'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.34"`" ]; then
#OpenSUSE 11.3
SYS_TYPE='openSUSE11.3'
elif [ -n "`echo ${KERN_RELEASE} | grep "3.16.6"`" ]; then
#OpenSUSE 13.2
SYS_TYPE='openSUSE13.2'
fi
;;
redhat*)
dist_arch="`echo ${KERN_RELEASE} | awk -F"." '{print $4}'`"
dist_bit="${CPU_ARCH}"
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-1.2798"`" ]; then
#Fedora 6
SYS_TYPE='FEDORA6'
if [ "i686" == ${dist_bit} -a -f "/boot/config-${KERN_RELEASE}" -a -n "`cat /boot/config-${KERN_RELEASE} | grep M586=y`" ];then
KERN_RELEASE="2.6.18-1.2798.fc6.i586"
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.23.1-42.fc8"`" ]; then
SYS_TYPE='FEDORA8'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.25"`" ]; then
#Fedora 9
SYS_TYPE='FEDORA9'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.31.5"`" ]; then
#Fedora 12
SYS_TYPE='FEDORA12'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.35.6"`" ]; then
#Fedora 14
SYS_TYPE='FEDORA14'
elif [ -n "`echo ${KERN_RELEASE} | grep "4.0.4-301"`" ]; then
#Fedora22_64
SYS_TYPE='FEDORA22'
elif [ -n "`echo ${KERN_RELEASE} | grep "4.2.3-300"`" ]; then
#Fedora23_64
SYS_TYPE='FEDORA23'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9-22"`" ]; then
#redhat 4.2
SYS_TYPE='RHEL4'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9" | grep "AXS"`" ]; then
#red flag asianux 2sp4
SYS_TYPE='RHEL4'
KERN_RELEASE="2.6.9-89.${dist_arch}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.9"`" ]; then
#redhat 4.4 4.5 4.6 4.7 4.8
SYS_TYPE='RHEL4'
KERN_RELEASE="2.6.9-42.${dist_arch}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-SKL1.9.4.ky3.173.4.1"`" ]; then
#中标麒麟 3.0
SYS_TYPE='RHEL5'
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18.*.AXS"`" ]; then
#Red Flag 3 sp2 sp3
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-8.el5"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-194"`" ]; then
if [ "i686" == ${dist_bit} ]; then
#redhat 5.3
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-128.${dist_arch}"
else
#redhat 5.5
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-194.${dist_arch}"
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-[0-9]\{1,2\}\."`" ]; then
#redhat 5.0 5.1 5.2
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.18-8.${dist_arch}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.18-[0-9]\{3\}\."`" ]; then
#redhat 5.3 5.4 5.6 5.7 5.8
SYS_TYPE='RHEL5'
if [ -n "`echo ${KERN_RELEASE} | grep "el5PAE"`" ]; then
KERN_RELEASE="2.6.18-128.el5PAE"
else
KERN_RELEASE="2.6.18-128.el5"
fi
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.39-200.24.1.el6uek"`" ]; then
#Oracle 6.3
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.39-200.24.1.el6uek.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-300.10.1.el5uek"`" ]; then
#Oracle 5.8
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.32-300.10.1.el5uek"
elif [ -n "`echo ${KERN_RELEASE} | grep "el5uek"`" ]; then
#Oracle 5.7 5.8
SYS_TYPE='RHEL5'
KERN_RELEASE="2.6.32-200.13.1.el5uek"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-300.3.1"`" ]; then
#Oracle 6.2
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-300.3.1.el6uek.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.39-400.17.1.el6uek"`" ]; then
#Oracle 6.4
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.39-400.17.1.el6uek.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.39-400.211.1.el6uek"`" ]; then
#Oracle 6.5 x86
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.39-400.211.1.el6uek.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.8.13-16.2.1.el6uek"`" ]; then
##Oracle 6.5 x86_64
SYS_TYPE='RHEL6'
KERN_RELEASE="3.8.13-16.2.1.el6uek.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "el6uek"`" ]; then
#Oracle 6.1 6.4
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-100.34.1.el6uek.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-71"`" ]; then
#redhat 6.0
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-71.el6.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-279.2.1.el6.i686"`" ]; then
#RedFlag 4 sp2 x86
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-279.el6.i686"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-131.0.15"`" ]; then
#redhat 6.1
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-131.0.15.el6.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-220"`" ]; then
#redhat 6.2 中标麒麟 6.0
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-220.el6.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-279"`" ]; then
#redhat 6.3
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-279.el6.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-358"`" ]; then
#redhat 6.4
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-358.el6.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32"`" ]; then
#redhat 6.5
SYS_TYPE='RHEL6'
KERN_RELEASE="2.6.32-131.0.15.el6.${dist_bit}"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.10.0"`" ]; then
#redhat 7.0
SYS_TYPE='RHEL7'
KERN_RELEASE="3.10.0-123.el7.${dist_bit}"
fi
;;
debian*)
if [ -n "`echo ${KERN_RELEASE} | grep "2.6.26-2"`" ]; then
#Debian 5.0.10
SYS_TYPE="Debian5"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32-5"`" ]; then
#Debian 6
SYS_TYPE="Debian6"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.2.0-4"`" ]; then
#Debian 7
SYS_TYPE="Debian7"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.16.0-4"`" ]; then
#Debian 8.2
SYS_TYPE="Debian8"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.24"`" ]; then
#Ubuntu 8.04
SYS_TYPE="Ubuntu8"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.31-14"`" ]; then
#Ubuntu 9.10
SYS_TYPE="Ubuntu9"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.38-16-generic"`" ]; then
#Ubuntu 10.04.2 customized
SYS_TYPE="Ubuntu10"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.32"`" ]; then
#Ubuntu 10.04 and 10.04.1 and 10.04.2 and 10.04.3
SYS_TYPE="Ubuntu10"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.35"`" ]; then
#Ubuntu 10.10
SYS_TYPE="Ubuntu10"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.0-15"`" ]; then
#Ubuntu 10.04.4
SYS_TYPE="Ubuntu10"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.0.0"`" ]; then
#Ubuntu 11.10
SYS_TYPE="Ubuntu11"
elif [ -n "`echo ${KERN_RELEASE} | grep "2.6.38-8"`" ]; then
#Ubuntu 11.04
SYS_TYPE="Ubuntu11"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.2.0"`" ]; then
#Ubuntu 12.04 and 12.04.1
SYS_TYPE="Ubuntu12"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.5.0"`" ]; then
#Ubuntu 12.04.2 and 12.10
SYS_TYPE="Ubuntu12"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.8.0-29"`" ]; then
#Ubuntu 12.04.3
SYS_TYPE="Ubuntu12"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.11.0-15"`" ]; then
#Ubuntu 12.04.4
SYS_TYPE="Ubuntu12"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.8.0"`" ]; then
#Ubuntu 13.04
SYS_TYPE="Ubuntu13"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.11.0-12"`" ]; then
#Ubuntu 13.10
SYS_TYPE="Ubuntu13"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.13.0-24"`" ]; then
#Ubuntu 14.04
SYS_TYPE="Ubuntu14"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.13.0-32"`" ]; then
SYS_TYPE="Ubuntu14"
elif [ -n "`echo ${KERN_RELEASE} | grep "3.19.0-25"`" ]; then
#Ubuntu 14.04.3
SYS_TYPE="Ubuntu14"
fi
;;
gentoo*)
if [ -n "`echo ${KERN_RELEASE} | grep -w "3.9.0"`" ]; then
#Gentoo customized
SYS_TYPE="Gentoo"
fi
;;
esac
echo "$MODULES_PATH$KERN_RELEASE-$CPU_ARCH-$SYS_TYPE"
UVP-Tools-2.2.0.316/bin/pvumount.sh 0000664 0000000 0000000 00000003653 13140374466 0016613 0 ustar 00root root 0000000 0000000 #!/bin/bash
devname=$1
flag=0
Info()
{
echo "`date` $1" >>/var/log/unplug.log
}
Info "begin to umount ${devname}"
if [ -z ${devname} ]; then
exit 1
fi
#TODO:xvdaa xvdab
parts=`mount |grep /dev/${devname} |awk '{print $1}'`
for part in ${parts}
do
count=0
while [ 1 ]
do
count=`expr ${count} + 1`
fuser -k -m ${part}
ret=$?
Info "kill ${part} process: ${ret}"
umount -l ${part}
ret=$?
Info "umount -l ${part}: ${ret}"
if [ $ret = 0 ]; then
break
fi
if [ ${count} = 3 ]; then
flag=1
break
fi
done
done
#handle logic volume
vges=`pvs|grep /dev/${devname}|awk '{print $2}'`
#symbol name may start with 'hd' or 'sd'
if [ "${vges}" = "" ]; then
devsymbol="hd${devname:3}"
vges=`pvs|grep /dev/${devsymbol}|awk '{print $2}'`
fi
if [ "${vges}" = "" ]; then
devsymbol="sd${devname:3}"
vges=`pvs|grep /dev/${devsymbol}|awk '{print $2}'`
fi
for vg in ${vges}
do
lves=`lvs |awk '$2=="'$vg'" {print $1}'`
for lv in ${lves}
do
count=0
lvname="/dev/mapper/${vg}-${lv}"
echo "${lvname}"
mountpoint=`mount | awk '$1=="'${lvname}'" {print $1}'`
if [ "${mountpoint}" = "" ]; then
break
fi
while [ 1 ]
do
count=`expr ${count} + 1`
fuser -k -m /dev/mapper/${vg}-${lv}
ret=$?
Info "kill /dev/mapper/${vg}-${lv} process: ${ret}"
umount -l /dev/mapper/${vg}-${lv}
ret=$?
Info "umount -l /dev/mapper/${vg}-${lv}: ${ret}"
if [ $ret = 0 ]; then
break
fi
if [ ${count} = 3 ]; then
flag=1
break
fi
done
done
vgchange -an ${vg}
done
Info "end of umount ${devname}: ${flag}"
Info "================================================"
exit ${flag}
UVP-Tools-2.2.0.316/bin/uvp-config-mouse 0000664 0000000 0000000 00000012102 13140374466 0017475 0 ustar 00root root 0000000 0000000 #!/bin/bash
#######################################################################################
# 2010-7-6 chentao
# Description: If VM is configured with the tablet usb parameter, then check
# the configuration of the event number for the usb mouse in the
# /etc/X11/xorg.conf and make some changes based on specific conditions.
# If VM is configured with the mouse ps2 parameter or this script is
# uninstalled with PV Driver, then revert the conf to the original state.
#######################################################################################
XORG_CONF='/etc/X11/xorg.conf'
INPUT_DEVICES='/proc/bus/input/devices'
if [ ! -f "${XORG_CONF}" -o ! -f "${INPUT_DEVICES}" ]
then
exit 0
fi
###############################################################################
# Config File Editor
###############################################################################
### modification operations
MARKER_BEGIN='###pvdriver'
MARKER_END='###pvdriver'
MARKER_COMMENT='###pvdriver#'
MARKER_WARNING=' do not change this comment'
insert_block()
{
object_file=$1
anchor_address=$2
block_text=$3
test ! -f "$object_file" && return 2
sed_cmd='a'
###
if [ "${anchor_address}" = '$' ]
then
anchor_address='$'
elif [ "${anchor_address}" = '0' ]
then
anchor_address=1
sed_cmd='i'
elif [ -z "$(echo "${anchor_address}" | sed -n '/^\s*[0-9]\+\s*$/p')" ]
then
anchor_address=$(echo "${anchor_address}" | sed 's/\//\\\//g')
anchor_address="/${anchor_address}/"
fi
###
if [ -s "$object_file" ]
then
sed -i "${anchor_address}${sed_cmd}\
${MARKER_BEGIN}${MARKER_WARNING}\n\
$(echo "$block_text" | sed ':a;N;s/\n/\\n/;ta')\n\
${MARKER_END}${MARKER_WARNING}" "$object_file"
else
cat > "$object_file" << EOF
${MARKER_BEGIN}${MARKER_WARNING}
$block_text
${MARKER_END}${MARKER_WARNING}
EOF
fi
ret=$?
if [ $ret = 0 ]
then
return $ret
else
abort "insert_block $object_file with ${anchor_address} failed."
fi
}
remove_block()
{
object_file=$1
test ! -f "$object_file" && return 2
while :; do
marker_begin_line=$(grep -n "${MARKER_BEGIN}.*" "${object_file}" | sed -n '1p' | awk -F ':' '{print $1}')
marker_end_line=$(grep -n "${MARKER_END}.*" "${object_file}" | sed -n '1p' | awk -F ':' '{print $1}')
test -z "${marker_begin_line}" -o -z "${marker_end_line}" && break
if ! sed -i "${marker_begin_line},${marker_end_line}d" "${object_file}"
then
abort "remove_block $object_file failed."
fi
done
}
comment_on_line()
{
object_file=$1
anchor_address=$2
anchor_expreg=$3
test ! -f "$object_file" && return 2
###
if [ "${anchor_address}" = '$' ]
then
anchor_address='$'
elif [ -z "$(echo "${anchor_address}" | sed -n '/^\s*[0-9]\+\s*$/p')" ]
then
anchor_address=$(echo "${anchor_address}" | sed 's/\//\\\//g')
anchor_address="/${anchor_address}/"
fi
###
anchor_expreg=$(echo "${anchor_expreg}" | sed 's/\//\\\//g')
if ! sed -i "${anchor_address}s;\(${anchor_expreg}.*\);${MARKER_COMMENT}\1;g" "$object_file"
then
abort "comment_on_line $object_file at ${anchor_expreg} failed."
fi
}
comment_off_line()
{
object_file=$1
test ! -f "$object_file" && return 2
###
if ! sed -i "s;\(^\s*\)${MARKER_COMMENT}\(.*\);\1\2;g" "$object_file"
then
abort "comment_off_line $object_file at ${anchor_expreg} failed."
fi
}
###############################################################################
# Config File Editor
###############################################################################
ChangeXorg()
{
remove_block "${XORG_CONF}"
comment_off_line "${XORG_CONF}"
### add UvpMouseEvent
usb_tablet_line=$(sed -n '/QEMU\s*USB\s*Tablet/=' "${INPUT_DEVICES}" | sed -n '1p')
usb_tablet_event=$(sed -n "${usb_tablet_line},\$s/H:\s*Handlers=\S\+\s*\(\S\+\).*/\1/p" "$INPUT_DEVICES" | sed -n '1p')
insert_block "${XORG_CONF}" '$' "\
Section \"InputDevice\"
Identifier \"UvpMouseEvent\"
Driver \"evdev\"
Option \"Device\" \"/dev/input/${usb_tablet_event}\"
EndSection" #syntax highlight"
### replace ServerLayout
server_layout_line=$(sed -n '/^\s*Section.*ServerLayout/=' "${XORG_CONF}" | sed -n '$p')
core_pointer_line=$(sed -n "${server_layout_line},/^\s*InputDevice.*CorePointer.*/=" "$XORG_CONF" | sed -n '$p')
comment_on_line "${XORG_CONF}" "${core_pointer_line}" ".*"
insert_block "${XORG_CONF}" "${core_pointer_line}" " InputDevice \"UvpMouseEvent\" \"CorePointer\""
}
RestoreXorg()
{
remove_block "${XORG_CONF}"
comment_off_line "${XORG_CONF}"
}
OPT_ACTION='install'
while getopts "u" option
do
case $option in
u)
OPT_ACTION='uninstall'
;;
*)
exit 1
;;
esac
done
if [ "$OPT_ACTION" = 'install' -a -n "$(sed -n '/QEMU/p' ${INPUT_DEVICES})" ]
then
ChangeXorg
else
RestoreXorg
fi
UVP-Tools-2.2.0.316/build_tools 0000664 0000000 0000000 00000032011 13140374466 0016042 0 ustar 00root root 0000000 0000000 #!/bin/bash
###############################################################################
###### File name : build_tools ######
###### Author : ######
###### Description : To build the UVP Tools for Linux distribution. ######
###### History : ######
###### 2012-02-24: Create the file ######
###### 2012-09-04: To support multi kernels in an OS, ######
###### 2012-12-24: Rename this script ######
###### build_xenpv -> build_tools ######
###### 2013-01-19: To support the PV OPS VMs ######
###############################################################################
# UVP Tools name & version
PACKAGE_NAME="uvp-tools-linux"
UVP_TOOLS_VERSION=""
# The target OS distribution in detail, such as rhel-5_series.
OS_RELEASE=""
OS_DIST=""
OS_DIST_SRC=""
# UVP-tools sources absolute path for linux.
DEV_CUR_DIR="`pwd`"
UVP_TOOLS_DIR=""
UVP_TOOLS_VER=""
CI_TAG_VER="2."
# Linux tools sources path.
DRV_SRC_DIR="`pwd`/uvp-xenpv"
SRV_SRC_DIR="`pwd`/uvp-monitor"
BIN_SRV="uvp-monitor"
BIN_SO="libxenstore.so"
KERN_VER="`uname -r`"
CPU_ARCH="`uname -m`"
SYS_BIT=""
# Prompt
BUILD_LOG="build_tools_"
BUILD_WARN="[ Warning ] ---"
BUILD_ERR="[ Error ] ---"
OPT_PARAMETER=""
case "$CPU_ARCH" in
i[3456789]86|x86)
SYS_BIT="32"
;;
x86_64|amd64)
SYS_BIT="64"
;;
*)
echo "$CPU_ARCH has been not supported!"
exit
esac
# help
usage()
{
echo "Usage: `basename $0` "
echo " Build the PV Drivers and uvp-monitor. "
echo " -b make all. "
echo " -c make clean. "
}
#
get_os_release()
{
if [ -f /etc/redhat-release ]; then
if [ "Fedora" == `cat /etc/redhat-release | awk -F" " '{print $1}'` ]; then
OS_RELEASE="Fedora"
else
OS_RELEASE="redhat"
fi
elif [ -f /etc/SuSE-release ]; then
if [ "openSUSE" == `cat /etc/SuSE-release | awk -F" " 'NR==1 {print $1}'` ]; then
OS_RELEASE="openSUSE"
else
OS_RELEASE="suse"
fi
elif [ -f /etc/debian_version ]; then
OS_RELEASE="`cat /etc/issue | awk -F" " '{print $1}'`"
elif [ -f /etc/gentoo-release ]; then
OS_RELEASE="Gentoo"
else
OS_RELEASE="unknown"
fi
}
get_os_distribution_info()
{
local ver_os_rel=""
get_os_release
if [ "redhat" == ${OS_RELEASE} ]; then
if [ -n "`uname -r | grep 2.6.18-SKL1.9.4.ky3.173.4.1`" ]; then
OS_DIST="RHEL5"
OS_DIST_SRC="others/RHEL5"
return
fi
ver_os_rel="`cat /etc/redhat-release | awk -F" " '{print $7}' | awk -F"." '{print $1}'`"
OS_DIST="RHEL${ver_os_rel}"
# For RHEL PV_OPS VMs which version had been greater than RHEL5.
if [ "5" -lt "${ver_os_rel}" ]; then
# For RHEL 6.0 VMs which version must be change manufacturer's kernel.
if [ "32-71" == "`uname -r | awk -F'.' '{printf $3}'`" ]; then
OS_DIST_SRC='others/Ubuntu10'
else
OS_DIST_SRC='uvp-pvops_xen_driver-2.6.32to4.0.x'
fi
else
# For OEL PV_OPS VM which version is OEL5.7\OEL5.8.
if [ "32-200" == "`uname -r | awk -F'.' '{printf $3}'`" ] || [ "32-300" == "`uname -r | awk -F'.' '{printf $3}'`" ]; then
OS_DIST_SRC='uvp-pvops_xen_driver-2.6.32to4.0.x'
else
OS_DIST_SRC="others/${OS_DIST}"
fi
fi
elif [ "Fedora" == ${OS_RELEASE} ]; then
ver_os_rel="`cat /etc/redhat-release | awk -F" " '{print $3}'`"
OS_DIST="FEDORA${ver_os_rel}"
if [ "12" -lt "${ver_os_rel}" ]; then
OS_DIST_SRC='others/Ubuntu10'
elif [ -n "`uname -r | grep "2.6.18-1.2798"`" ]; then
OS_DIST_SRC='others/RHEL5'
OS_DIST="FEDORA6"
else
OS_DIST_SRC="others/${OS_DIST}"
fi
elif [ "suse" == ${OS_RELEASE} ]; then
ver_os_rel="`cat /etc/SuSE-release | awk -F" " '{print $5}'`"
OS_DIST="SLES${ver_os_rel}"
if [ "SLES11" == ${OS_DIST} ]; then
OS_DIST_SRC="uvp-classic_xen_driver-2.6.32to3.0.x"
elif [ "SLES12" == ${OS_DIST} ]; then
OS_DIST_SRC="uvp-classic_xen_driver-3.12.xto3.16.x"
else
OS_DIST_SRC="others/${OS_DIST}"
fi
if [ -n "`uname -r | grep "2.6.29-bigsmp"`" ]; then
OS_DIST="SLES10"
OS_DIST_SRC="others/Ubuntu10"
fi
elif [ "openSUSE" == ${OS_RELEASE} ]; then
ver_os_rel="`cat /etc/SuSE-release | awk -F" " 'NR==1 {print $2}'`"
OS_DIST="openSUSE${ver_os_rel}"
OS_DIST_SRC='others/Ubuntu10'
if [ -n "`echo ${kernel_uname_release} | grep "3.16.6-2"`" ]; then
OS_DIST_SRC="uvp-classic_xen_driver-3.12.xto3.16.x"
fi
elif [ "Debian" == ${OS_RELEASE} ]; then
ver_os_rel="`cat /etc/issue | awk -F" " '{print $3}' | awk -F"." '{print $1}'`"
OS_DIST="Debian${ver_os_rel}"
# For Debian PV_OPS VMs which version had been greater than Ubuntu10.
if [ "6" -lt "${ver_os_rel}" ] || [ "6" -eq "${ver_os_rel}" -a -n "`uname -m | grep x86_64`" ]; then
OS_DIST_SRC='uvp-pvops_xen_driver-2.6.32to4.0.x'
else
OS_DIST_SRC='others/Ubuntu10'
fi
elif [ "Ubuntu" == ${OS_RELEASE} ]; then
if [ -n "`uname -r | grep 3.0.0-15`" ] || [ -n "`uname -r | grep 2.6.38-16-generic`" ]; then
OS_DIST="Ubuntu10"
OS_DIST_SRC="uvp-pvops_xen_driver-2.6.32to4.0.x"
return
fi
if [ -n "`uname -r | grep 2.6.31-14`" ]; then
OS_DIST="Ubuntu9"
OS_DIST_SRC="others/Ubuntu10"
return
fi
ver_os_rel="`cat /etc/issue | awk -F" " '{print $2}' | awk -F"." '{print $1}'`"
OS_DIST="Ubuntu${ver_os_rel}"
# For Ubuntu PV_OPS VMs which version had been greater than Ubuntu10.
if [ "10" -lt "${ver_os_rel}" ]; then
OS_DIST_SRC='uvp-pvops_xen_driver-2.6.32to4.0.x'
else
OS_DIST_SRC="others/${OS_DIST}"
fi
elif [ "Gentoo" == ${OS_RELEASE} ]; then
OS_DIST="Gentoo"
OS_DIST_SRC="uvp-pvops_xen_driver-2.6.32to4.0.x"
else
echo "Sorry, this Operating System could not support!"
fi
}
build_xenpv()
{
local build_ops=$1
local kern_ver=$2
local kern_dir="/lib/modules/$kern_ver/build"
local mod_dir="${UVP_TOOLS_DIR}/lib/modules/xvf-${kern_ver}-${CPU_ARCH}-${OS_DIST}/"
local mod_with_dir=""
cd ${DRV_SRC_DIR}/${OS_DIST_SRC}
if [ 'b' == ${build_ops} ]; then
mkdir -p ${mod_dir}
make all KERNDIR=${kern_dir} BUILDKERNEL=$(uname -r) CONFIG_DEBUG_SECTION_MISMATCH=y -s \
2>> ${BUILD_LOG}${OS_DIST}_xenpv.log
mod_with_dir="`find -name *.ko`"
for mod_xenpv in ${mod_with_dir}
do
cp --parents ${mod_xenpv} ${mod_dir}
done
elif [ 'c' == ${build_ops} ]; then
make clean KERNDIR=${kern_dir} BUILDKERNEL=$(uname -r) -s
else
echo "${BUILD_WARN} bad parameter, please show help."
fi
cd -
}
build_xenpv_alldist()
{
local build_ops=$1
local del_illegal_kern=""
for kernel in `ls /lib/modules/`
do
# When in the RHEL4 should not build the illegal kernel. ex. kabi-4.0.0/kabi-4.0.0smp
del_illegal_kern="`echo ${kernel} | awk -F"." '{print $1}'`"
standard_kern="`uname -r | awk -F"." '{print $1}'`"
if [ "${standard_kern}" != "${del_illegal_kern}" ]; then
continue
fi
echo "Starting to compile ${kernel} in the ${OS_DIST}: "
build_xenpv ${build_ops} ${kernel}
build_xenpv 'c' ${kernel}
done
}
hacking_driver_ver()
{
local mode_info=$1
local ver_file=$2
local base_ver_line=$(grep -n "MODULE_VERSION" ${ver_file} | head -1 | awk -F":" '{print $1}')
local hack_kver=$(cat "${DRV_SRC_DIR}/${osdir}/version.ini" | grep -w KernModeVersion | awk -F"=" '{print $2}')
local hack_uver=$(cat "${DRV_SRC_DIR}/${osdir}/version.ini" | grep -w UserModeVersion | awk -F"=" '{print $2}')
if [ "X" = "X${base_ver_line}" ]
then
#MODULE_VERSION("1");
if [ "kern" = "${mode_info}" ]
then
echo "MODULE_VERSION(\"${hack_kver}\");" >> ${ver_file}
else
echo "MODULE_VERSION(\"${hack_uver}\");" >> ${ver_file}
fi
else
base_ver=$(cat ${ver_file} | grep -w MODULE_VERSION | awk -F"\"" '{print $2}')
if [ "kern" = "${mode_info}" ]
then
sed -i "${base_ver_line}s;${base_ver};${hack_kver};" ${ver_file}
else
sed -i "${base_ver_line}s;${base_ver};${hack_uver};" ${ver_file}
fi
fi
}
build_server()
{
local build_ops=$1
local srv_dir="${UVP_TOOLS_DIR}/usr/bin${SYS_BIT}"
local srv_target="uvp-monitor-${SYS_BIT}"
local tools_arp="arping"
local tools_ndp="ndsend"
mkdir -p ${srv_dir}
cd ${SRV_SRC_DIR}
if [ 'a' == ${build_ops} ] || [ 'b' == ${build_ops} ]; then
make ${srv_target} 2>> ${BUILD_LOG}${OS_DIST}_monitor.log
cp -f ${srv_target} ${srv_dir}/${BIN_SRV}
cp -f ${tools_arp} ${srv_dir}/${tools_arp}
cp -f ${tools_ndp} ${srv_dir}/${tools_ndp}
elif [ 'c' == ${build_ops} ]; then
make clean
else
echo "$BUILD_WARN bad parameter, please show help."
exit
fi
cd -
}
get_init_scripts()
{
local dir_init_scripts="$UVP_TOOLS_DIR/etc"
cp -af $SRV_SRC_DIR/monitor/* $dir_init_scripts
}
get_runtime_libs()
{
local dir_dynamic_libs="${UVP_TOOLS_DIR}/usr/lib"
local mach_bit=`uname -m`
local libpath=""
if [ "x86_64" != "${mach_bit}" ]; then
dir_dynamic_libs="${UVP_TOOLS_DIR}/usr/lib32"
mach_bit="i386"
libpath="/usr/lib"
else
dir_dynamic_libs="${UVP_TOOLS_DIR}/usr/lib64"
libpath="/usr/lib64"
fi
mkdir -p ${dir_dynamic_libs}
cp -af ./uvp-monitor/xen-4.1.2/tools/xenstore/$BIN_SO.3.0.0 ${dir_dynamic_libs}/$BIN_SO
}
get_kernel_modules()
{
local dir_support_scripts="$UVP_TOOLS_DIR/bin"
local dir_offline_support="$UVP_TOOLS_DIR/bin/offline"
cp -af $DEV_CUR_DIR/bin/get_uvp_kernel_modules $dir_support_scripts
chmod 544 ${dir_support_scripts}/get_uvp_kernel_modules
#package disk unplug script
cp -af $DEV_CUR_DIR/bin/pvumount.sh $dir_support_scripts
chmod 544 ${dir_support_scripts}/pvumount.sh
#package CheckKernelUpdate script
cp -af $DEV_CUR_DIR/bin/CheckKernelUpdate.sh $dir_support_scripts
chmod 544 ${dir_support_scripts}/CheckKernelUpdate.sh
#package mem online script
cp -af $DEV_CUR_DIR/bin/mem_online.sh $dir_support_scripts
chmod 544 ${dir_support_scripts}/mem_online.sh
cp -af $DEV_CUR_DIR/bin/modify_swappiness.sh $dir_support_scripts
cp -af $DEV_CUR_DIR/bin/GuestOSFeature $dir_support_scripts
mkdir -p ${dir_offline_support}
cp -af $DEV_CUR_DIR/bin/offline_get_uvp_kernel_modules $dir_offline_support
chmod 544 ${dir_offline_support}/offline_get_uvp_kernel_modules
cp -af $DEV_CUR_DIR/bin/offline_copy_uvp_module $dir_offline_support
chmod 544 ${dir_offline_support}/offline_copy_uvp_module
}
build_tools()
{
local build_ops=$1
local ver_file="${DEV_CUR_DIR}/version.ini"
get_os_distribution_info
UVP_TOOLS_VER="`cat ${ver_file} | awk -F"=" 'NR==1 {print $2}'`"
UVP_TOOLS_DIR="${DEV_CUR_DIR}/${PACKAGE_NAME}-${CI_TAG_VER}${UVP_TOOLS_VER}"
mkdir -p ${UVP_TOOLS_DIR}
mkdir -p $UVP_TOOLS_DIR/bin \
$UVP_TOOLS_DIR/config \
$UVP_TOOLS_DIR/etc 2>/dev/null
build_xenpv_alldist ${build_ops}
build_server ${build_ops}
get_init_scripts
get_runtime_libs
get_kernel_modules
###
# To compress the Linux PV Driver into an iso
###
cp -r -f ${DEV_CUR_DIR}/config/ ${UVP_TOOLS_DIR}
cp -f ${DEV_CUR_DIR}/install ${UVP_TOOLS_DIR}
first_line="$(sed -n '/^\s*[^#]/=' ${UVP_TOOLS_DIR}/install | sed -n '1p')"
version_info="$(cat ${ver_file} | grep UVPToolsVersion | sed 's;UVPToolsVersion;INSTALL_VERSION;g')"
driver_info="$(cat ${ver_file} | grep DriverVersion | awk -F"-" '{print $1}' | sed 's;DriverVersion;DRIVER_VERSION;g')"
sed -i "${first_line} i${version_info}\n${driver_info}" "${UVP_TOOLS_DIR}/install"
chmod 744 ${UVP_TOOLS_DIR}/install
find ${UVP_TOOLS_DIR} -name .svn | xargs rm -rf
}
clean_tools()
{
local build_ops=$1
build_server ${build_ops}
rm -rf ${PACKAGE_NAME}*
}
for i in `ls`
do
ret=$(file $i | grep text)
if [ -n "$ret" ]
then
dos2unix $i 2>/dev/null
fi
done
while getopts "bc" options;
do
case $options in
b)
OPT_PARAMETER='b'
build_tools $OPT_PARAMETER
;;
c)
OPT_PARAMETER='c'
clean_tools $OPT_PARAMETER
;;
*)
usage
exit 0
;;
esac
done
UVP-Tools-2.2.0.316/config/ 0000775 0000000 0000000 00000000000 13140374466 0015050 5 ustar 00root root 0000000 0000000 UVP-Tools-2.2.0.316/config/udev/ 0000775 0000000 0000000 00000000000 13140374466 0016013 5 ustar 00root root 0000000 0000000 UVP-Tools-2.2.0.316/config/udev/60-xen-storage.rules 0000664 0000000 0000000 00000001305 13140374466 0021545 0 ustar 00root root 0000000 0000000 ###
KERNEL=="xvd*", IMPORT{program}="%XEN_ID% $kernel"
###KERNEL=="xvdd", SYMLINK+="cdrom"
KERNEL=="xvd*[!0-9]", ENV{EMU_SERIAL}=="?*", SYMLINK+="$env{EMU_KERNEL}"
KERNEL=="xvd*[!0-9]", ENV{EMU_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{EMU_BUS}-$env{EMU_MODEL}_$env{EMU_SERIAL}"
KERNEL=="xvd*[!0-9]", ENV{EMU_BUS2}=="?*", SYMLINK+="disk/by-id/$env{EMU_BUS2}-$env{EMU_MODEL2}_$env{EMU_SERIAL}"
KERNEL=="xvd*[0-9]", ENV{EMU_SERIAL}=="?*", SYMLINK+="$env{EMU_KERNEL}%n"
KERNEL=="xvd*[0-9]", ENV{EMU_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{EMU_BUS}-$env{EMU_MODEL}_$env{EMU_SERIAL}-part%n"
KERNEL=="xvd*[0-9]", ENV{EMU_BUS2}=="?*", SYMLINK+="disk/by-id/$env{EMU_BUS2}-$env{EMU_MODEL2}_$env{EMU_SERIAL}-part%n"
UVP-Tools-2.2.0.316/config/udev/60-xen-storage.rules.legacy 0000664 0000000 0000000 00000003324 13140374466 0023013 0 ustar 00root root 0000000 0000000 ### devices
KERNEL="xvda", SYMLINK="hda"
KERNEL="xvdb", SYMLINK="hdb"
KERNEL="xvdc", SYMLINK="hdc"
#KERNEL="xvdd", SYMLINK="cdrom"
KERNEL="xvde", SYMLINK="hde"
KERNEL="xvdf", SYMLINK="hdf"
KERNEL="xvdg", SYMLINK="hdg"
KERNEL="xvdh", SYMLINK="hdh"
KERNEL="xvdi", SYMLINK="hdi"
KERNEL="xvdj", SYMLINK="hdj"
KERNEL="xvdk", SYMLINK="hdk"
KERNEL="xvdl", SYMLINK="hdl"
KERNEL="xvdm", SYMLINK="hdm"
KERNEL="xvdn", SYMLINK="hdn"
KERNEL="xvdo", SYMLINK="hdo"
KERNEL="xvdp", SYMLINK="hdp"
KERNEL="xvdq", SYMLINK="hdq"
KERNEL="xvdr", SYMLINK="hdr"
KERNEL="xvds", SYMLINK="hds"
KERNEL="xvdt", SYMLINK="hdt"
KERNEL="xvdu", SYMLINK="hdu"
KERNEL="xvdv", SYMLINK="hdv"
KERNEL="xvdw", SYMLINK="hdw"
KERNEL="xvdx", SYMLINK="hdx"
KERNEL="xvdy", SYMLINK="hdy"
KERNEL="xvdz", SYMLINK="hdz"
### partitions
KERNEL="xvda[0-9]*", SYMLINK="hda%n"
KERNEL="xvdb[0-9]*", SYMLINK="hdb%n"
KERNEL="xvdc[0-9]*", SYMLINK="hdc%n"
#KERNEL="xvdd[0-9]*", SYMLINK="hdd%n"
KERNEL="xvde[0-9]*", SYMLINK="hde%n"
KERNEL="xvdf[0-9]*", SYMLINK="hdf%n"
KERNEL="xvdg[0-9]*", SYMLINK="hdg%n"
KERNEL="xvdh[0-9]*", SYMLINK="hdh%n"
KERNEL="xvdi[0-9]*", SYMLINK="hdi%n"
KERNEL="xvdj[0-9]*", SYMLINK="hdj%n"
KERNEL="xvdk[0-9]*", SYMLINK="hdk%n"
KERNEL="xvdl[0-9]*", SYMLINK="hdl%n"
KERNEL="xvdm[0-9]*", SYMLINK="hdm%n"
KERNEL="xvdn[0-9]*", SYMLINK="hdn%n"
KERNEL="xvdo[0-9]*", SYMLINK="hdo%n"
KERNEL="xvdp[0-9]*", SYMLINK="hdp%n"
KERNEL="xvdq[0-9]*", SYMLINK="hdq%n"
KERNEL="xvdr[0-9]*", SYMLINK="hdr%n"
KERNEL="xvds[0-9]*", SYMLINK="hds%n"
KERNEL="xvdt[0-9]*", SYMLINK="hdt%n"
KERNEL="xvdu[0-9]*", SYMLINK="hdu%n"
KERNEL="xvdv[0-9]*", SYMLINK="hdv%n"
KERNEL="xvdw[0-9]*", SYMLINK="hdw%n"
KERNEL="xvdx[0-9]*", SYMLINK="hdx%n"
KERNEL="xvdy[0-9]*", SYMLINK="hdy%n"
KERNEL="xvdz[0-9]*", SYMLINK="hdz%n"
UVP-Tools-2.2.0.316/config/udev/xen.agent 0000664 0000000 0000000 00000000262 13140374466 0017625 0 ustar 00root root 0000000 0000000 #!/bin/sh
case "$ACTION" in
add)
devtype=$(cat /sys/$DEVPATH/devtype)
# echo -ne "\r\n### $0 debug: modprobe xen:$devtype ###\r\n" >/dev/console
modprobe xen:$devtype
;;
esac
UVP-Tools-2.2.0.316/config/udev/xen_id 0000664 0000000 0000000 00000004044 13140374466 0017206 0 ustar 00root root 0000000 0000000 #!/bin/bash
shopt -u expand_aliases
###############################################################################
# main entrance
###############################################################################
function abort
{
exit 1
}
function finish
{
exit 0
}
### parse options
while [ $OPTIND -le $# ]
do
while getopts "b:" option
do
case $option in
b)
PARAM_EMU_BUS="$OPTARG"
;;
*)
abort
;;
esac
done
if [ $OPTIND -gt $# ]
then
break
fi
if [ -z $PARAM_DEV_NAME ]
then
eval PARAM_DEV_NAME=$`echo $OPTIND`
OPTIND=$((OPTIND + 1))
else
abort
fi
done
[ -z "$PARAM_DEV_NAME" -o -z "$PARAM_EMU_BUS" ] && abort
[ "$PARAM_DEV_NAME" = "xvdd" ] && finish
PARAM_DEV_NAME=$(echo -n "$PARAM_DEV_NAME" | sed "s;[0-9]*$;;g")
emu_type="disk"
emu_bus="$PARAM_EMU_BUS"
###
id_serial=$(echo "$PARAM_DEV_NAME" | sed -n '/^xvd[a-z]\+[0-9]*$/p' | sed "s;^xvd\([a-z]\+\)[0-9]*$;\1;g")
[ -z "$id_serial" ] && abort
if [ "$emu_bus" = "ata" ]
then
emu_kernel="hd${id_serial}"
emu_model="QEMU_HARDDISK"
elif [ "$emu_bus" = "scsi" ]
then
emu_kernel="sd${id_serial}"
emu_model="SATA_QEMU_HARDDISK"
else
abort
fi
###
id_serial_num=0
alpha_scale=1
for n in `echo -n "$id_serial" | sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' | sed "s;\([a-z]\);\1 ;g"`
do
id_serial_num=$(( id_serial_num + (`printf "%d" "'$n"` - `printf "%d" "'a"` + 1) * alpha_scale))
alpha_scale=$((alpha_scale * 26))
done
emu_serial="$(printf 'QM%05d' $id_serial_num)"
### export information
printf "EMU_TYPE='%s' \n" $emu_type
printf "EMU_MODEL='%s' \n" $emu_model
printf "EMU_SERIAL='%s' \n" $emu_serial
printf "EMU_BUS='%s' \n" $emu_bus
printf "EMU_KERNEL='%s' \n" $emu_kernel
if [ "$emu_bus" = "scsi" ]
then
printf "EMU_BUS2='%s' \n" $(echo -n "$emu_bus" | sed "s;scsi;ata;g")
printf "EMU_MODEL2='%s' \n" $(echo -n "$emu_model" | sed "s;^SATA_;;g")
else
printf "EMU_BUS2='' \n"
printf "EMU_MODEL2='' \n"
fi
UVP-Tools-2.2.0.316/cpfile.sh 0000664 0000000 0000000 00000017247 13140374466 0015414 0 ustar 00root root 0000000 0000000 #!/bin/bash
#####################################################
# Date: 2011-6-7
# Description: cp upgrade file
# support redhat5.3_32,suse11
# History:
# Date: 2011-6-24
# 1redhatϵͳΪredhat$_centos$
# 2ϵͳ
###################################################
OS_VERSION=`uname -r`
OS_RELEASE=""
MOUNT_DIR=`dirname $0`
tar_file=""
UPGRADE_LOG=/etc/.tools_upgrade/pv_upgrade.log
DEST_DIR=/tmp/uvptools_temp
PATH=$PATH:/bin:/sbin:/usr/sbin:/usr/bin
BINARY='/usr/bin/uvp-monitor'
TMP_FILE=/tmp/pv_temp_file
####add for optimize upgrade
SYS_TYPE=""
####added end
v_min_size=40960
ALIAS_CP=0
ALIAS_MV=0
ALIAS_RM=0
PIDFILE=$(basename "$BINARY")
if [ -f /etc/redhat-release -o -n "$(grep -i 'GreatTurbo' /etc/issue)" ]
then
PIDFILE="/var/lock/subsys/$PIDFILE"
elif [ -f /etc/SuSE-release ]
then
PIDFILE="/var/run/$PIDFILE"
elif [ -f /etc/debian_version ]
then
PIDFILE="/var/run/$PIDFILE"
else
if [ -d /var/run -a -w /var/run ]
then
PIDFILE="/var/run/$PIDFILE"
fi
fi
cpu_arch_width=""
CPU_ARCH="$(uname -m)"
case "$CPU_ARCH" in
i[3456789]86|x86)
cpu_arch_width="32"
;;
x86_64|amd64)
cpu_arch_width="64"
;;
*)
echo "$(date +%x-%X) Can not determine processor type" >> ${UPGRADE_LOG}
exit 1
esac
# check upgrade package
function check_exit()
{
tar_file=uvp-tools-*.tar.bz2
if [ ! -f ${MOUNT_DIR}/${tar_file} ]; then
echo "$(date +%x-%X) uvp-tools.tar.bz2 no exist" >> ${UPGRADE_LOG}
exit 1
fi
}
# remove -i
function modify_alias()
{
alias | grep "cp -i" >/dev/null 2>&1
if [ $? -eq 0 ];then
alias cp='cp'
ALIAS_CP=1
fi
alias | grep "mv -i" >/dev/null 2>&1
if [ $? -eq 0 ];then
alias mv='mv'
ALIAS_MV=1
fi
alias | grep "rm -i" >/dev/null 2>&1
if [ $? -eq 0 ];then
alias rm='rm'
ALIAS_RM=1
fi
}
# restore alias
function restore_alias()
{
if [ $ALIAS_CP -eq 1 ];then
alias cp='cp -i'
fi
if [ $ALIAS_MV -eq 1 ];then
alias mv='mv -i'
fi
if [ $ALIAS_RM -eq 1 ];then
alias rm='rm -i'
fi
}
####added for check linux distribution to obtain SYS_TYPE
function check_distribution()
{
local issue
###determine linux distribution
issue='/etc/issue'
if [ -e '/etc/debian_version' -o -n "$(grep -i 'debian' $issue)" ]
then
SYS_TYPE='debian'
elif [ -e '/etc/redhat-release' -o -n "$(grep -i 'red *hat' $issue)" -o -n "$(grep -i 'GreatTurbo' $issue)" ]
then
SYS_TYPE='redhat'
elif [ -e '/etc/SuSE-release' -o -n "$(grep -i 'suse\|s\.u\.s\.e' $issue)" ]
then
SYS_TYPE='suse'
elif [ -e '/etc/gentoo-release' ]
then
SYS_TYPE='gentoo'
else
echo "$(date +%x-%X) cannot determine linux distribution." >> ${UPGRADE_LOG}
exit 1
fi
}
###added end
function main()
{
modify_alias
check_exit
check_distribution
###get install package full name such as uvp-tools-linux-1.3.0.13-164.tar.bz2
tar_file_basename=`basename ${MOUNT_DIR}/${tar_file}`
echo "cpfile:$(date +%x-%X) tar_file_basename ${tar_file_basename}" >> ${UPGRADE_LOG}
###get uvp-tools file name such as uvp-tools-linux-1.3.0.13-164
tar_uvpversion=$(echo ${tar_file_basename} | sed "s/.tar.bz2//g")
echo "cpfile:$(date +%x-%X) tar_uvpversion ${tar_uvpversion}" >> ${UPGRADE_LOG}
###get xvf_modules_path such as /mnt/pvmount/lib/modules/xvf-2.6.18-128.el5-i686-RHEL5
xvf_modules_path=$(. ${MOUNT_DIR}/get_uvp_kernel_modules "$SYS_TYPE" "$(uname -r)" "$(uname -m)")
echo "cpfile:$(date +%x-%X) xvf_modules_path ${xvf_modules_path}" >> ${UPGRADE_LOG}
###get xvf_modules_path basename such as xvf-2.6.18-128.el5-i686-RHEL5
xvf_modules=`basename ${xvf_modules_path}`
echo "cpfile:$(date +%x-%X) xvf_modules ${xvf_modules}" >> ${UPGRADE_LOG}
echo "$(date +%x-%X) start run cpfile.sh." >> ${UPGRADE_LOG}
v_avail=`df / | grep "[0-9]%" | sed "s/%.*//" | awk '{print $(NF-1)}'`
if [ "${v_avail}" -lt "${v_min_size}" ];then
echo "$(date +%x-%X) The disk space is not enough to install." >> ${UPGRADE_LOG}
exit 1
fi
chattr -i ${DEST_DIR} 2>/dev/null
find ${DEST_DIR}/pvdriver -type f | xargs chattr -i 2>/dev/null
rm -rf ${DEST_DIR}/pvdriver 2>/dev/null
rm -rf ${DEST_DIR}/uvp-tools-* 2>/dev/null
mkdir -p ${DEST_DIR} 2>/dev/null
####modified for optimization : tar the system needed file
tar -jxf ${MOUNT_DIR}/${tar_file_basename} -C ${DEST_DIR} ./${tar_uvpversion}/bin ./${tar_uvpversion}/config ./${tar_uvpversion}/install ./${tar_uvpversion}/usr ./${tar_uvpversion}/etc ./${tar_uvpversion}/lib/modules/$xvf_modules 1>/dev/null 2>&1
####modified end
if [ $? -ne 0 ];then
echo "$(date +%x-%X) tar -jxf files failed!" >> ${UPGRADE_LOG}
restore_alias
exit 1
fi
mv ${DEST_DIR}/uvp-tools-* ${DEST_DIR}/pvdriver 1>/dev/null 2>&1
if [ $? -ne 0 ];then
echo "$(date +%x-%X) mv ${DEST_DIR}/uvp-tools-* failed!" >> ${UPGRADE_LOG}
restore_alias
exit 1
fi
cp -f ${MOUNT_DIR}/upg.sh ${DEST_DIR}/pvdriver 1>/dev/null 2>&1
if [ $? -ne 0 ];then
echo "$(date +%x-%X) mv ${DEST_DIR}/uvp-tools-* failed!" >> ${UPGRADE_LOG}
restore_alias
exit 1
fi
dos2unix /tmp/uvptools_temp/pvdriver/upg.sh 1> /dev/null 2>&1
chmod +x /tmp/uvptools_temp/pvdriver/upg.sh 2> /dev/null
chattr +i ${DEST_DIR} 2>/dev/null
find ${DEST_DIR}/pvdriver -type f | xargs chattr +i 2>/dev/null
if [ "$?" != "0" ]
then
touch ${TMP_FILE} 2>/dev/null
if [ $? -ne 0 ];then
echo "$(date +%x-%X) touch ${TMP_FILE} failed!" >> ${UPGRADE_LOG}
restore_alias
rm -f "${TMP_FILE}" 2>/dev/null
exit 1
fi
echo "$(date +%x-%X) copy uvp-monitor begin" >> $UPGRADE_LOG
cp -f ${DEST_DIR}/pvdriver/usr/bin${cpu_arch_width}/uvp-monitor ${BINARY} 1>/dev/null 2>&1
if [ $? -ne 0 ];then
echo "$(date +%x-%X) copy uvp-monitor failed!" >> ${UPGRADE_LOG}
restore_alias
rm -f "${TMP_FILE}" 2>/dev/null
exit 1
else
echo "$(date +%x-%X) copy uvp-monitor ok!" >> $UPGRADE_LOG
fi
old_ppid=`ps -ef |grep ${BINARY} |grep -v grep | awk '{print $2}' | sort -nu | head -1`
echo "$(date +%x-%X) old_ppid is ${old_ppid}, restart uvp-monitor begin" >> ${UPGRADE_LOG}
#/etc/init.d/uvp-monitor restart
kill -15 ${old_ppid}
rm -f "${PIDFILE}" 2>/dev/null
pid_num=`ps -ef |grep ${BINARY} |grep -v grep | awk '{print $2}' | sort -nu | wc -l`
if [ "${pid_num}" != "0" ];then
echo "$(date +%x-%X) kill -15 failed, try again." >> ${UPGRADE_LOG}
ppid=`ps -ef |grep ${BINARY} |grep -v grep | awk '{print $2}' | sort -nu | head -1`
kill -9 ${ppid}
rm -f "${PIDFILE}" 2>/dev/null
fi
sleep 1
#${BINARY} #exec uvp-monitor now
/etc/init.d/uvp-monitor restart
#service uvp-monitor restart
new_ppid=`ps -ef |grep ${BINARY} |grep -v grep | awk '{print $2}' | sort -nu | head -1`
pid_num=`ps -ef |grep ${BINARY} |grep -v grep | awk '{print $2}' | sort -nu | wc -l`
if [ -z "${new_ppid}" ] || [ "${old_ppid}" = "${new_ppid}" ] || [ "${pid_num}" = "0" ];then
echo "$(date +%x-%X) new_ppid is ${new_ppid}, restart uvp-monitor failed" >> ${UPGRADE_LOG}
restore_alias
rm -f "${TMP_FILE}" 2>/dev/null
exit 1
else
echo $new_ppid > $PIDFILE
echo "$(date +%x-%X) new_ppid is ${new_ppid}, restart uvp-monitor ok" >> ${UPGRADE_LOG}
fi
fi
echo "$(date +%x-%X) copy file successful" >> $UPGRADE_LOG
restore_alias
}
main
UVP-Tools-2.2.0.316/docs/ 0000775 0000000 0000000 00000000000 13140374466 0014533 5 ustar 00root root 0000000 0000000 UVP-Tools-2.2.0.316/docs/Bug List of Linux Distributions.xlsx 0000664 0000000 0000000 00000066736 13140374466 0023376 0 ustar 00root root 0000000 0000000 PK % J _rels/.relsN0{*5@LH!4$năDÎq~bLn,0&K^UY&c}qy/6͢~8GRoC*rOJAʤ{tJ
MKcd =@r]Uw2dYqgVMmk5nIz>3W"!vJL|8
e
ye}0HM!ӷ!阘rpbͼ0gt{M#}HL3_JZPK4 PK % J docProps/custom.xmlkH0LM"מ'
(@)Ƚ
6ߗuMv;q@"qp܇I# $dƌF@b&N+,!B1 ssb?I,f;o9IN[E`L/rػWIZorsQ7ȷ#JC0M'M M%pM'K5ҷH@\GIS=O=E1GI=_?=gd:@ݱG;ܧ_ޑ3nP'.$E$;~n!a97.sg({3 =;3oC$MHbZt]+v5*?(R>N;Ȧ\eJljȬUcg:0T]ه*פ9>\qI|h͆2? bP`縴mל-
\_JeDӫ/~xЈT _|W]@aC7=E~`d_bFH4)©PEIcpuSA^Z-ie0 Kda?zixH74~PKȓ ( PK % J docProps/app.xmlOO0|*ڵMTS 8MCAܪ[P)qۓ~lXS &]OnWz>)
zrD6E TdK=#5ITeeg
2&-قCuKaAp
T@G\P1Cq6
F pF/QA[mgC0Z
̑WMP5v2~vWcӬ*Fa^b?PKTQ { PK % J docProps/core.xml}RN0OpHm+VJ&$@܌3m]DzݍIP6342W#D[DH4:
Fh㳡LM8 6F2Ghf[ۖW(OsqS 8pqa,XIKD`H!,-LfO>(#e&^IiM6ꝕpݶR5X 0a;Hor5Ҟ\Ϧ(텤RF,
a&j%
oA]҆)T XavC