refs #273 adds client directory to ogboot installer
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -0,0 +1,12 @@
|
|||
OpenGnsys Client README
|
||||
=========================
|
||||
|
||||
|
||||
Este directorio contiene la estructura de datos del cliente OpenGnsys.
|
||||
|
||||
- boot-tools herramientas para generar la distribución de OpenGnsys Client.
|
||||
- browser código fuente del cliente gráfico OpenGnsys Browser.
|
||||
- engine funciones del motor (se instalará en el servidor en
|
||||
/opt/opengneys/client/lib/engine).
|
||||
- shared estructura principal del cliente exportado por NFS o Samba
|
||||
(se instalará en el servidor en /opt/opengneys/client).
|
|
@ -0,0 +1,439 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file Cache.lib
|
||||
#@brief Librería o clase Cache
|
||||
#@class Cache
|
||||
#@brief Funciones para gestión de la caché local de disco.
|
||||
#@version 1.1.1
|
||||
#@warning License: GNU GPLv3+
|
||||
#*/
|
||||
|
||||
|
||||
#/**
|
||||
# ogCreateCache [int_ndisk] int_partsize
|
||||
#@brief Define la caché local, por defecto en partición 4 del disco 1.
|
||||
#@param int_ndisk numero de disco donde crear la cache, si no se indica es el 1 por defecto
|
||||
#@param int_npart número de partición (opcional, 4 por defecto)
|
||||
#@param int_partsize tamaño de la partición (en KB)
|
||||
#@return (nada, por determinar)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@note Requisitos: sfdisk, parted, awk, sed
|
||||
#@warning El tamaño de caché debe estar entre 50 MB y la mitad del disco.
|
||||
#@warning La caché no puede solaparse con las particiones de datos.
|
||||
#@version 0.9.1 - Definición de caché local.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/03/09
|
||||
#@version 0.9.2 - Corrección definición de límites.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/06/01
|
||||
#@version 1.0.4 - Soporte para discos GPT.
|
||||
#@author Universidad de Huelva
|
||||
#@date 2012/03/13
|
||||
#@version 1.0.5 - Posibilidad de crear la cache en cualquier disco duro
|
||||
#@author Universidad de Huelva
|
||||
#@date 2012/09/18
|
||||
#@version 1.1.0 - Posibilidad de crear la caché en cualquier partición.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2016/05/25
|
||||
#@version 1.1.0 - Soporte discos con sectores de 4k
|
||||
#@date 2017/01/09
|
||||
#@version 1.0.6b - Al crear las particiones ordenamos los dispositivos en el fichero auxiliar.
|
||||
#@author Irina Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2017/01/09
|
||||
#*/ ##
|
||||
function ogCreateCache ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FINDCACHE IOSIZE NDSK SIZECACHE PART DISK START END ENDPREVPART SIZE MINSIZE MAXSIZE
|
||||
local PTTYPE ID TMPFILE NVME_PREFIX
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [int_ndisk [int_npart]] int_partsize" \
|
||||
"$FUNCNAME 10000000" "$FUNCNAME 1 10000000" "$FUNCNAME 1 4 10000000"
|
||||
return
|
||||
fi
|
||||
# Si se recibe un parametro, sera el tamano de la cache
|
||||
case $# in
|
||||
1) # Error, si no es un entero positivo
|
||||
[[ $1 =~ ^[1-9][0-9]*$ ]] || ogRaiseError $OG_ERR_FORMAT "$1" || return $?
|
||||
NDSK=1
|
||||
PART=4
|
||||
SIZECACHE=$1
|
||||
;;
|
||||
2) # Error, si no son enteros positivos
|
||||
[[ $1 =~ ^[1-9][0-9]*$ ]] || ogRaiseError $OG_ERR_FORMAT "$1" || return $?
|
||||
[[ $2 =~ ^[1-9][0-9]*$ ]] || ogRaiseError $OG_ERR_FORMAT "$2" || return $?
|
||||
NDSK=$1
|
||||
PART=4
|
||||
SIZECACHE=$2
|
||||
;;
|
||||
3) # Error, si no son enteros positivos
|
||||
[[ $1 =~ ^[1-9][0-9]*$ ]] || ogRaiseError $OG_ERR_FORMAT "$1" || return $?
|
||||
[[ $2 =~ ^[1-9][0-9]*$ ]] || ogRaiseError $OG_ERR_FORMAT "$2" || return $?
|
||||
[[ $3 =~ ^[1-9][0-9]*$ ]] || ogRaiseError $OG_ERR_FORMAT "$3" || return $?
|
||||
NDSK=$1
|
||||
PART=$2
|
||||
SIZECACHE=$3
|
||||
;;
|
||||
*) ogRaiseError $OG_ERR_FORMAT
|
||||
return $?
|
||||
;;
|
||||
esac
|
||||
|
||||
TMPFILE=/tmp/sfdisk$$
|
||||
DISK=$(ogDiskToDev $NDSK) || return $?
|
||||
|
||||
# PATCH Para discos nvme la particion debe ser p1, p2, etc...en lugar de 1,2, sino falla sfdisk
|
||||
NVME_PREFIX=""
|
||||
if [[ $DISK == *"nvme"* ]]; then
|
||||
NVME_PREFIX="p"
|
||||
fi
|
||||
|
||||
|
||||
END=$[$(ogGetLastSector $NDSK 2>/dev/null)] # Sector final del disco.
|
||||
SIZE=$[$SIZECACHE*2] # Tamaño en sectores de 512 B.
|
||||
# Inicio partición cache según el disco tenga sectores de 4k o menores
|
||||
IOSIZE=$(fdisk -l $DISK | awk '/I\/O/ {print $4}')
|
||||
if [ $IOSIZE -eq 4096 ]; then
|
||||
END=$[$END-8192]
|
||||
START=$[END-SIZE+2048-(END-SIZE)%2048]
|
||||
else
|
||||
START=$[END-SIZE+1]
|
||||
fi
|
||||
ENDPREVPART=$[$(ogGetLastSector $NDSK $[PART-1] 2>/dev/null)]
|
||||
# Error si tamaño no está entre límites permitidos o si se solapa con la partición anterior.
|
||||
MINSIZE=25000 # Error de formateo si tamaño < 50 MB.
|
||||
MAXSIZE=$END # Para restringir tamaño > mitad del disco: MAXSIZE=$[END/2]
|
||||
if [ $SIZE -lt $MINSIZE -o $SIZE -gt $MAXSIZE -o $START -le $ENDPREVPART ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$1" || return $?
|
||||
fi
|
||||
|
||||
# Desmontar todos los sistemas de archivos del disco.
|
||||
ogUnmountAll $NDSK 2>/dev/null
|
||||
# Definir particiones y notificar al kernel.
|
||||
# En el caso de ser disco GPT, de momento se borra la particion y se vuelve a crear,
|
||||
# por lo que se pierden los datos.
|
||||
PTTYPE=$(ogGetPartitionTableType $NDSK)
|
||||
if [ -z "$PTTYPE" ]; then
|
||||
PTTYPE="MSDOS" # Por defecto para discos vacíos.
|
||||
ogCreatePartitionTable $NDSK $PTTYPE
|
||||
fi
|
||||
case "$(ogGetPartitionTableType $NDSK)" in
|
||||
GPT)
|
||||
# Si la tabla de particiones no es valida, volver a generarla.
|
||||
[ ! $(sgdisk -p $DISK &>/dev/null) ] || echo -e "2\nw\nY\n" | gdisk $DISK
|
||||
# Si existe la cache se borra previamente
|
||||
[ -n "$(ogFindCache)" ] && ogDeleteCache
|
||||
# Capturamos el codigo de particion GPT para cache
|
||||
# PATCH - Cuando es GPT, la particion con codigo CACHE (CA00) no existe y no puede crearse, se cambia por LINUX (8300)
|
||||
ID=$(ogTypeToId LINUX GPT)
|
||||
sgdisk $DISK -n$PART:$START:$END -c$PART:CACHE -t$PART:$ID 2>/dev/null
|
||||
;;
|
||||
MSDOS)
|
||||
# Si la tabla de particiones no es valida, volver a generarla.
|
||||
parted -s $DISK print &>/dev/null || fdisk $DISK <<< "w"
|
||||
# Definir particiones y notificar al kernel.
|
||||
ID=$(ogTypeToId CACHE MSDOS)
|
||||
# Salvamos la configuración de las particiones e incluimos la cache.
|
||||
trap "rm -f $TMPFILE" 1 2 3 9 15
|
||||
sfdisk --dump $DISK | grep -v $DISK$PART > $TMPFILE
|
||||
echo "$DISK$NVME_PREFIX$PART : start= $START, size= $SIZE, Id=$ID" >> $TMPFILE
|
||||
# Ordenamos las líneas de los dispositivos
|
||||
UNIT=$(grep unit $TMPFILE)
|
||||
grep ^/dev $TMPFILE|sort -o $TMPFILE
|
||||
sed -i "1i $UNIT\n" $TMPFILE
|
||||
# Guardamos nueva configuración en el disco.
|
||||
sfdisk --no-reread $DISK < $TMPFILE
|
||||
rm -f $TMPFILE
|
||||
;;
|
||||
esac
|
||||
# Actualiza la tabla de particiones en el kernel.
|
||||
ogUpdatePartitionTable
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogDeleteCache
|
||||
#@brief Elimina la partición de caché local.
|
||||
#@return (nada, por determinar)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@note Requisitos: fdisk, sgdisk, partprobe
|
||||
#@version 0.91 - Definición de caché local.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/03/11
|
||||
#@version 1.0.4 - Soporte para discos GPT.
|
||||
#@author Universidad de Huelva
|
||||
#@date 2012/03/13
|
||||
#@version 1.0.6b - llamada correcta a ogUpdatePartitionTable
|
||||
#@author Antonio Doblas Universidad de Málaga
|
||||
#@date 2016/11/16
|
||||
#@version 1.1.0 - Sustituir "sfdisk" por "fdisk" para discos MSDOS.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2016/05/25
|
||||
#*/ ##
|
||||
function ogDeleteCache ()
|
||||
{
|
||||
# Variables locales.
|
||||
local NDISK NPART DISK
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
# Error si no se encuentra partición de caché.
|
||||
read NDISK NPART <<<"$(ogFindCache)"
|
||||
[ -n "$NDISK" -a -n "$NPART" ] || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
|
||||
DISK=$(ogDiskToDev $NDISK)
|
||||
|
||||
# Desmontar todos los sistemas de archivos del disco.
|
||||
ogUnmountAll $NDISK 2>/dev/null
|
||||
case "$(ogGetPartitionTableType $NDISK)" in
|
||||
GPT)
|
||||
# Si la tabla de particiones no es valida, volver a generarla.
|
||||
[ ! $(sgdisk -p $DISK 2>&1 >/dev/null) ] || echo -e "2\nw\nY\n" | gdisk $DISK
|
||||
sgdisk $DISK -d$NPART 2>/dev/null
|
||||
;;
|
||||
MSDOS)
|
||||
# Si la tabla de particiones no es valida, volver a generarla.
|
||||
parted -s $DISK print &>/dev/null || fdisk $DISK <<< "w"
|
||||
# Eliminar la partición de caché.
|
||||
echo -e "d\n$NPART\nw" | fdisk $DISK 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
# Borrar etiqueta de la caché.
|
||||
rm -f /dev/disk/by-label/CACHE
|
||||
#Actualiza la tabla de particiones en el kernel.
|
||||
ogUpdatePartitionTable $NDISK
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogFindCache
|
||||
#@brief Detecta la partición caché local.
|
||||
#@param No requiere parametros
|
||||
#@return int_ndisk int_npart - devuelve el par nº de disco-nº de partición .
|
||||
#@warning Si no hay cache no devuelve nada
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: FindCache() en ATA.lib - HIDRA: DetectarCache.sh
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@Date 2008/06/19
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@Date 2008/10/27
|
||||
#@version 0.91 - Adaptacion a la cache local de OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/03/16
|
||||
#@version 1.0.5 - Obtener caché en discos GPT.
|
||||
#@author Alberto García, Universidad de Málaga y Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014/05/28
|
||||
#*/ ##
|
||||
function ogFindCache ()
|
||||
{
|
||||
# Variables locales
|
||||
local DISK PART
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 1 4"
|
||||
return
|
||||
fi
|
||||
# Obtener el dispositivo del sistema de archivos etiquetado como "CACHE".
|
||||
PART=$(blkid -L "CACHE")
|
||||
# En discos nvme con particiones GPT la partición se detecta usando el tag PARTLABEL
|
||||
PART=${PART:-$(blkid -t PARTLABEL=CACHE | awk -F: '{print $1}')}
|
||||
# Si no se detecta, obtener particiones marcadas de tipo caché en discos MSDOS.
|
||||
PART=${PART:-$(sfdisk -l 2>/dev/null | awk '$6~/ca|a7/ {print $1}')}
|
||||
|
||||
# Por último revisar todos los discos GPT y obtener las particiones etiquetadas como caché.
|
||||
if [ -z "$PART" ]; then
|
||||
for DISK in $(ogDiskToDev); do
|
||||
# Nota: se añade espacio separador solo si existe valor previo.
|
||||
PART="${PART:+"$PART "}$(sgdisk -p $DISK 2>/dev/null | awk -v d=$DISK '$7~/CACHE/ {printf "%s%s",d,$1;}')"
|
||||
done
|
||||
fi
|
||||
|
||||
# Devolver número de disco y número de partición de la 1ª partición encontrada.
|
||||
ogDevToDisk ${PART%% *} 2>/dev/null
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogFormatCache
|
||||
#@brief Formatea el sistema de ficheros para la caché local.
|
||||
#@return (por determinar)
|
||||
#@warning Prueba con formato Reiser.
|
||||
#@attention
|
||||
#@note El sistema de archivos de la caché se queda montado.
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: FormatCache() en ATA.lib
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 2008/10/27
|
||||
#@version 0.91 - Creacion cache local.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-03-11
|
||||
#@version 1.1.0 - llamada a updateBootCache.
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 2018-01-21
|
||||
|
||||
#*/ ##
|
||||
function ogFormatCache ()
|
||||
{
|
||||
# Variables locales.
|
||||
local DEV MNTDIR OPTIONS
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no hay definida partición de caché.
|
||||
DEV=$(ogFindCache) || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
|
||||
DEV=$(ogDiskToDev $DEV) || return $?
|
||||
|
||||
# Formatear sistema de ficheros.
|
||||
ogUnmountCache 2>/dev/null
|
||||
OPTIONS="extent,large_file"
|
||||
[[ $(uname -r) =~ ^5 ]] && OPTIONS+=",uninit_bg,^metadata_csum,^64bit"
|
||||
mkfs.ext4 -q -F $DEV -L "CACHE" -O "$OPTIONS" 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $?
|
||||
|
||||
# Crear estructura básica.
|
||||
MNTDIR=$(ogMountCache)
|
||||
mkdir -p $MNTDIR/$OGIMG
|
||||
|
||||
# Incluir kernel e Initrd del ogLive
|
||||
updateBootCache 2>&1>/dev/null
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetCacheSize
|
||||
#@brief Devuelve el tamaño definido para la partición de caché.
|
||||
#@return int_partsize tamaño de la partición (en KB)
|
||||
#@exception OG_ERR_PARTITION No existe partición de caché.
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: InfoCache() en FileSystem.lib
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 2008/10/27
|
||||
#@version 0.91 - Definicion de cache local.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/03/09
|
||||
#*/ ##
|
||||
function ogGetCacheSize ()
|
||||
{
|
||||
# Variables locales
|
||||
local PART
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 10000000"
|
||||
return
|
||||
fi
|
||||
# Error si no se encuentra partición de caché.
|
||||
PART=$(ogFindCache) || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
|
||||
|
||||
# Devuelve tamaño de la partición de caché.
|
||||
ogGetPartitionSize $PART
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetCacheSpace
|
||||
#@brief Devuelve el espacio de disco disponible para la partición de caché.
|
||||
#@return int_size tamaño disponible (en KB)
|
||||
#@note El espacio disponible es el que hay entre el límite superior de la partición 3 del disco 1 y el final de dicho disco, y no puede ser superior a la mitad de dicho disco.
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: InfoCache() en FileSystem.lib
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 2008/10/27
|
||||
#@version 0.91 - Definicion de cache local.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/03/09
|
||||
#@version 1.0.5 - Uso de ogFindCache para detectar disco y particion
|
||||
#@author Universidad de Huelva
|
||||
#@date 2012/09/18
|
||||
#*/ ##
|
||||
function ogGetCacheSpace ()
|
||||
{
|
||||
# Variables locales.
|
||||
local NDISK DISK NPART SECTORS CYLS ENDPART3
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 23165386"
|
||||
return
|
||||
fi
|
||||
# Parche UHU para usar ogFindCache en lugar de 1
|
||||
# Error si no se encuentra partición de caché.
|
||||
read NDISK NPART <<<"$(ogFindCache)"
|
||||
[ -n "$NDISK" -a -n "$NPART" ] || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
|
||||
DISK=$(ogDiskToDev $NDISK) || return $?
|
||||
|
||||
SECTORS=$(awk -v D=${DISK#/dev/} '{if ($4==D) {print $3*2}}' /proc/partitions)
|
||||
CYLS=$(sfdisk -g $DISK | cut -f2 -d" ")
|
||||
SECTORS=$[SECTORS/CYLS*CYLS-1]
|
||||
ENDPART3=$(sfdisk -uS -l $DISK | awk -v P="${DISK}3" '{if ($1==P) print $3}')
|
||||
# Mostrar espacio libre en KB (1 KB = 2 sectores)
|
||||
if [ $ENDPART3 -gt $[SECTORS/2] ]; then
|
||||
echo $[(SECTORS-ENDPART3)/2]
|
||||
else
|
||||
echo $[SECTORS/4]
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogMountCache
|
||||
#@brief Monta la partición Cache y exporta la variable $OGCAC
|
||||
#@param sin parametros
|
||||
#@return path_mountpoint - Punto de montaje del sistema de archivos de cache.
|
||||
#@warning Salidas de errores no determinada
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: MountCache() en FileSystem.lib - HIDRA: MontarCache.sh
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2008/06/19
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@Date 2008/10/27
|
||||
#@version 0.91 - Adaptacion a la cache local de OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/03/16
|
||||
#@version 1.0 - Correccion multiples montajes de cache.
|
||||
#@author Antonio J. Doblas Viso, Universidad de Malaga
|
||||
#@date 2011/02/24
|
||||
#*/ ##
|
||||
function ogMountCache ()
|
||||
{
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME ==> /mnt/sda4"
|
||||
return
|
||||
fi
|
||||
|
||||
ogMountFs $(ogFindCache) 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogUnmountCache
|
||||
#@brief Desmonta la particion Cache y elimina la variable $OGCAC
|
||||
#@param sin parametros
|
||||
#@return nada
|
||||
#@warning Salidas de errores no determinada
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: UmountCache() en FileSystem.lib
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@Date 2008/10/27
|
||||
#@version 0.91 - Adaptacion a la cache local de OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010/03/16
|
||||
#@version 1.0 - Correccion multiples montajes de cache.
|
||||
#@author Antonio J. Doblas Viso, Universidad de Malaga
|
||||
#@date 2011/02/24
|
||||
#*/ ##
|
||||
function ogUnmountCache ()
|
||||
{
|
||||
# Variables locales.
|
||||
local CACHE
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
CACHE=$(ogFindCache) || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE"
|
||||
ogIsMounted $CACHE || return 0
|
||||
ogUnmountFs $CACHE
|
||||
# Borrar enlace simbólico de /mnt/ParticiónCache.
|
||||
rm -f $(ogDiskToDev $CACHE | sed 's/dev/mnt/')
|
||||
}
|
||||
|
|
@ -0,0 +1,422 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file File.lib
|
||||
#@brief Librería o clase File
|
||||
#@class File
|
||||
#@brief Funciones para gestión de archivos y directorios.
|
||||
#@version 1.0.4
|
||||
#@warning License: GNU GPLv3+
|
||||
#*/
|
||||
|
||||
|
||||
#/**
|
||||
# ogCalculateChecksum [ str_repo | int_ndisk int_npart ] path_filepath
|
||||
#@brief Devuelve la suma de comprobación (checksum) de un fichero.
|
||||
#@param path_filepath camino del fichero (independiente de mayúsculas)
|
||||
#@param str_repo repositorio de ficheros
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@return hex_checksum Checksum del fichero
|
||||
#@version 0.9.2 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-07-24
|
||||
#@version 1.0.4 - Calcula solo el checksum del último MB del fichero.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2012-03-16
|
||||
#*/ ##
|
||||
function ogCalculateChecksum ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \
|
||||
"$FUNCNAME REPO ubuntu.img ==> ef899299caf8b517ce36f1157a93d8bf"
|
||||
return
|
||||
fi
|
||||
|
||||
# Comprobar que existe el fichero y devolver sus datos.
|
||||
FILE=$(ogGetPath "$@")
|
||||
[ -n "$FILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
tail -c1M "$FILE" | md5sum -b 2>&1 | cut -f1 -d" "
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogCompareChecksumFiles [ str_repo | int_ndisk int_npart ] path_source [ str_repo | int_ndisk int_npart ] path_target
|
||||
#@brief Metafunción que compara las sumas de comprobación almacenadas de 2 ficheros.
|
||||
#@return bool_compare Valor de comparación.
|
||||
#@warning No es necesario especificar la extensión ".sum".
|
||||
#@version 0.9.2 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-07-24
|
||||
#*/ ##
|
||||
function ogCompareChecksumFiles ()
|
||||
{
|
||||
# Variables locales.
|
||||
local ARGS SOURCE TARGET
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \
|
||||
"if $FUNCNAME REPO ubuntu.img CACHE ubuntu.img; then ...; fi"
|
||||
return
|
||||
fi
|
||||
|
||||
ARGS="$@"
|
||||
case "$1" in
|
||||
/*) # Camino completo. */ (Comentrio Doxygen)
|
||||
SOURCE=$(ogGetPath "$1")
|
||||
shift ;;
|
||||
[1-9]*) # ndisco npartición.
|
||||
SOURCE=$(ogGetPath "$1" "$2" "$3")
|
||||
shift 3 ;;
|
||||
*) # Otros: repo, cache, cdrom (no se permiten caminos relativos).
|
||||
SOURCE=$(ogGetPath "$1" "$2")
|
||||
shift 2 ;;
|
||||
esac
|
||||
TARGET=$(ogGetPath "$@")
|
||||
|
||||
# Comparar los ficheros de checksum.
|
||||
test "$(cat "$SOURCE.sum" 2>/dev/null)" == "$(cat "$TARGET.sum" 2>/dev/null)"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogCalculateFullChecksum [ str_repo | int_ndisk int_npart ] path_filepath
|
||||
#@brief Devuelve la suma COMPLETA de comprobación (checksum) de un fichero.
|
||||
#@param path_filepath camino del fichero (independiente de mayúsculas)
|
||||
#@param str_repo repositorio de ficheros
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@return hex_checksum Checksum del fichero
|
||||
#@version 1.0.5 - Primera versión para OpenGnSys.
|
||||
#@author Antonio Doblas Viso, EVLT Universidad de Málaga
|
||||
#@date 2014-07-09
|
||||
#*/ ##
|
||||
function ogCalculateFullChecksum ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \
|
||||
"$FUNCNAME REPO ubuntu.img ==> ef899299caf8b517ce36f1157a93d8bf"
|
||||
return
|
||||
fi
|
||||
|
||||
# Comprobar que existe el fichero y devolver sus datos.
|
||||
FILE=$(ogGetPath "$@")
|
||||
[ -n "$FILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
#ADV
|
||||
md5sum "$FILE" -b 2>&1 | cut -f1 -d" "
|
||||
# tail -c1M "$FILE" | md5sum -b 2>&1 | cut -f1 -d" "
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#/**
|
||||
# ogCopyFile [ str_repo | int_ndisk int_npart ] path_source [ str_repo | int_ndisk int_npart ] path_target
|
||||
#@brief Metafunción para copiar un fichero de sistema OpenGnSys a un directorio.
|
||||
#@see ogGetPath
|
||||
#@return Progreso de la copia.
|
||||
#@warning Deben existir tanto el fichero origen como el directorio destino.
|
||||
#@version 0.9 - Pruebas con OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-10-20
|
||||
#@version 1.0.4 - Copiar usando rsync.
|
||||
#@author Universidad de Huelva
|
||||
#@date 2012-07-06
|
||||
#*/ ##
|
||||
function ogCopyFile ()
|
||||
{
|
||||
# Variables locales.
|
||||
local ARGS SOURCE TARGET
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_source [ str_repo | int_ndisk int_npartition ] path_target" \
|
||||
"$FUNCNAME REPO newfile.txt 1 2 /tmp/newfile.txt"
|
||||
return
|
||||
fi
|
||||
|
||||
ARGS="$@"
|
||||
case "$1" in
|
||||
/*) # Camino completo. */ (Comentrio Doxygen)
|
||||
SOURCE="$(ogGetPath "$1")"
|
||||
shift ;;
|
||||
[1-9]*) # ndisco npartición.
|
||||
SOURCE="$(ogGetPath "$1" "$2" "$3")"
|
||||
shift 3 ;;
|
||||
*) # Otros: repo, cache, cdrom (no se permiten caminos relativos).
|
||||
SOURCE="$(ogGetPath "$1" "$2")"
|
||||
shift 2 ;;
|
||||
esac
|
||||
# Comprobar fichero origen y directorio destino.
|
||||
[ -n "$SOURCE" ] || ogRaiseError $OG_ERR_NOTFOUND "${ARGS% $*}" || return $?
|
||||
TARGET="$(ogGetPath "$@")"
|
||||
[ -n "$TARGET" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
# Copiar fichero (para evitar problemas de comunicaciones las copias se hacen con rsync en vez de cp).
|
||||
rsync --progress --inplace -avh "$SOURCE" "$TARGET"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogDeleteFile [ str_repo | int_ndisk int_npartition ] path_filepath
|
||||
#@brief Metafunción que borra un fichero de un dispositivo.
|
||||
#@see ogGetPath
|
||||
#@version 0.9 - Pruebas con OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-29
|
||||
#*/ ##
|
||||
function ogDeleteFile ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_file" \
|
||||
"$FUNCNAME 1 2 /tmp/newfile.txt"
|
||||
return
|
||||
fi
|
||||
|
||||
# Comprobar que existe el fichero y borrarlo.
|
||||
FILE="$(ogGetPath "$@")"
|
||||
[ -n "$FILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
rm -f "$FILE" || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogDeleteTree [ str_repo | int_ndisk int_npartition ] path_dirpath
|
||||
#@brief Metafunción que borra todo un subárbol de directorios de un dispositivo.
|
||||
#@see ogGetPath
|
||||
#@version 0.9 - Pruebas con OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-29
|
||||
#*/ ##
|
||||
function ogDeleteTree ()
|
||||
{
|
||||
# Variables locales.
|
||||
local DIR
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_dir" \
|
||||
"$FUNCNAME 1 2 /tmp/newdir"
|
||||
return
|
||||
fi
|
||||
|
||||
# Comprobar que existe el directorio y borrarlo con su contenido.
|
||||
DIR="$(ogGetPath "$@")"
|
||||
[ -n "$DIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
rm -fr "$DIR" || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetPath [ str_repo | int_ndisk int_npartition ] path_filepath
|
||||
#@brief Inicia el proceso de arranque de un sistema de archivos.
|
||||
#@param path_filepath camino del fichero (independiente de mayúsculas)
|
||||
#@param str_repo repositorio de ficheros
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@return path_file - camino completo real del fichero.
|
||||
#@note repo = { REPO, CACHE, CDROM }
|
||||
#@note Requisitos: \c grep \c sed
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero o dispositivo no encontrado.
|
||||
#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
|
||||
#@warning En caso de error, sólo devuelve el código y no da mensajes.
|
||||
#@todo Terminar de definir parámetros para acceso a repositorios.
|
||||
#@version 0.1 - Integracion para Opengnsys - HIDRA: CaminoWindows.sh; EAC: GetPath(), FormatSintaxSpacePath(), FormatSintaxBackSlashPath (), en FileSystem.lib
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@Date 2008/10/10
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 2008/10/27
|
||||
#@version 0.9 - Pruebas con OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-15
|
||||
#@version 1.1.1 - Correccion comentarios autodocumentacion doxygen .
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 2018-07-05
|
||||
#*/ ##
|
||||
|
||||
function ogGetPath ()
|
||||
{
|
||||
# Variables locales.
|
||||
local MNTDIR FILE PREVFILE FILEPATH CURRENTDIR
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \
|
||||
"$FUNCNAME \"/mnt/sda1/windows/system32\" ==> /mnt/sda1/WINDOWS/System32" \
|
||||
"$FUNCNAME REPO /etc/fstab ==> /opt/opengnsys/images/etc/fstab" \
|
||||
"$FUNCNAME 1 1 \"/windows/system32\" ==> /mnt/sda1/WINDOWS/System32"
|
||||
return
|
||||
fi
|
||||
|
||||
# Procesar camino según el número de parámetros.
|
||||
case $# in
|
||||
1) FILE="$1" ;;
|
||||
2) case "${1^^}" in
|
||||
REPO)
|
||||
FILE="$OGIMG/$2" ;;
|
||||
CACHE)
|
||||
MNTDIR="$(ogMountCache)" || return $?
|
||||
FILE="$MNTDIR/$OGIMG/$2" ;;
|
||||
CDROM)
|
||||
MNTDIR="$(ogMountCdrom)" || return $?
|
||||
FILE="$MNTDIR/$2" ;;
|
||||
*) ogRaiseError $OG_ERR_FORMAT
|
||||
return $? ;;
|
||||
esac ;;
|
||||
3) MNTDIR="$(ogMount $1 $2)" || return $?
|
||||
FILE="$MNTDIR/$3" ;;
|
||||
*) ogRaiseError $OG_ERR_FORMAT
|
||||
return $? ;;
|
||||
esac
|
||||
|
||||
# Eliminar caracteres \c / duplicados y finales.
|
||||
|
||||
FILE="$(echo $FILE|sed -e 's/\(\/\)*\1/\//g; s/\/$//')"
|
||||
# Comprobar si existe el fichero para reducir tiempos.
|
||||
if [ -e "$FILE" ]; then
|
||||
FILEPATH="$FILE"
|
||||
else
|
||||
# Buscar el nombre correcto en cada subdirectorio del camino.
|
||||
FILEPATH="/"
|
||||
|
||||
while [ "$FILE" != "$PREVFILE" ]; do
|
||||
FILEPATH="$(ls -d "${FILEPATH%/}/${FILE%%/*}" 2>/dev/null || find "$FILEPATH" -maxdepth 1 -iname "${FILE%%/*}" -print 2>/dev/null)" #*/ (Comentario Doxygen)
|
||||
PREVFILE="$FILE"
|
||||
FILE="${FILE#*/}"
|
||||
done
|
||||
|
||||
fi
|
||||
[ -n "$FILEPATH" ] && echo "$FILEPATH"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetParentPath [ str_repo | int_ndisk int_npartition ] path_filepath
|
||||
#@brief Metafunción que devuelve el camino del directorio padre.
|
||||
#@see ogGetPath
|
||||
#@version 0.9 - Pruebas con OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-29
|
||||
#*/ ##
|
||||
|
||||
function ogGetParentPath ()
|
||||
{
|
||||
local PARENT
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \
|
||||
"$FUNCNAME \"/mnt/sda1/windows/system32\" ==> /mnt/sda1/WINDOWS" \
|
||||
"$FUNCNAME REPO /etc/fstab ==> /opt/opengnsys/images/etc" \
|
||||
"$FUNCNAME 1 1 \"/windows/system32\" ==> /mnt/sda1/WINDOWS"
|
||||
return
|
||||
fi
|
||||
|
||||
case $# in
|
||||
1) PARENT="$(dirname "$1")" ;;
|
||||
2) PARENT="$1 $(dirname "/$2")" ;;
|
||||
3) PARENT="$1 $2 $(dirname "/$3")" ;;
|
||||
*) ogRaiseError $OG_ERR_FORMAT
|
||||
return $? ;;
|
||||
esac
|
||||
ogGetPath $PARENT
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogIsNewerFile [ str_repo | int_ndisk int_npart ] path_source [ str_repo | int_ndisk int_npart ] path_target
|
||||
#@brief Metafunción que indica se un fichero es más nuevo que otro.
|
||||
#@see ogGetPath
|
||||
#@return Código de salida: 0 - nuevo, 1 - antiguo o error
|
||||
#@warning Deben existir tanto el fichero origen como el destino.
|
||||
#@version 0.9.2 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-07-24
|
||||
#@version 1.0.1 - Devolver falso en caso de error.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-18
|
||||
#*/ ##
|
||||
function ogIsNewerFile ()
|
||||
{
|
||||
# Variables locales.
|
||||
local ARGS SOURCE TARGET
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_source [ str_repo | int_ndisk int_npartition ] path_target" \
|
||||
"if $FUNCNAME REPO ubuntu.img CACHE ubuntu.img; then ... fi"
|
||||
return
|
||||
fi
|
||||
|
||||
ARGS="$@"
|
||||
case "$1" in
|
||||
/*) # Camino completo. */ (Comentrio Doxygen)
|
||||
SOURCE="$(ogGetPath "$1")"
|
||||
shift ;;
|
||||
[1-9]*) # ndisco npartición.
|
||||
SOURCE="$(ogGetPath "$1" "$2" "$3")"
|
||||
shift 3 ;;
|
||||
*) # Otros: repo, cache, cdrom (no se permiten caminos relativos).
|
||||
SOURCE="$(ogGetPath "$1" "$2")"
|
||||
shift 2 ;;
|
||||
esac
|
||||
# Comprobar que existen los ficheros origen y destino.
|
||||
[ -n "$SOURCE" ] || ogRaiseError $OG_ERR_NOTFOUND "${ARGS% $*}" || return 1
|
||||
TARGET=$(ogGetPath "$@")
|
||||
[ -n "$TARGET" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return 1
|
||||
# Devolver si el primer fichero se ha modificado después que el segundo.
|
||||
test "$SOURCE" -nt "$TARGET"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogMakeChecksumFile [ str_repo | int_ndisk int_npart ] path_filepath
|
||||
#@brief Metafunción que guarda el valor de comprobación de un fichero.
|
||||
#@see ogCalculateChecksum
|
||||
#@warning Genera un fichero con extensión ".sum".
|
||||
#@version 0.9.2 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-07-24
|
||||
#*/ ##
|
||||
function ogMakeChecksumFile ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \
|
||||
"$FUNCNAME REPO ubuntu.img"
|
||||
return
|
||||
fi
|
||||
|
||||
# Comprobar que existe el fichero y guardar su checksum.
|
||||
FILE="$(ogGetPath "$@")"
|
||||
[ -n "$FILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
ogCalculateChecksum "$FILE" > "$FILE.sum"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogMakeDir [ str_repo | int_ndisk int_npartition ] path_dirpath
|
||||
#@brief Metafunción que crea un subdirectorio vacío en un dispositivo.
|
||||
#@see ogGetParentPath
|
||||
#@version 0.1 - Integracion para Opengnsys - HIDRA: CrearDirectorio.sh, EAC: MkdirPath() en FileSystem.lib
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@Date 2008/10/10
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 2008/10/27
|
||||
#@version 0.9 - Pruebas con OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-29
|
||||
#*/ ##
|
||||
function ogMakeDir ()
|
||||
{
|
||||
local PARENT DIR
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_dir" \
|
||||
"$FUNCNAME 1 2 /tmp/newdir"
|
||||
return
|
||||
fi
|
||||
|
||||
PARENT="$(ogGetParentPath "$@")" || return $?
|
||||
DIR="$(basename "${!#}")"
|
||||
mkdir -p "$PARENT/$DIR" || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $?
|
||||
}
|
||||
|
|
@ -0,0 +1,528 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file Inventory.lib
|
||||
#@brief Librería o clase Inventory
|
||||
#@class Inventory
|
||||
#@brief Funciones para recogida de datos de inventario de hardware y software de los clientes.
|
||||
#@version 1.1.0
|
||||
#@warning License: GNU GPLv3+
|
||||
#*/
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetArch
|
||||
#@brief Devuelve el tipo de arquitectura del cliente.
|
||||
#@return str_arch - Arquitectura (i386 para 32 bits, x86_64 para 64 bits).
|
||||
#@version 0.9.2 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-07-17
|
||||
#*/
|
||||
function ogGetArch ()
|
||||
{
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => x86_64"
|
||||
return
|
||||
fi
|
||||
|
||||
[ -d /lib64 ] && echo "x86_64" || echo "i386"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetOsType int_ndisk int_npartition
|
||||
#@brief Devuelve el tipo del sistema operativo instalado.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@return OSType - Tipo de sistema operativo.
|
||||
#@see ogGetOsVersion
|
||||
#*/ ##
|
||||
function ogGetOsType ()
|
||||
{
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \
|
||||
"$FUNCNAME 1 2 => Linux"
|
||||
return
|
||||
fi
|
||||
ogGetOsVersion "$@" | cut -sf1 -d:
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetOsUuid int_ndisk int_nfilesys
|
||||
#@brief Devuelve el UUID del sistema operativo instalado en un sistema de archivos.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_nfilesys nº de orden de la partición
|
||||
#@return str_uuid - UUID del sistema operativo.
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Disco o partición no corresponden con un dispositiv
|
||||
#@version 1.1.0 - Primera versión para OpenGnsys
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2015-09-09
|
||||
#*/ ##
|
||||
function ogGetOsUuid ()
|
||||
{
|
||||
# Variables locales.
|
||||
local MNTDIR
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \
|
||||
"$FUNCNAME 1 2 => 540e47c6-8e78-4178-aa46-042e4803fb16"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 2 parametros.
|
||||
[ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
# Montar la particion, si no lo estaba previamente.
|
||||
MNTDIR=$(ogMount $1 $2) || return $?
|
||||
|
||||
# Obtener UUID según el tipo de sistema operativo.
|
||||
case "$(ogGetOsType $1 $2)" in
|
||||
Linux)
|
||||
# Leer el UUID del sistema de ficheros raíz o el fichero de identificador.
|
||||
findmnt -no UUID $MNTDIR 2>/dev/null || cat $MNTDIR/etc/machine-id 2>/dev/null
|
||||
;;
|
||||
Windows)
|
||||
# Leer identificador en clave de registro.
|
||||
ogGetRegistryValue $MNTDIR SOFTWARE '\Microsoft\Cryptography\MachineGuid' 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetSerialNumber
|
||||
#@brief Obtiene el nº de serie del cliente.
|
||||
#@version 1.1.0 - Primeras versión con OpenGnsys
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2015-06-08
|
||||
#*/ ##
|
||||
function ogGetSerialNumber ()
|
||||
{
|
||||
# Variables locales.
|
||||
local SERIALNO
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 123456"
|
||||
return
|
||||
fi
|
||||
|
||||
# Obtener nº de serie (ignorar los no especificados).
|
||||
SERIALNO=$(dmidecode -s system-serial-number | egrep -vi "(^[ 0]+$|not specified|to be filled|invalid entry|default string)")
|
||||
# Quitar espacios y truncar cadena si >25 caracteres.
|
||||
SERIALNO="${SERIALNO// /}"
|
||||
[ ${#SERIALNO} -gt 25 ] && SERIALNO="${SERIALNO:0:22}..."
|
||||
[ -n "$SERIALNO" ] && echo "$SERIALNO"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogIsEfiActive
|
||||
#@brief Comprueba si el sistema tiene activo el arranque EFI.
|
||||
#*/ ##
|
||||
function ogIsEfiActive ()
|
||||
{
|
||||
test -d /sys/firmware/efi
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogListHardwareInfo
|
||||
#@brief Lista el inventario de hardware de la máquina cliente.
|
||||
#@return TipoDispositivo:Modelo (por determinar)
|
||||
#@warning Se ignoran los parámetros de entrada.
|
||||
#@note TipoDispositivo = { bio, boa, bus, cha, cdr, cpu, dis, fir, mem, mod, mul, net, sto, usb, vga }
|
||||
#@note Requisitos: dmidecode, lshw, awk
|
||||
#@version 0.1 - Primeras pruebas con OpenGnSys
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-07-28
|
||||
#@version 1.1.0 - Incluir nuevos componentes al inventario.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-04-23
|
||||
#*/ ##
|
||||
function ogListHardwareInfo ()
|
||||
{
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Recopilación de dispositivos procesando la salida de \c lshw
|
||||
ogEcho info "$MSG_HARDWAREINVENTORY}"
|
||||
echo "cha=$(dmidecode -s chassis-type)" | grep -v "Other"
|
||||
[ -e /sys/firmware/efi ] && echo "boo=UEFI" || echo "boo=BIOS"
|
||||
lshw | awk 'BEGIN {type="mod";}
|
||||
/product:/ {sub(/ *product: */,""); prod=$0;}
|
||||
/vendor:/ {sub(/ *vendor: */,""); vend=$0;}
|
||||
/version:/ {sub(/ *version: */,"v.");vers=$0;}
|
||||
/size:/ {size=$2;}
|
||||
/clock:/ {clock=$2;}
|
||||
/slot:/ {sub(/ *slot: */,""); slot=$0;}
|
||||
/\*-/ {if (type=="mem"){
|
||||
if (size!=""){
|
||||
numbank++;
|
||||
print type"="vend,prod,size,clock" ("slot")";}
|
||||
}else{
|
||||
if (type=="totalmem"){
|
||||
if (size!=""){
|
||||
totalmemory="mem="size;}
|
||||
}else{
|
||||
if (type!="" && prod!=""){
|
||||
if (prod=="v."vers)
|
||||
vers="";
|
||||
print type"="vend,prod,size,vers;} }
|
||||
}
|
||||
type=prod=vend=vers=size=clock=slot="";}
|
||||
$1~/-core/ {type="boa";}
|
||||
$1~/-firmware/ {type="bio";}
|
||||
$1~/-cpu/ {type="cpu";}
|
||||
$1~/-bank/ {type="mem";}
|
||||
$1~/-memory/ {type="totalmem";}
|
||||
$1~/-ide/ {type="ide";}
|
||||
$1~/-storage/ {type="sto";}
|
||||
$1~/-disk/ {type="dis";}
|
||||
$1~/-cdrom/ {type="cdr";}
|
||||
$1~/-display/ {type="vga";}
|
||||
$1~/-network/ {type="net";}
|
||||
$1~/-multimedia/ {type="mul";}
|
||||
$1~/-usb/ {type="usb";}
|
||||
$1~/-firewire/ {type="fir";}
|
||||
$1~/-serial/ {type="bus";}
|
||||
END {if (type!="" && prod!="")
|
||||
print type"="vend,prod,size,vers;
|
||||
if (length(numbank)==0 && length(totalmemory)>=4)
|
||||
print totalmemory; }
|
||||
'
|
||||
# */ (comentario para Doxygen)
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogListSoftware int_ndisk int_npartition
|
||||
#@brief Lista el inventario de software instalado en un sistema operativo.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@return programa versión ...
|
||||
#@warning Se ignoran los parámetros de entrada.
|
||||
#@note Requisitos: ...
|
||||
#@todo Detectar software en Linux
|
||||
#@version 0.1 - Primeras pruebas con OpenGnSys
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-23
|
||||
#@version 1.0.5 - Aproximación para inventario de software de Mac OS.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2013-10-08
|
||||
#@version 1.0.6 - Proceso depende del tipo de SO y soporte para FreeBSD.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-11-13
|
||||
#@version 1.1.0 - Se muestra el sistema operativo en la primera línea de la salida
|
||||
#@author Irina Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2016-04-26
|
||||
#*/ ##
|
||||
function ogListSoftware ()
|
||||
{
|
||||
# Variables locales.
|
||||
local APPS HIVE k KEYS KEYS32 MNTDIR PKGDIR PROG VERS TMPFILE TYPE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME 1 1"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 2 parametros.
|
||||
[ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
# Obtener tipo de sistema de archivos y montarlo.
|
||||
MNTDIR=$(ogMount $1 $2) || return $?
|
||||
TYPE=$(ogGetOsType $1 $2) || return $?
|
||||
|
||||
# Ficheros temporales.
|
||||
APPS=$(mktemp /tmp/apps.XXXXX)
|
||||
TMPFILE=$(mktemp /tmp/tmp.XXXXX)
|
||||
trap "rm -f $APPS $TMPFILE" 1 2 3 9 15
|
||||
|
||||
case "$TYPE" in
|
||||
Linux) # Software de GNU/Linux.
|
||||
# Procesar paquetes dpkg.
|
||||
PKGDIR="${MNTDIR}/var/lib/dpkg"
|
||||
if [ -r $PKGDIR ]; then
|
||||
# Proceso de fichero en sistemas de 64 bits.
|
||||
awk '/Package:/ {if (pack!="") print pack,vers;
|
||||
sub(/-dev$/,"",$2);
|
||||
pack=$2}
|
||||
/Version:/ {sub(/^.*:/,"",$2); sub(/-.*$/,"",$2);
|
||||
vers=$2}
|
||||
/Status:/ {if ($2!="install") pack=vers=""}
|
||||
END {if (pack!="") print pack,vers}
|
||||
' $PKGDIR/status > $APPS
|
||||
fi
|
||||
# Procesar paquetes RPM.
|
||||
PKGDIR="${MNTDIR}/var/lib/rpm"
|
||||
if [ -r $PKGDIR ]; then
|
||||
# Listar si está instalado el paquete "rpm" en el cliente.
|
||||
if which rpm &>/dev/null; then
|
||||
rm -f ${PKGDIR}/__db.*
|
||||
rpm --dbpath $PKGDIR -qa --qf "%{NAME} %{VERSION}\n" 2>/dev/null | \
|
||||
awk '$1!~/-devel$/ {sub(/-.*$/,"",$2); print $0}' > $APPS
|
||||
rm -f ${PKGDIR}/__db.*
|
||||
else
|
||||
# Obtener el nombre de cada paquete en la BD de RPM.
|
||||
python <<<"
|
||||
import re;
|
||||
import bsddb;
|
||||
db=bsddb.hashopen('$PKGDIR/Name','r');
|
||||
for k in db.keys():
|
||||
print re.sub('-devel$','',k);" > $APPS
|
||||
fi
|
||||
fi
|
||||
# Procesar paquetes pacman.
|
||||
PKGDIR="${MNTDIR}/var/lib/pacman/local"
|
||||
if [ -r $PKGDIR ]; then
|
||||
ls $PKGDIR | awk -F- '/-/ {print gensub(/-/, " ", NF-2);}' > $APPS
|
||||
fi
|
||||
# Procesar aplicaciones Snappy.
|
||||
PKGDIR="${MNTDIR}/snap"
|
||||
find $PKGDIR/*/current/meta -name snap.yaml -exec \
|
||||
awk '/name:/ {pack=$2}
|
||||
/version:/ {vers=$2}
|
||||
END {if (pack!="") print pack,"(snap)",vers}' {} 2>/dev/null \; >> $APPS
|
||||
# Procesar aplicaciones Flatpak.
|
||||
PKGDIR="${MNTDIR}/var/lib/flatpak"
|
||||
ls -1 $PKGDIR/app/*/current/active/deploy 2> /dev/null | python -c "
|
||||
import sys
|
||||
for f in sys.stdin:
|
||||
p = open(f.strip()).read().split('\0')
|
||||
try:
|
||||
if(p[0] != 'flathub'):
|
||||
raise ValueError
|
||||
print('{} (flatpak) {}'.format(p[p.index('appdata-name') + 4], p[p.index('appdata-version') + 1]))
|
||||
except ValueError:
|
||||
pass
|
||||
" >> $APPS
|
||||
;;
|
||||
Windows) # Software de Windows.
|
||||
# Comprobar tipo de proceso del registro de Windows.
|
||||
if which hivexregedit &>/dev/null; then
|
||||
# Nuevo proceso más rápido basado en "hivexregedit".
|
||||
HIVE=$(ogGetHivePath $MNTDIR software 2>/dev/null)
|
||||
if [ -n "$HIVE" ]; then
|
||||
# Claves de registro para programas instalados.
|
||||
hivexregedit --unsafe-printable-strings --export "$HIVE" '\Microsoft\Windows\CurrentVersion\Uninstall' > $TMPFILE 2>/dev/null
|
||||
hivexregedit --unsafe-printable-strings --export "$HIVE" '\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' >> $TMPFILE 2>/dev/null
|
||||
# Mostrar los valores "DisplayName" y "DisplayVersion" para cada clave.
|
||||
awk -F\" '$1~/^\[/ {n=""}
|
||||
$2~/DisplayName/ {n=$4}
|
||||
$2~/DisplayVersion/ {print n,$4}
|
||||
' $TMPFILE > $APPS
|
||||
fi
|
||||
else
|
||||
# Compatibilidad con clientes ogLive antiguos.
|
||||
# Claves de registro para programas instalados: formato "{clave}".
|
||||
KEYS=$(ogListRegistryKeys $MNTDIR software '\Microsoft\Windows\CurrentVersion\Uninstall')
|
||||
KEYS32=$(ogListRegistryKeys $MNTDIR software '\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')
|
||||
# Mostrar los valores "DisplayName" y "DisplayVersion" para cada clave.
|
||||
for k in $KEYS; do
|
||||
PROG=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName")
|
||||
if [ -n "$PROG" ]; then
|
||||
VERS=$(ogGetRegistryValue $MNTDIR software "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion")
|
||||
echo "$PROG $VERS"
|
||||
fi
|
||||
done > $APPS
|
||||
for k in $KEYS32; do
|
||||
PROG=$(ogGetRegistryValue $MNTDIR software "\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayName")
|
||||
if [ -n "$PROG" ]; then
|
||||
VERS=$(ogGetRegistryValue $MNTDIR software "\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$k\\DisplayVersion")
|
||||
echo "$PROG $VERS"
|
||||
fi
|
||||
done >> $APPS
|
||||
fi
|
||||
;;
|
||||
MacOS) # Software de Mac OS.
|
||||
# Listar directorios de aplicaciones e intentar obtener la versión del fichero .plist (tanto original como descomprimido).
|
||||
find "${MNTDIR}/Applications" -type d -name "*.app" -prune -print | \
|
||||
while read k; do
|
||||
FILE="$k/Contents/version.plist"
|
||||
[ -s "$FILE" ] || FILE="$k/Contents/version.plist.uncompress"
|
||||
[ -s "$FILE" ] && VERSION=$(awk -F"[<>]" '/ShortVersionString/ {getline;v=$3}
|
||||
END {print v}' "$FILE")
|
||||
echo "$(basename "$k" .app) $VERSION"
|
||||
done > $APPS
|
||||
;;
|
||||
BSD) # Software de FreeBSD.
|
||||
sqlite3 $MNTDIR/var/db/pkg/local.sqlite <<<"SELECT name FROM pkg_search;" 2>/dev/null | \
|
||||
sed 's/\(.*\)-\(.*\)/\1 \2/g' > $APPS
|
||||
;;
|
||||
*) ogRaiseError $OG_ERR_NOTOS "$1, $2 ${TYPE+($TYPE)}"
|
||||
return $? ;;
|
||||
esac
|
||||
|
||||
# Mostrar sistema Operativo y aplicaciones.
|
||||
ogGetOsVersion $1 $2 | awk -F: '{print $2}'
|
||||
sort $APPS | uniq | iconv -ct utf-8
|
||||
rm -f $APPS $TMPFILE
|
||||
}
|
||||
|
||||
#/**
|
||||
# ogGetOsVersion int_ndisk int_nfilesys
|
||||
#@brief Devuelve la versión del sistema operativo instalado en un sistema de archivos.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_nfilesys nº de orden de la partición
|
||||
#@return OSType:OSVersion - tipo y versión del sistema operativo.
|
||||
#@note OSType = { Android, BSD, GrubLoader, Hurd, Linux, MacOS, Solaris, Windows, WinLoader }
|
||||
#@note Requisitos: awk, head, chroot
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Disco o partición no corresponden con un dispositiv
|
||||
#@exception OG_ERR_PARTITION Fallo al montar el sistema de archivos.
|
||||
#@version 0.9 - Primera versión para OpenGnSys
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-15
|
||||
#@version 1.0.4 - Incluir tipos BSD, MacOS y Solaris.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2012-06-29
|
||||
#@version 1.0.5 - Incluir tipos GrubLoader, Hurd y WinLoader, leer por defecto fichero /etc/os-release.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2013-10-07
|
||||
#@version 1.0.6 - Detectar GrubLoader al final y sistemas basados en EFI.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-08-27
|
||||
#*/ ##
|
||||
function ogGetOsVersion ()
|
||||
{
|
||||
# Variables locales.
|
||||
local MNTDIR TYPE DISTRIB VERSION IS64BIT FILE
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \
|
||||
"$FUNCNAME 1 2 => Linux:Ubuntu precise (12.04 LTS) 64 bits"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 2 parametros.
|
||||
[ $# = 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
# Montar la particion, si no lo estaba previamente.
|
||||
MNTDIR=$(ogMount $1 $2) || return $?
|
||||
|
||||
# Buscar tipo de sistema operativo.
|
||||
# Para GNU/Linux: leer descripción.
|
||||
TYPE="Linux"
|
||||
FILE="$MNTDIR/etc/os-release"
|
||||
[ -r $FILE ] && VERSION="$(awk -F= '$1~/PRETTY_NAME/ {gsub(/\"/,"",$2); print $2}' $FILE)"
|
||||
# Si no se puede obtener, buscar en ficheros del sistema.
|
||||
if [ -z "$VERSION" ]; then
|
||||
FILE="$MNTDIR/etc/lsb-release"
|
||||
[ -r $FILE ] && VERSION="$(awk -F= '$1~/DESCRIPTION/ {gsub(/\"/,"",$2); print $2}' $FILE)"
|
||||
for DISTRIB in redhat SuSE mandrake gentoo; do
|
||||
FILE="$MNTDIR/etc/${DISTRIB}-release"
|
||||
[ -r $FILE ] && VERSION="$(head -1 $FILE)"
|
||||
done
|
||||
FILE="$MNTDIR/etc/arch-release"
|
||||
[ -r $FILE ] && VERSION="Arch Linux"
|
||||
FILE="$MNTDIR/etc/slackware-version"
|
||||
[ -r $FILE ] && VERSION="Slackware $(cat $FILE)"
|
||||
fi
|
||||
# Si no se encuentra, intentar ejecutar "lsb_release".
|
||||
[ -z "$VERSION" ] && VERSION=$(chroot $MNTDIR lsb_release -d 2>/dev/null | awk -F":\t" '{print $2}')
|
||||
# Comprobar Linux de 64 bits.
|
||||
[ -n "$VERSION" ] && [ -e $MNTDIR/lib64 ] && IS64BIT="$MSG_64BIT"
|
||||
# Para Android, leer fichero de propiedades.
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="Android"
|
||||
FILE="$MNTDIR/android*/system/build.prop"
|
||||
[ -r $FILE ] && VERSION="Android $(awk -F= '$1~/(product.brand|build.version.release)/ {print $2}' $FILE | tr '\n' ' ')"
|
||||
[ -e $MNTDIR/lib64 ] && IS64BIT="$MSG_64BIT"
|
||||
fi
|
||||
# Para GNU/Hurd, comprobar fichero de inicio (basado en os-prober).
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="Hurd"
|
||||
FILE="$MNTDIR/hurd/init"
|
||||
[ -r $FILE ] && VERSION="GNU/Hurd"
|
||||
fi
|
||||
# Para Windows: leer la version del registro.
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="Windows"
|
||||
FILE="$(ogGetHivePath $MNTDIR SOFTWARE)"
|
||||
if [ -n "$FILE" ]; then
|
||||
# Nuevo método más rápido para acceder al registro de Windows..
|
||||
VERSION=$(echo $(hivexsh << EOT 2>/dev/null
|
||||
load $FILE
|
||||
cd \Microsoft\Windows NT\CurrentVersion
|
||||
lsval ProductName
|
||||
lsval ReleaseId
|
||||
EOT
|
||||
))
|
||||
[ -n "$(reglookup -H -p "Microsoft/Windows/CurrentVersion/ProgramW6432Dir" "$FILE" 2>/dev/null)" ] && IS64BIT="$MSG_64BIT"
|
||||
if [ -z "$VERSION" ]; then
|
||||
# Compatibilidad con métrodo antiguo y más lento de acceder al registro.
|
||||
VERSION=$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows NT\CurrentVersion\ProductName' 2>/dev/null)
|
||||
[ -n "$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows\CurrentVersion\ProgramW6432Dir' 2>/dev/null)" ] && IS64BIT="$MSG_64BIT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# Para cargador Windows: buscar versión en fichero BCD (basado en os-prober).
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="WinLoader"
|
||||
FILE="$(ogGetPath $MNTDIR/boot/bcd)"
|
||||
[ -z "$FILE" ] && FILE="$(ogGetPath $MNTDIR/EFI/Microsoft/boot/bcd)"
|
||||
if [ -n "$FILE" ]; then
|
||||
for DISTRIB in "Windows Recovery" "Windows Boot"; do
|
||||
if grep -aqs "$(echo "$DISTRIB" | sed 's/./&./g')" $FILE; then
|
||||
VERSION="$DISTRIB loader"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
# Para macOS: detectar kernel y completar con fichero plist de información del sistema.
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="MacOS"
|
||||
# Kernel de Mac OS (no debe ser fichero de texto).
|
||||
FILE="$MNTDIR/mach_kernel"
|
||||
if [ -z "$(file -b $FILE | grep 'text')" ]; then
|
||||
# Obtener tipo de kernel.
|
||||
[ -n "$(file -b $FILE | grep 'Mach-O')" ] && VERSION="macOS"
|
||||
[ -n "$(file -b $FILE | grep 'Mach-O 64-bit')" ] && IS64BIT="$MSG_64BIT"
|
||||
# Datos de configuración de versión de Mac OS.
|
||||
FILE="$MNTDIR/System/Library/CoreServices/SystemVersion.plist"
|
||||
[ -r $FILE ] && VERSION=$(awk -F"[<>]" '
|
||||
/ProductName/ {getline;s=$3}
|
||||
/ProductVersion/ {getline;v=$3}
|
||||
END {print s,v}' $FILE)
|
||||
# Datos de recuperación de macOS.
|
||||
FILE="$MNTDIR/com.apple.recovery.boot"
|
||||
[ -r $FILE -a -n "$VERSION" ] && VERSION="$VERSION recovery"
|
||||
fi
|
||||
fi
|
||||
# Para FreeBSD: obtener datos del Kernel.
|
||||
### TODO Revisar solución.
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="BSD"
|
||||
FILE="$MNTDIR/boot/kernel/kernel"
|
||||
if [ -r $FILE ]; then
|
||||
VERSION="$(strings $FILE|awk '/@.*RELEASE/ {sub(/@\(#\)/,""); print $1,$2}')"
|
||||
[ -n "$(file -b $FILE | grep 'x86-64')" ] && IS64BIT="$MSG_64BIT"
|
||||
fi
|
||||
fi
|
||||
# Para Solaris: leer el fichero de versión.
|
||||
### TODO Revisar solución.
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="Solaris"
|
||||
FILE="$MNTDIR/etc/release"
|
||||
[ -r $FILE ] && VERSION="$(head -1 $FILE)"
|
||||
fi
|
||||
# Para cargador GRUB, comprobar fichero de configuración.
|
||||
if [ -z "$VERSION" ]; then
|
||||
TYPE="GrubLoader"
|
||||
for FILE in $MNTDIR/{,boot/}grub/menu.lst; do
|
||||
[ -r $FILE ] && VERSION="GRUB Loader"
|
||||
done
|
||||
#/* (comentario Doxygen)
|
||||
for FILE in $MNTDIR/{,boot/}{grub{,2},EFI/*}/grub.cfg; do
|
||||
[ -r $FILE ] && VERSION="GRUB2 Loader"
|
||||
done
|
||||
fi
|
||||
#*/ (Comentario Doxygen)
|
||||
# Mostrar resultado y salir sin errores.
|
||||
[ -n "$VERSION" ] && echo "$TYPE:$VERSION $IS64BIT"
|
||||
return 0
|
||||
}
|
|
@ -0,0 +1,345 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file Net.lib
|
||||
#@brief Librería o clase Net
|
||||
#@class Net
|
||||
#@brief Funciones básicas de red.
|
||||
#@version 1.0.6
|
||||
#@warning License: GNU GPLv3+
|
||||
#*/
|
||||
|
||||
|
||||
#/**
|
||||
# ogChangeRepo IPREPO [ OgUnit ]
|
||||
#@brief Cambia el repositorio para el recurso remoto images.
|
||||
#@param 1 Ip Repositorio
|
||||
#@param 2 Abreviatura Unidad Organizativa
|
||||
#@return Cambio recurso remoto en OGIMG.
|
||||
#@version 1.1 - Primera versión para OpenGnSys.
|
||||
#@author Irina Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2015-06-16
|
||||
#*/
|
||||
function ogChangeRepo ()
|
||||
{
|
||||
local SRCIMG NEWREPO REPO OGUNIT
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME IPREPO [ OgUnit ]" \
|
||||
"$FUNCNAME 10.1.120.3" \
|
||||
"$FUNCNAME 10.1.120.3 cdc"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME IPREPO [ OgUnit ]"
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
||||
# Opciones de montaje: lectura o escritura
|
||||
mount |grep "ogimages.*rw," &>/dev/null && RW=",rw" || RW=",ro"
|
||||
|
||||
# Si REPO tomamos el repositorio y la unidad organizativa actual
|
||||
REPO=$(ogGetRepoIp)
|
||||
OGUNIT="$(df | awk -F " " '/ogimages/ {sub("//.*/ogimages","",$1); sub("/","",$1); print $1}')"
|
||||
|
||||
# Parametros de entrada. Si $1 = "REPO" dejo el repositorio actual
|
||||
[ "${1^^}" == "REPO" ] && NEWREPO="$REPO" || NEWREPO="${1}"
|
||||
|
||||
# Si $1 y $2 son el repositorio y la OU actual me salgo
|
||||
[ "$NEWREPO" == "$REPO" ] && [ "$2" == "$OGUNIT" ] && return 0
|
||||
|
||||
source /scripts/functions
|
||||
source /scripts/ogfunctions
|
||||
umount $OGIMG
|
||||
[ "$2" == "" ] && SRCIMG="ogimages" || SRCIMG="ogimages/$2"
|
||||
eval $(grep "OPTIONS=" /scripts/ogfunctions)
|
||||
|
||||
ogEcho session log "$MSG_HELP_ogChangeRepo $NEWREPO ${2%/}"
|
||||
ogConnect $NEWREPO $ogprotocol $SRCIMG $OGIMG $RW
|
||||
|
||||
# Si da error volvemos a montar el inicial
|
||||
if [ $? -ne 0 ]; then
|
||||
ogConnect $REPO $ogprotocol $SRCIMG $OGIMG $RW
|
||||
ogRaiseError session $OG_ERR_REPO "$NEWREPO"
|
||||
return $?
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetGroupDir [ str_repo ]
|
||||
#@brief Devuelve el camino del directorio para el grupo del cliente.
|
||||
#@param str_repo repositorio de imágenes (opcional)
|
||||
#@return path_dir - Camino al directorio del grupo.
|
||||
#@note repo = { REPO, CACHE } REPO por defecto
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@version 1.0.2 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-10-03
|
||||
#*/
|
||||
function ogGetGroupDir ()
|
||||
{
|
||||
local REPO DIR GROUP
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME str_repo" \
|
||||
"$FUNCNAME REPO ==> /opt/opengnsys/images/groups/Grupo1"
|
||||
return
|
||||
fi
|
||||
# Error si se recibe más de 1 parámetro.
|
||||
case $# in
|
||||
0) REPO="REPO" ;;
|
||||
1) REPO="$1" ;;
|
||||
*) ogRaiseError $OG_ERR_FORMAT "$*"
|
||||
return $? ;;
|
||||
esac
|
||||
|
||||
GROUP="$(ogGetGroupName)"
|
||||
if [ -n "$GROUP" ]; then
|
||||
DIR=$(ogGetPath "$REPO" "/groups/$GROUP" 2>/dev/null)
|
||||
[ -d "$DIR" ] && echo "$DIR"
|
||||
fi
|
||||
# Para que no haya error al fallar la condición anterior
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetGroupName
|
||||
#@brief Devuelve el nombre del grupo al que pertenece el cliente.
|
||||
#@return str_group - Nombre de grupo.
|
||||
#@version 1.0.2 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-10-03
|
||||
#*/
|
||||
function ogGetGroupName ()
|
||||
{
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => Grupo1"
|
||||
return
|
||||
fi
|
||||
[ -n "$group" ] && echo "$group"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetHostname
|
||||
#@brief Muestra el nombre del cliente.
|
||||
#@return str_host - nombre de máquina
|
||||
#@version 0.10 - Integración en OpenGnSys 0.10
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-02-11
|
||||
#*/ ##
|
||||
function ogGetHostname ()
|
||||
{
|
||||
local HOST
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => pc1"
|
||||
return
|
||||
fi
|
||||
# Tomar nombre de la variable HOSTNAME
|
||||
HOST="$HOSTNAME"
|
||||
# Si no, tomar del DHCP, opción host-name /* (comentario para Doxygen)
|
||||
[ -z "$HOST" ] && HOST=$(awk -F\" '/option host-name/ {gsub(/;/,""); host=$2}
|
||||
END {print host}
|
||||
' /var/lib/dhcp3/dhclient.leases)
|
||||
# Si no, leer el parámetro del kernel hostname (comentario para Doxygen) */
|
||||
[ -z "$HOST" ] && HOST=$(awk 'BEGIN {RS=""; FS="="}
|
||||
$1~/hostname/ {print $2}' /proc/cmdline)
|
||||
[ "$HOSTNAME" != "$HOST" ] && export HOSTNAME="$HOST"
|
||||
[ -n "$HOST" ] && echo $HOST
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetIpAddress
|
||||
#@brief Muestra la dirección IP del sistema
|
||||
#@return str_ip - Dirección IP
|
||||
#@version 0.10 - Integración en OpenGnSys 0.10
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-02-11
|
||||
#@version 1.0 - Integración OpenGnSys 0.10 Opengnsys 0.10-testing
|
||||
#@note Usa las variables utilizadas por el initrd "/etc/net-ethX.conf
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga.
|
||||
#@date 2011-02-24
|
||||
#@version 1.0.2 - Soporte para varias tarjetas de red
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-06-17
|
||||
#*/ ##
|
||||
function ogGetIpAddress ()
|
||||
{
|
||||
local IP
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 192.168.0.10"
|
||||
return
|
||||
fi
|
||||
if [ -n "$IPV4ADDR" ]; then
|
||||
IP="$IPV4ADDR"
|
||||
else
|
||||
# Obtener direcciones IP.
|
||||
if [ -n "$DEVICE" ]; then
|
||||
IP=$(ip -o address show up dev "$DEVICE" 2>/dev/null | awk '{if ($3~/inet$/) {printf ("%s ", $4)}}')
|
||||
else
|
||||
IP=$(ip -o address show up | awk '$2!~/lo/ {if ($3~/inet$/) {printf ("%s ", $4)}}')
|
||||
fi
|
||||
fi
|
||||
# Mostrar solo la primera.
|
||||
echo "${IP%%/*}" # (comentario para Doxygen) */
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetMacAddress
|
||||
#@brief Muestra la dirección Ethernet del cliente.
|
||||
#@return str_ether - Dirección Ethernet
|
||||
#@version 0.10 - Integración en OpenGnSys 0.10
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-02-11
|
||||
#@version 1.0.2 - Soporte para varias tarjetas de red
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-06-17
|
||||
#*/ ##
|
||||
function ogGetMacAddress ()
|
||||
{
|
||||
local MAC
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 00:11:22:33:44:55"
|
||||
return
|
||||
fi
|
||||
# Obtener direcciones Ethernet.
|
||||
if [ -n "$DEVICE" ]; then
|
||||
MAC=$(ip -o link show up dev "$DEVICE" 2>/dev/null | awk '{sub (/.*\\/, ""); if ($1~/ether/) printf ("%s ", toupper($2));}')
|
||||
else
|
||||
MAC=$(ip -o link show up | awk '$2!~/lo/ {sub (/.*\\/, ""); if ($1~/ether/) printf ("%s ", toupper($2));}')
|
||||
fi
|
||||
# Mostrar sólo la primera.
|
||||
echo ${MAC%% *}
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetNetInterface
|
||||
#@brief Muestra la interfaz de red del sistema
|
||||
#@return str_interface - interfaz de red
|
||||
#@version 1.0 - Integración OpenGnSys 0.10 Opengnsys 0.10-testing
|
||||
#@note Usa las variables utilizadas por el initrd "/etc/net-ethX.conf
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga.
|
||||
#@date 2011-02-24
|
||||
#*/ ##
|
||||
function ogGetNetInterface ()
|
||||
{
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => eth0"
|
||||
return
|
||||
fi
|
||||
[ -n "$DEVICE" ] && echo "$DEVICE"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetRepoIp
|
||||
#@brief Muestra la dirección IP del repositorio de datos.
|
||||
#@return str_ip - Dirección IP
|
||||
#@version 0.10 - Integración en OpenGnSys 0.10
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-01-13
|
||||
#@version 1.0 - Integración OpenGnSys 0.10 Opengnsys 0.10-testing
|
||||
#@note Comprobacion segun protocolo de conexion al Repo
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga.
|
||||
#@date 2011-02-24
|
||||
#@version 1.0.6 - Obtener datos del punto de montaje, evitando fallo si $ogprotocol está vacía.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-08-27
|
||||
#*/ ##
|
||||
function ogGetRepoIp ()
|
||||
{
|
||||
# Variables locales.
|
||||
local SOURCE FSTYPE
|
||||
|
||||
# Mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 192.168.0.2"
|
||||
return
|
||||
fi
|
||||
|
||||
# Obtener direcciones IP, según el tipo de montaje.
|
||||
eval $(findmnt -P -o SOURCE,FSTYPE $OGIMG)
|
||||
case "$FSTYPE" in
|
||||
nfs) echo "$SOURCE" | cut -f1 -d: ;;
|
||||
cifs) echo "$SOURCE" | cut -f3 -d/ ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetServerIp
|
||||
#@brief Muestra la dirección IP del Servidor de OpenGnSys.
|
||||
#@return str_ip - Dirección IP
|
||||
#@version 0.10 - Integración en OpenGnSys 0.10
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-01-13
|
||||
#@version 1.0 - Integración OpenGnSys 0.10 Opengnsys 0.10-testing
|
||||
#@note Comprobacion segun protocolo de conexion al Repo
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga.
|
||||
#@date 2011-02-24
|
||||
#@version 1.0.6 - Obtener datos del punto de montaje, evitando fallo si $ogprotocol está vacía.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-08-27
|
||||
#*/ ##
|
||||
function ogGetServerIp ()
|
||||
{
|
||||
# Variables locales.
|
||||
local SOURCE FSTYPE
|
||||
|
||||
# Mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "$FUNCNAME => 192.168.0.2"
|
||||
return
|
||||
fi
|
||||
|
||||
# Obtener direcciones IP, según el tipo de montaje.
|
||||
eval $(findmnt -P -o SOURCE,FSTYPE $OPENGNSYS)
|
||||
case "$FSTYPE" in
|
||||
nfs) echo "$SOURCE" | cut -f1 -d: ;;
|
||||
cifs) echo "$SOURCE" | cut -f3 -d/ ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogMakeGroupDir [ str_repo ]
|
||||
#@brief Crea el directorio para el grupo del cliente.
|
||||
#@param str_repo repositorio de imágenes (opcional)
|
||||
#@return (nada)
|
||||
#@note repo = { REPO, CACHE } REPO por defecto
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@version 1.0.5 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2013-09-26
|
||||
#*/
|
||||
function ogMakeGroupDir ()
|
||||
{
|
||||
local REPO DIR GROUP
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME str_repo" \
|
||||
"$FUNCNAME" "$FUNCNAME REPO"
|
||||
return
|
||||
fi
|
||||
# Error si se recibe más de 1 parámetro.
|
||||
case $# in
|
||||
0) REPO="REPO" ;;
|
||||
1) REPO="$1" ;;
|
||||
*) ogRaiseError $OG_ERR_FORMAT "$*"
|
||||
return $? ;;
|
||||
esac
|
||||
# Comprobar tipo de repositorio.
|
||||
DIR=$(ogGetPath "$REPO" / 2>/dev/null)
|
||||
[ -n "$DIR" ] || ogRaiseError $OG_ERR_FORMAT "$1"
|
||||
GROUP="$(ogGetGroupName)"
|
||||
if [ -n "$GROUP" ]; then
|
||||
mkdir -p "$DIR/groups/$GROUP" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
|
@ -0,0 +1,543 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file PostConf.lib
|
||||
#@brief Librería o clase PostConf
|
||||
#@class PostConf
|
||||
#@brief Funciones para la postconfiguración de sistemas operativos.
|
||||
#@version 1.1.0
|
||||
#@warning License: GNU GPLv3+
|
||||
#*/
|
||||
|
||||
|
||||
#/**
|
||||
# ogCleanOs int_ndisk int_nfilesys
|
||||
#@brief Elimina los archivos que no son necesarios en el sistema operativo.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_nfilesys nº de orden del sistema de archivos
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Disco o particion no corresponden con un dispositivo.
|
||||
#@exception OG_ERR_PARTITION Partición desconocida o no accesible.
|
||||
#@note Antes incluido en la funcion ogReduceFs
|
||||
#@author Irina Gomez. Universidad de Sevilla.
|
||||
#@return (nada)
|
||||
#@date 2014-10-27
|
||||
#*/ ##
|
||||
function ogCleanOs ()
|
||||
{
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \
|
||||
"$FUNCNAME 1 1"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 2 parámetros.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME int_ndisk int_nfilesys" || return $?
|
||||
|
||||
case "$(ogGetOsType $1 $2)" in
|
||||
Linux)
|
||||
# Borramos los ficheros de dispositivos y los temporales.
|
||||
ogCleanLinuxDevices $1 $2
|
||||
rm -rf $(ogMount $1 $2)/tmp/* #*/ Comentario Doxygen
|
||||
;;
|
||||
Windows)
|
||||
# Borrar ficheros de hibernación y paginación de Windows.
|
||||
[ -n "$(ogGetPath $1 $2 pagefile.sys)" ] && ogDeleteFile $1 $2 pagefile.sys
|
||||
[ -n "$(ogGetPath $1 $2 hiberfil.sys)" ] && ogDeleteFile $1 $2 hiberfil.sys
|
||||
[ -n "$(ogGetPath $1 $2 swapfile.sys)" ] && ogDeleteFile $1 $2 swapfile.sys
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#/**
|
||||
# ogInstallMiniSetup int_ndisk int_npartition str_filename [str_admuser str_admpassword bool_autologin [str_autouser str_autopassword] ]
|
||||
#@brief Metafunción para instalar archivo que se ejecutará en el arranque de Windows.
|
||||
#@see ogInstallFirstBoot ogInstallRunonce
|
||||
#*/ ##
|
||||
function ogInstallMiniSetup ()
|
||||
{
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$MSG_SEE ogInstallFirstBoot ogInstallRunonce"
|
||||
return
|
||||
fi
|
||||
case $# in
|
||||
3) # Ejecución en el primer arranque de la máquina.
|
||||
ogInstallFirstBoot "$@" ;;
|
||||
6|8) # Ejecución en el "runonce".
|
||||
ogInstallRunonce "$@" ;;
|
||||
*) ogRaiseError $OG_ERR_FORMAT
|
||||
return $? ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogInstallFirstBoot int_ndisk int_npartition str_filename
|
||||
#@brief Crea unas claves del registro y el archivo cmd que se ejecutara en el primer arranque estando la maquina en un estado bloqueado
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@param str_filename nombre del archivo .cmd a ejecutar en el arranque
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@note El archivo estará en system32 y será visible por el sistema.
|
||||
#@version 1.0.2 - Nueva función
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2011-06-29
|
||||
#@version 1.0.4 - Heredada de antigua función ogInstallMiniSetup.
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2012-04-16
|
||||
#*/ ##
|
||||
function ogInstallFirstBoot ()
|
||||
{
|
||||
local MNTDIR DIR CMDDIR CMDFILE
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition str_filename" \
|
||||
"$FUNCNAME 1 1 filename.cmd"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
|
||||
# Comprobar que existe el directorio del fichero de comandos.
|
||||
MNTDIR=$(ogMount "$1" "$2") || return $?
|
||||
for i in winnt windows; do
|
||||
DIR=$(ogGetPath $MNTDIR/$i/system32)
|
||||
[ -n "$DIR" ] && CMDDIR=$DIR
|
||||
done
|
||||
[ -n "$CMDDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$MNTDIR/windows/system32" || return $?
|
||||
CMDFILE="$CMDDIR/$3"
|
||||
|
||||
# Creamos el archivo cmd y creamos un par de comandos para que una vez acabe la
|
||||
# postconfiguracion resetee el mini setup, sino lo haria en cada arranque.
|
||||
cat > "$CMDFILE" << EOF
|
||||
REG ADD HKLM\System\Setup /v SystemSetupInProgress /t REG_DWORD /d 0 /f
|
||||
REG ADD HKLM\System\Setup /v CmdLine /t REG_SZ /d "" /f
|
||||
EOF
|
||||
|
||||
# Crear los valores de registro necesarios para que se haga la ejecución del .cmd al aranque.
|
||||
ogSetRegistryValue "$MNTDIR" SYSTEM "\Setup\SystemSetupInProgress" 1
|
||||
ogSetRegistryValue "$MNTDIR" SYSTEM "\Setup\SetupType" 4
|
||||
#ogDeleteRegistryValue "$MNTDIR" SYSTEM "\Setup\CmdLine"
|
||||
ogAddRegistryValue "$MNTDIR" SYSTEM "\Setup\CmdLine"
|
||||
ogSetRegistryValue "$MNTDIR" SYSTEM "\Setup\CmdLine" "cmd.exe /c $(basename $CMDFILE)"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogInstallRunonce int_ndisk int_npartition str_filename str_adm_user str_adm_password bool_autologin [str_auto_user str_auto_password]
|
||||
#@brief Crea el archivo cmd que se ejecutara en el runonce de un usuario administrador
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@param str_filename nombre del archivo .cmd a ejecutar en el arranque (estara en system32 y sera visible por el sistema)
|
||||
#@param str_adm_user usuario administrador para hacer autologin y ejecutar el runonce
|
||||
#@param str_adm_password password del usuario administrador
|
||||
#@param bool_autologin si despues de la postconfiguracion queremos que la maquina haga autologin (0 o 1)
|
||||
#@param str_auto_user Usuario con el que queremos que haga autologin despues de la postconfiguracion
|
||||
#@param str_auto_password Password del usuario que hara autologin
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@version 1.0.2 - Nueva función
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2011-06-29
|
||||
#@version 1.0.4 - Heredado de antigua función ogInstallMiniSetup
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2012-04-16
|
||||
#@version 1.1.0 - Resuelve problemas a partir de Windows 10
|
||||
#@author Carmelo Cabezuelo Aguilar - Universidad Politécnica de Valencia
|
||||
#@date 2018-02-20
|
||||
#*/ ##
|
||||
function ogInstallRunonce ()
|
||||
{
|
||||
local MOUNTPOINT DIR CMDDIR CMDFILE
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition str_filename str_adm_user str_adm_password bool_autologin [str_auto_user str_auto_password]" \
|
||||
"$FUNCNAME 1 1 filename.cmd administrator passadmin 1 userauto passuserauto" \
|
||||
"$FUNCNAME 1 1 filename.cmd administrator passadmin 0"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 6 u 8 parámetros.
|
||||
[ $# == 6 -o $# == 8 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
|
||||
# Punto de montaje.
|
||||
MOUNTPOINT="$(ogGetPath "$1" "$2" /)"
|
||||
# Comprobar que existe el directorio del fichero de comandos.
|
||||
for i in winnt windows; do
|
||||
DIR=$(ogGetPath $MOUNTPOINT/$i/system32)
|
||||
[ -n "$DIR" ] && CMDDIR=$DIR
|
||||
done
|
||||
[ -n "$CMDDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$MOUNTPOINT/Windows/System32" || return $?
|
||||
CMDFILE="$CMDDIR/$3"
|
||||
|
||||
if [ $6 == 0 ]; then
|
||||
# Si no queremos hacer autologin despues de la postconfiguracion lo indicamos en las claves de registro
|
||||
cat > "$CMDFILE" << EOF
|
||||
DEL C:\ogboot.*
|
||||
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f
|
||||
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "" /f
|
||||
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f
|
||||
EOF
|
||||
else
|
||||
# Si queremos hacer autologin despues de la postconfiguracion introducimos la informacion en las claves de registro
|
||||
cat > "$CMDFILE" << EOF
|
||||
DEL C:\ogboot.*
|
||||
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
|
||||
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "$7" /f
|
||||
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d "$8" /f
|
||||
EOF
|
||||
fi
|
||||
#Creamos las claves de registro necesarias para que meter el cmd en el runonce del usuario y este haga autologin
|
||||
ogAddRegistryValue $MOUNTPOINT software '\Microsoft\Windows\CurrentVersion\RunOnce\PostConfiguracion' 2>/dev/null
|
||||
ogSetRegistryValue $MOUNTPOINT software '\Microsoft\Windows\CurrentVersion\RunOnce\PostConfiguracion' "C:\windows\system32\\$3" 2>/dev/null
|
||||
ogAddRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon' 2>/dev/null
|
||||
ogSetRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon' 1 2>/dev/null
|
||||
ogAddRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName' 2>/dev/null
|
||||
ogSetRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName' "$4" 2>/dev/null
|
||||
ogAddRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName' 2>/dev/null
|
||||
ogSetRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName' ".\\" 2>/dev/null
|
||||
ogAddRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword' 2>/dev/null
|
||||
ogSetRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword' "$5" 2>/dev/null
|
||||
ogDeleteRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\ForceAutoLockOnLogon' 2>/dev/null
|
||||
ogDeleteRegistryValue $MOUNTPOINT software '\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoLogonCount' 2>/dev/null
|
||||
}
|
||||
|
||||
#/**
|
||||
# ogAddCmd int_ndisk int_npartition str_filename str_commands
|
||||
#@brief Añade comandos al cmd creado por ogInstalMiniSetup
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@param str_filename nombre del fichero cmd (siempre se guardara en windows\system32\para que sea visible por el sistema
|
||||
#@param str_commands comando o comandos que se añadiran al fichero
|
||||
#@return
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
|
||||
#@version 1.0.2 - Nueva función
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2011-06-29
|
||||
#@version 1.0.4 - Cambios en los parametros de entrada de la funcion
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2012-04-16
|
||||
#*/ ##
|
||||
function ogAddCmd ()
|
||||
{
|
||||
local MOUNTPOINT CMDFILE
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition str_filename str_commands" \
|
||||
"$FUNCNAME 1 1 filename.cmd command"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 4 parámetros.
|
||||
[ $# == 4 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
|
||||
# Punto de montaje
|
||||
MOUNTPOINT="$(ogMount "$1" "$2")" || return $?
|
||||
# Crear fichero de comandos, si no existe.
|
||||
CMDFILE="$(ogGetPath "$MOUNTPOINT/windows/system32")/$3"
|
||||
[ -n "$CMDFILE" ] || ogInstallMiniSetup "$1" "$2" "$3"
|
||||
[ -n "$CMDFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$MOUNTPOINT/windows/system32/$3" || return $?
|
||||
|
||||
# Concatenamos el comando en el fichero de comandos
|
||||
cat >> "$CMDFILE" << EOF
|
||||
$4
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogDomainScript int_ndisk int_npartition str_domain str_user str_password
|
||||
#@brief Crea un script .vbs para unir al dominio una maquina windows y el comando adequado en el archivo cmd creado por ogInstallMiniSetup
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@param str_filename nombre del fichero cmd donde deberemos introducir el comando de ejecutar el script vbs
|
||||
#@param str_domain dominio donde se quiere conectar
|
||||
#@param str_user usuario con privilegios para unir al dominio
|
||||
#@param str_password password del usuario con privilegios
|
||||
#@return
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@version 1.0.2 - Nueva función
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2011-06-29
|
||||
#@version 1.0.4 - Cambios en los parametros de entrada de la funcion
|
||||
#@author Jonathan Alonso Martinez - Universidad Autonoma de Barcelona
|
||||
#@date 2012-04-16
|
||||
#*/ ##
|
||||
function ogDomainScript ()
|
||||
{
|
||||
local CMDDIR
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME int_ndisk int_npartition str_filename str_domain str_user str_password" \
|
||||
"$FUNCNAME 1 1 filename.cmd domain user password_user"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 6 parámetros.
|
||||
[ $# == 6 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
|
||||
# Punto de montaje
|
||||
MOUNTPOINT="$(ogMount "$1" "$2")" || return $?
|
||||
# Comprobar que existe el directorio de comandos.
|
||||
CMDDIR=$(ogGetPath "$MOUNTPOINT/windows/system32")
|
||||
[ -n "$CMDDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$1/windows/system32" || return $?
|
||||
|
||||
# Añadimos en el cmd que se ejecutara al arranque, el comando de ejecutar el script que añade al dominio.
|
||||
ogAddCmd $1 $2 "$3" "CSCRIPT joindomain.vbs"
|
||||
# Eliminamos el script porque tiene el usuario de administrador de dominio en claro
|
||||
ogAddCmd $1 $2 "$3" "DEL /Q C:\Windows\System32\joindomain.vbs"
|
||||
# Metemos unas claves de registro para que el dominio salga seleccionado por defecto
|
||||
ogAddCmd $1 $2 "$3" "REG ADD \"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" /v DefaultDomainName /t REG_SZ /d \"$4\" /f"
|
||||
|
||||
# Creamos el archivo joindomain.vbs que nos introduce la maquina en el dominio
|
||||
cat > "$CMDDIR/joindomain.vbs" << EOF
|
||||
Const JOIN_DOMAIN = 1
|
||||
Const ACCT_CREATE = 2
|
||||
Const ACCT_DELETE = 4
|
||||
Const WIN9X_UPGRADE = 16
|
||||
Const DOMAIN_JOIN_IF_JOINED = 32
|
||||
Const JOIN_UNSECURE = 64
|
||||
Const MACHINE_PASSWORD_PASSED = 128
|
||||
Const DEFERRED_SPN_SET = 256
|
||||
Const INSTALL_INVOCATION = 262144
|
||||
|
||||
strDomain = "$4"
|
||||
strUser = "$5"
|
||||
strPassword = "$6"
|
||||
|
||||
Set objNetwork = CreateObject("WScript.Network")
|
||||
strComputer = objNetwork.ComputerName
|
||||
|
||||
Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\\" & _
|
||||
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
|
||||
|
||||
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, strPassword, _
|
||||
strDomain & "\" & strUser, NULL, JOIN_DOMAIN + ACCT_CREATE)
|
||||
EOF
|
||||
|
||||
#*/ " (comentario Doxygen)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
### PRUEBAS.
|
||||
|
||||
#/**
|
||||
# ogConfigureOgagent int_ndisk int_filesys
|
||||
#@brief Modifica el fichero de configuración del nuevo agente OGAent para sistemas operativos.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_filesys nº de orden del sistema de archivos
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero o dispositivo no encontrado.
|
||||
#@exception OG_ERR_LOCKED Sistema de archivos bloqueado.
|
||||
#@version 1.1.0 - Primera adaptación para OpenGnsys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2016-07-15
|
||||
#*/ ##
|
||||
function ogConfigureOgagent ()
|
||||
{
|
||||
# Variables locales.
|
||||
local MNTDIR AGENTDIR CFGFILE
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_filesys" \
|
||||
"$FUNCNAME 1 1"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 2 parámetros.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Obtener sistema de archvios.
|
||||
MNTDIR=$(ogMount $1 $2) || return $?
|
||||
|
||||
# Comprobar si existe el fichero de configuración de OGAgent.
|
||||
for AGENTDIR in usr/share/OGAgent "Program Files/OGAgent" "Program Files (x86)/OGAgent" Applications/OGAgent.app; do
|
||||
CFGFILE=$(ogGetPath "$MNTDIR/$AGENTDIR/cfg/ogagent.cfg")
|
||||
[ -n "$CFGFILE" ] && break
|
||||
done
|
||||
[ -n "$CFGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "ogagent.cfg" || return $?
|
||||
# Parchear dirección del servidor OpenGnsys en el fichero de configuración de OGAgent.
|
||||
sed -i "0,/remote=/ s,remote=.*,remote=https://$(ogGetServerIp)/opengnsys/rest/," "$CFGFILE"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogInstallLaunchDaemon int_ndisk int_nfilesys str_filename
|
||||
#@brief Instala archivo que se ejecutará en el arranque de macOS.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_nfilesys nº de orden del sistema de archivos
|
||||
#@param str_filename nombre del script
|
||||
#return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero o directorio no encontrado.
|
||||
#@npte Crea ficheros de configuración /Library/LaunchDaemon/es.opengnsys.Script.plist.
|
||||
#@version 1.0.6 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-10-06
|
||||
#*/ ##
|
||||
function ogInstallLaunchDaemon ()
|
||||
{
|
||||
# Variables locales.
|
||||
local LAUNCHDIR SCRIPTDIR
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_filesys str_scriptname" \
|
||||
"$FUNCNAME 1 2 postconf"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Comprobar directorios.
|
||||
LAUNCHDIR=$(ogGetPath $1 $2 /Library/LaunchDaemons)
|
||||
[ -n "$LAUNCHDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$1 $2 /Library/LaunchDaemons" || return $?
|
||||
SCRIPTDIR=$(ogGetPath $1 $2 /usr/share)
|
||||
[ -n "$SCRIPTDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$1 $2 /usr/share" || return $?
|
||||
|
||||
# Crear fichero de configuración del servicio de arranque.
|
||||
cat << EOT $LAUNCHDIR/es.opengnsys.$3.plist
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>es.opengnsys.$3</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>$SCRIPTDIR/$3.sh</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/var/log/$3.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/var/log/$3.err</string>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
EOT
|
||||
|
||||
# Crear un fichero de script vacío.
|
||||
rm -f $SCRIPTDIR/$3.sh
|
||||
touch $SCRIPTDIR/$3.sh
|
||||
chmod +x $SCRIPTDIR/$3.sh
|
||||
}
|
||||
|
||||
|
||||
### PRUEBAS.
|
||||
|
||||
#/**
|
||||
# ogAddToLaunchDaemon int_ndisk int_nfilesys str_filename str_commands
|
||||
#@brief Añade comandos al script creado por ogInstalLaunchDaemon.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_nfilesys nº de orden del sistema de archivos
|
||||
#@param str_filename nombre del script (siempre se guardará en /usr/share para que sea visible por el sistema
|
||||
#@param str_commands comando o comandos que se añadiran al fichero
|
||||
#return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero o directorio no encontrado.
|
||||
#@version 1.0.6 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-10-06
|
||||
#*/ ##
|
||||
function ogAddToLaunchDaemon ()
|
||||
{
|
||||
# Variables locales.
|
||||
local SCRIPTFILE
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_filesys str_scriptname" \
|
||||
"$FUNCNAME 1 2 postconf \"diskutil enableJournal disk0s2\""
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 4 parámetros.
|
||||
[ $# == 4 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Comprobar que existe el fichero de comandos.
|
||||
SCRIPTFILE=$(ogGetPath $1 $2 "/usr/share/$3.sh")
|
||||
[ -n "$SCRIPTFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$1 $2 /usr/share/$3" || return $?
|
||||
|
||||
# Concatenamos el comando en el fichero de comandos
|
||||
cat >> "$SCRIPTFILE" << EOT
|
||||
$4
|
||||
EOT
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogUninstallLinuxClient int_ndisk int_filesys
|
||||
#@brief Desinstala el cliente OpenGnSys para sistemas operativos GNU/Linux.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_filesys nº de orden del sistema de archivos
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_PARTITION Paritición o sistema de archivos incorrectos.
|
||||
#@exception OG_ERR_LOCKED Sistema de archivos bloqueado.
|
||||
#@version 1.1.0 - Primera adaptación para OpenGnsys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2016-08-22
|
||||
#*/ ##
|
||||
function ogUninstallLinuxClient ()
|
||||
{
|
||||
# Variables locales.
|
||||
local MNTDIR
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_filesys" \
|
||||
"$FUNCNAME 1 1"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 2 parámetros.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Obtener sistema de archvios.
|
||||
MNTDIR=$(ogMount $1 $2) || return $?
|
||||
|
||||
# Borrar ficheros y quitar llamada al cliente durante el proceso de inicio.
|
||||
rm -f $MNTDIR/{usr/sbin,sbin,usr/local/sbin}/ogAdmLnxClient
|
||||
rm -f $MNTDIR/{etc,usr/local/etc}/ogAdmLnxClient.cfg
|
||||
sed -i -e '/ogAdmLnxClient/ d' $MNTDIR/{etc,usr/local/etc}/{rc.local,rc.d/rc.local} 2>/dev/null
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogUninstallWindowsClient int_ndisk int_filesys str_filename
|
||||
#@brief Desinstala el cliente OpenGnSys para sistemas operativos Windows.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_npartition nº de orden de la partición
|
||||
#@param str_filename nombre del fichero cmd donde deberemos introducir el comando de ejecutar el script vbs
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_PARTITION Paritición o sistema de archivos incorrectos.
|
||||
#@exception OG_ERR_LOCKED Sistema de archivos bloqueado.
|
||||
#@version 1.1.0 - Primera adaptación para OpenGnsys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2016-08-22
|
||||
#*/ ##
|
||||
|
||||
function ogUninstallWindowsClient ()
|
||||
{
|
||||
# Variables locales.
|
||||
local MNTDIR
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_filesys str_filename" \
|
||||
"$FUNCNAME 1 1 filename.cmd"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Obtener sistema de archvios.
|
||||
MNTDIR=$(ogMount "$1" "$2") || return $?
|
||||
|
||||
# Crear órdenes para desinstalar servicio y borrar ejecutable del cliente.
|
||||
if [ -n "$(ogGetPath $MNTDIR/windows/ogAdmWinClient.exe)" -o -n "$(ogGetPath $MNTDIR/winnt/ogAdmWinClient.exe)" ]; then
|
||||
ogAddCmd $1 $2 "$3" 'ogAdmWinClient -remove'
|
||||
ogAddCmd $1 $2 "$3" 'DEL C:\Windows\ogAdmWinClient.exe'
|
||||
ogAddCmd $1 $2 "$3" 'DEL C:\Winnt\ogAdmWinClient.exe'
|
||||
fi
|
||||
}
|
||||
|
|
@ -0,0 +1,699 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ogLoadHiveWindows int_ndisk int_partiton
|
||||
#@brief Localiza los hive del registro de windows (de sistema y usuarios)
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_partition nº de particion
|
||||
#@return
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
|
||||
#@version 0.9 - Adaptación a OpenGNSys.
|
||||
#@author Antonio J. Doblas Viso. Universidad de Málaga
|
||||
#@date 2009-09-24
|
||||
#*/ ##
|
||||
|
||||
|
||||
function ogLoadHiveWindows () {
|
||||
# Variables locales.
|
||||
local PART DISK
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partition" \
|
||||
"$FUNCNAME 1 1 "
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 2 parámetros.
|
||||
[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
|
||||
|
||||
DISK=$1; PART=$2;
|
||||
|
||||
#Comprobaciones redundantes: borrar"
|
||||
#ogDiskToDev $DISK $PART || return $(ogRaiseError $OG_ERR_PARTITION "particion de windows no detectada"; echo $?)
|
||||
#ogGetOsType $DISK $PART | grep "Windows" || return $(ogRaiseError $OG_ERR_NOTOS "no es windows"; echo $?)
|
||||
#VERSION=$(ogGetOsVersion $DISK $PART)
|
||||
#Fin Comprobaciones redundantes: borrar"
|
||||
|
||||
|
||||
# primera fase, carga de los hive del sistema
|
||||
if ogGetPath $DISK $PART WINDOWS
|
||||
then
|
||||
SYSTEMROOT="Windows"
|
||||
elif ogGetPath $DISK $PART WINNT
|
||||
then
|
||||
SYSTEMROOT="winnt"
|
||||
else
|
||||
return $(ogRaiseError $OG_ERR_NOTOS "version windows no detectada"; echo $?)
|
||||
fi
|
||||
|
||||
hiveSAM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/SAM)
|
||||
[ -n "$hiveSAM" ] && export hiveSAM || return $(ogRaiseError $OG_ERR_NOTOS " hive SAM no detectada"; echo $?)
|
||||
hiveSYSTEM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/system)
|
||||
[ -n "$hiveSYSTEM" ] && export hiveSYSTEM || return $(ogRaiseError $OG_ERR_NOTOS "hive SYSTEM no detectada"; echo $?)
|
||||
hiveSOFTWARE=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/software)
|
||||
[ -n "$hiveSOFTWARE" ] && export hiveSOFTWARE || return $(ogRaiseError $OG_ERR_NOTOS "hive SOFTWARE no detectada"; echo $?)
|
||||
export TEMPhive=/tmp/tmpregistry
|
||||
|
||||
# segunda fase, carga de los hive de usuarios windows.
|
||||
declare -i COUNT
|
||||
COUNT=3
|
||||
#TODO WINDOWS XP WINDOWS7
|
||||
BASEHOMEDIR=$(ogGetPath $DISK $PART /"Documents and Settings")
|
||||
TMPUSERFILE="/tmp/WuserRegAndDAT.tmp"
|
||||
find "$BASEHOMEDIR/" -type f -name NTUSER.DAT > $TMPUSERFILE
|
||||
LISTUSERS=$(drbl-chntpw -l $hiveSAM | grep RID | awk -F"<" '{print $2}' | awk -F">" '{print $1}')
|
||||
#echo "$BASEHOMEDIR" $LISTUSERS
|
||||
for user in $LISTUSERS
|
||||
do
|
||||
# Comprobamos que el usuario registrado tiene .DAT
|
||||
if HOMEDIR=$(cat $TMPUSERFILE | grep -w $user)
|
||||
then
|
||||
#echo "$user exportamos los usuarios de windows como variables, y como valor hiveUSERX; donde la X es 3 4 5 6 ... X"
|
||||
export `echo $user=hiveUSER$COUNT`
|
||||
#echo "$user exportamos la variable hiveUSERX con el valor del home de la variable-usuario_windows"
|
||||
##export `echo hiveUSER$COUNT`="$(echo $HOMEDIR | sed -e 's/ /\\ /'g | sed -e 's/\\/\\\\/g')"
|
||||
export `echo hiveUSER$COUNT`="$(echo $HOMEDIR)"
|
||||
#echo " estas variables \$USUARIO -> Identificador del HIVE ; \${!USUARIO} -> path del HIVE "
|
||||
COUNT=${COUNT}+1
|
||||
fi
|
||||
|
||||
done
|
||||
COUNT=0
|
||||
}
|
||||
|
||||
|
||||
# ogUpdateHiveWindows
|
||||
#@brief Actualiza los hive de windows.
|
||||
#@param int_ndisk
|
||||
#@param int_partition
|
||||
#@return
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
|
||||
#@version 0.9 - Adaptación a OpenGNSys.
|
||||
#@author Antonio J. Doblas Viso. Universidad de Málaga
|
||||
#@date 2009-09-24
|
||||
#*/ ##
|
||||
|
||||
|
||||
function ogUpdateHiveWindows (){
|
||||
# Variables locales.
|
||||
local PART DISK FILE
|
||||
|
||||
#TODO detectar llamada a ogLoadHiveWindows
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME " \
|
||||
"$FUNCNAME "
|
||||
return
|
||||
fi
|
||||
|
||||
echo drbl-chntpw -f $TEMPhive $hiveSAM $hiveSYSTEM $hiveSOFTWARE \"${hiveUSER3}\" \"${hiveUSER4}\" \"${hiveUSER5}\" \"${hiveUSER6}\" \"${hiveUSER7}\" \"${hiveUSER8}\" \"${hiveUSER9}\" > /tmp/run.sh
|
||||
cat /tmp/run.sh; sh /tmp/run.sh; rm -fr $TEMPhive; rm /tmp/run.sh
|
||||
|
||||
unset hiveSAM hiveSYSTEM hiveSOFTWARE TEMPhive hiveUSER3 hiveUSER4 hiveUSER5 hiveUSER6 hiveUSER7 hiveUSER8 hiveUSER9
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ogHiveNTRunMachine () {
|
||||
#echo sintaxis: PathScripts idScripts
|
||||
#echo ejemplo: c:\\\\WINDOSWS\\\\crearusuarios.bat scripts1
|
||||
#echo IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
|
||||
#echo "identifica 0=$hiveSAM 1=$hiveSystem 2=$hiveSoftware 3=$HiveUser3"
|
||||
|
||||
local PART DISK FILE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME PathScripts|command keyName " \
|
||||
"$FUNCNAME c:\\\\Windows\\\\crearusuarios.cmd scripts_crearUsuarios "\
|
||||
"$FUNCNAME "cmd /c del c:\ogboot.*" ogcleanboot "\
|
||||
"$FUNCNAME Requiere la previa ejecución de ogLoadHive int_disk int_part"\
|
||||
"$FUNCNAME Despues requiere el ogUpdateHive"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
# Error si no se reciben al menos 1 parámetros.
|
||||
[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
|
||||
|
||||
|
||||
cat >> $TEMPhive << EOF
|
||||
h 2
|
||||
cd \Microsoft\Windows\CurrentVersion\Run
|
||||
nv 1 $2
|
||||
ed $2
|
||||
$1
|
||||
EOF
|
||||
#ogGetRegistryValue /mnt/sda1 software '\Microsoft\Windows\CurrentVersion\Run\og3'
|
||||
}
|
||||
|
||||
function ogNTPolUserOn () {
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME id_hive_user " \
|
||||
"$FUNCNAME NombreUsuario"\
|
||||
"$FUNCNAME "
|
||||
return
|
||||
fi
|
||||
|
||||
# TODO: error si no se ha llamado previamente a ogLoadHiveWindows
|
||||
[ -n $hiveSAM ] || return $(ogRaiseError $OG_ERR_FORMAT "se debe utilizar primero la utilidad ogLoadHiveWindows"; echo $?)
|
||||
|
||||
# TODO: error si el usuario no tiene cuenta en windows.
|
||||
drbl-chntpw -l $hiveSAM | grep RID | grep -w $1 || return $(ogRaiseError $OG_ERR_FORMAT "el usuario $1 no tiene cuenta en este windows: Compruebe mayusculas o minusculas"; echo $?)
|
||||
|
||||
# TODO: error si no el usario no no tiene HIVE asociado.
|
||||
[ -n "${!1}" ] || return $(ogRaiseError $OG_ERR_FORMAT "el usuario no tiene hive creado"; echo $?)
|
||||
|
||||
|
||||
HIVEID=$(echo ${!1} | tr -d "hiveUSER")
|
||||
|
||||
|
||||
#echo "IMPORTANTE: la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
|
||||
echo $HIVEID
|
||||
#cp /var/EAC/admin/utilswin/Fondo.BMP ${particion}/WINDOWS/
|
||||
|
||||
cat >> $TEMPhive << EOF
|
||||
h $HIVEID
|
||||
cd \Control Panel\Desktop
|
||||
ed Wallpaper
|
||||
C:\\WINDOWS\\fondo.bmp
|
||||
|
||||
cd \Software\Microsoft\Windows\CurrentVersion\Policies
|
||||
nk Explorer
|
||||
cd Explorer
|
||||
|
||||
nv 4 NoDesktop
|
||||
ed NoDesktop
|
||||
1
|
||||
|
||||
nv 4 NoSimpleStartMenu
|
||||
ed NoSimpleStartMenu
|
||||
1
|
||||
nv 4 NoWindowsUpdate
|
||||
ed NoWindowsUpdate
|
||||
1
|
||||
|
||||
nv 4 NoSMConfigurePrograms
|
||||
ed NoSMConfigurePrograms
|
||||
1
|
||||
|
||||
nv 4 NoChangeStartMenu
|
||||
ed NoChangeStartMenu
|
||||
1
|
||||
|
||||
nv 4 Intellimenus
|
||||
ed Intellimenus
|
||||
1
|
||||
|
||||
nv 4 NoRun
|
||||
ed NoRun
|
||||
1
|
||||
|
||||
nv 4 NoRecentDocsHistory
|
||||
ed NoRecentDocsHistory
|
||||
1
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##########################################################
|
||||
##########################################################
|
||||
#####librerias de PostConfiguracion v0.1para Advanced Deploy enViorenment###########
|
||||
# Liberado bajo licencia GPL <http://www.gnu.org/licenses/gpl.html>################
|
||||
############# 2008 Antonio Jes<65>s Doblas Viso adv@uma.es ##########################
|
||||
########### Universidad de Malaga (Spain)############################
|
||||
##########################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function NTChangeName () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: NTChangeNAME str_$var
|
||||
echo ejemplos: NTCHangeName adi${IPcuatro}-xp
|
||||
fi
|
||||
cat >> $temporal << EOF
|
||||
h 1
|
||||
ed ControlSet001\Control\ComputerName\ComputerName\ComputerName
|
||||
$1
|
||||
ed ControlSet001\Services\Tcpip\Parameters\Hostname
|
||||
$1
|
||||
ed ControlSet001\Services\Tcpip\Parameters\NV Hostname
|
||||
$1
|
||||
h 2
|
||||
cd \Microsoft\Windows NT\CurrentVersion\Winlogon
|
||||
ed DefaultDomainName
|
||||
$1
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
function NTSetGroupName () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: NTSetGroupName str_$var
|
||||
echo ejemplos: NTSetGroupName adi
|
||||
fi
|
||||
cat >> $temporal << EOF
|
||||
h 2
|
||||
ed \Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName
|
||||
$1
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function NTSetOwner (){
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: NtSetOwner str_propietario str_organizacion
|
||||
echo ejemplos: NTSetOwner eu\ politecnica universidad\ de\ malaga
|
||||
fi
|
||||
cat >> $temporal << EOF
|
||||
h 2
|
||||
ed \Microsoft\Windows NT\CurrentVersion\RegisteredOwner
|
||||
$1
|
||||
ed \Microsoft\Windows NT\CurrentVersion\RegisteredOrganization
|
||||
$2
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function NTAutoLogon (){
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: Int_Activar Int_nves str_usuario str_passwd str_equipo
|
||||
echo ejemplos: 1 2 administrador 3451 $equipo
|
||||
echo IMPORTANTE: cuando AutoLogonCount llegue a 0, activa el AutoAdminLogon a 0. Pero no borra los valores de DefaultPassword
|
||||
return 2
|
||||
fi
|
||||
#echo la pass es $4
|
||||
export temporal=/tmp/tmpregistry
|
||||
cat >> $temporal << EOF
|
||||
hive 2
|
||||
cd \Microsoft\Windows NT\CurrentVersion\Winlogon
|
||||
nv 1 AutoAdminLogon
|
||||
ed AutoAdminLogon
|
||||
$1
|
||||
nv 1 AutoLogonCount
|
||||
ed AutoLogonCount
|
||||
$2
|
||||
nv 1 DefaultUserName
|
||||
ed DefaultUserName
|
||||
$3
|
||||
nv 1 DefaultDomainName
|
||||
ed DefaultDomainName
|
||||
$5
|
||||
EOF
|
||||
if [ "$4" == none ]
|
||||
then
|
||||
echo "debe aparecer done" $4
|
||||
cat >> $temporal << EOF
|
||||
dv DefaultPassword
|
||||
|
||||
|
||||
EOF
|
||||
else
|
||||
cat >> $temporal << EOF
|
||||
nv 1 DefaultPassword
|
||||
ed DefaultPassword
|
||||
$4
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
function NTStatusRatonTeclado (){
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: Int-StatusRaton Int-StatusTeclado
|
||||
echo ejemplos: int=1 activo int=4 desactivado
|
||||
return 2
|
||||
fi
|
||||
cat >> $temporal << EOF
|
||||
hive 1
|
||||
cd \ControlSet001\Services\Mouclass
|
||||
ed Start
|
||||
$1
|
||||
cd \ControlSet001\Services\Kbdclass
|
||||
ed Start
|
||||
$2
|
||||
EOF
|
||||
}
|
||||
|
||||
function NTRunOnceMachine () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: PathScripts idScripts
|
||||
echo "ejemplo: c:\\\\WINDOSWS\\\\crearusuarios.bat scripts1"
|
||||
echo "IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\"
|
||||
return 2
|
||||
fi
|
||||
export temporal=/tmp/tmpregistry
|
||||
cat >> $temporal << EOF
|
||||
h 2
|
||||
cd \Microsoft\Windows\CurrentVersion\RunOnce
|
||||
nv 1 $2
|
||||
ed $2
|
||||
$1
|
||||
EOF
|
||||
}
|
||||
|
||||
function NTRunMachine () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: PathScripts idScripts
|
||||
echo ejemplo: c:\\\\WINDOSWS\\\\crearusuarios.bat scripts1
|
||||
echo IMPORTANTE: el path debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
|
||||
return 2
|
||||
fi
|
||||
export temporal=/tmp/tmpregistry
|
||||
cat >> $temporal << EOF
|
||||
h 2
|
||||
cd \Microsoft\Windows\CurrentVersion\Run
|
||||
nv 1 $2
|
||||
ed $2
|
||||
$1
|
||||
EOF
|
||||
}
|
||||
|
||||
function NTRunUser () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: str_PathWINScripts str_idScripts Int_hive||\$usuario
|
||||
echo ejemplo: c:\\\\WINDOSWS\\\\crearusuarios.bat scripts1 3
|
||||
echo IMPORTANTE: el pathWIN debe llevar dos barras \\, pero como se deben 'escapar' debes poner cuatro \\\\
|
||||
echo IMPORTANTE: el pathLinux si lleva espacios debe escaparse con una barra \\
|
||||
echo IMPORTANTE Int_hive: 3 para el primer usuario, 4 para el segundo usuario
|
||||
echo requiere export un HiveUser3=/mnt/windows/Document\ and\ Seeting\alumnmos\NTUSER.dat
|
||||
return 2
|
||||
fi
|
||||
cat >> $temporal << EOF
|
||||
h $3
|
||||
cd \Software\Microsoft\Windows\CurrentVersion\Run
|
||||
nv 1 $2
|
||||
ed $2
|
||||
$1
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
function NTPolUserOn () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
Msg "requiere LoadRegistryUser str_user1 str_user2..." orange
|
||||
echo "sintaxis: Int_hive"
|
||||
echo "ejemplo: NTPolUserOn 3"
|
||||
echo "IMPORTANTE: la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
|
||||
return 2
|
||||
fi
|
||||
cp /var/EAC/admin/utilswin/Fondo.BMP ${particion}/WINDOWS/
|
||||
cat >> $temporal << EOF
|
||||
h $1
|
||||
cd \Control Panel\Desktop
|
||||
ed Wallpaper
|
||||
C:\\WINDOWS\\fondo.bmp
|
||||
|
||||
cd \Software\Microsoft\Windows\CurrentVersion\Policies
|
||||
nk Explorer
|
||||
cd Explorer
|
||||
|
||||
nv 4 NoDesktop
|
||||
ed NoDesktop
|
||||
1
|
||||
|
||||
nv 4 NoSimpleStartMenu
|
||||
ed NoSimpleStartMenu
|
||||
1
|
||||
nv 4 NoWindowsUpdate
|
||||
ed NoWindowsUpdate
|
||||
1
|
||||
|
||||
nv 4 NoSMConfigurePrograms
|
||||
ed NoSMConfigurePrograms
|
||||
1
|
||||
|
||||
nv 4 NoChangeStartMenu
|
||||
ed NoChangeStartMenu
|
||||
1
|
||||
|
||||
nv 4 Intellimenus
|
||||
ed Intellimenus
|
||||
1
|
||||
|
||||
nv 4 NoRun
|
||||
ed NoRun
|
||||
1
|
||||
|
||||
nv 4 NoRecentDocsHistory
|
||||
ed NoRecentDocsHistory
|
||||
1
|
||||
EOF
|
||||
}
|
||||
|
||||
function NTPolUserOFF () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
Msg "requiere LoadRegistryUser str_user1 str_user2..." orange
|
||||
echo "sintaxis: Int_hive"
|
||||
echo "ejemplo: NTPolUserOFF 3"
|
||||
echo "IMPORTANTE: la variable HiveUser3=/mnt/windows/Document/\ and/\ Seeting\alumnmos\NTUSER.dat"
|
||||
return 2
|
||||
fi
|
||||
cat >> $temporal << EOF
|
||||
h $1
|
||||
cd \Control Panel\Desktop
|
||||
ed Wallpaper
|
||||
C:\\WINDOWS\\web\\wallpaper\\Felicidad.bmp
|
||||
|
||||
cd \Software\Microsoft\Windows\CurrentVersion\
|
||||
rdel Policies
|
||||
nk Policies
|
||||
1
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function ogSetWindowsChkdisk() {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: true|TRUE|0 false|false|1
|
||||
echo ejemplos: int=0 desactivado int=1 activado
|
||||
return 2
|
||||
fi
|
||||
case $1 in
|
||||
0|true|TRUE)
|
||||
valor="autocheck autochk *";;
|
||||
1|false|FALSE)
|
||||
valor="none";;
|
||||
*)
|
||||
return 0 ;;
|
||||
esac
|
||||
|
||||
cat >> $TEMPhive << EOF
|
||||
hive 1
|
||||
cd \ControlSet001\Control\Session Manager
|
||||
ed BootExecute
|
||||
$valor
|
||||
--n
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
### FASE DE PRUEBAS NO FUNCIONA
|
||||
function NTStartRecovery () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo sintaxis: Int-Status
|
||||
echo ejemplos: int=0 desactivado int=1 activado
|
||||
return 2
|
||||
fi
|
||||
|
||||
[ $1 = 0 ] && valor="none"
|
||||
[ $1 = 1 ] && valor="00000000"
|
||||
|
||||
|
||||
cat >> $TEMPhive << EOF
|
||||
hive 2
|
||||
#cd \Policies\Microsoft\Windows\WinRE
|
||||
#ed DisableSetup
|
||||
cd \Policies\Microsoft\Windows
|
||||
nk WinRE
|
||||
nv 4 DisableSetup
|
||||
ed DisableSetup
|
||||
$valor
|
||||
--n
|
||||
EOF
|
||||
|
||||
|
||||
#Activado
|
||||
#[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRE]
|
||||
#"DisableSetup"=-
|
||||
|
||||
# Desactivado
|
||||
#[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRE]
|
||||
#"DisableSetup"=dword:00000000
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ogSchrootLinux () {
|
||||
|
||||
# Variables locales.
|
||||
local PART DISK DIRCONF SCHROOTDEVICE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partition" \
|
||||
"$FUNCNAME 1 1 "
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 2 parámetros.
|
||||
[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
|
||||
|
||||
DISK=$1; PART=$2; DIRCONF="/etc/schroot"
|
||||
|
||||
|
||||
VERSION=$(ogGetOsVersion $DISK $PART)
|
||||
echo $VERSION | grep "Linux" || return $(ogRaiseError $OG_ERR_NOTOS "no es linux"; echo $?)
|
||||
|
||||
ogUnmount $DISK $PART || return $(ogRaiseError $OG_ERR_NOTOS "no es linux"; echo $?)
|
||||
|
||||
SCHROOTDEVICE=$(ogDiskToDev $DISK $PART)
|
||||
|
||||
|
||||
rm ${DIRCONF}/mount-defaults
|
||||
rm ${DIRCONF}/schroot.conf
|
||||
|
||||
cat >> ${DIRCONF}/mount-defaults << EOF
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
/dev /dev none rw,bind 0 0
|
||||
/dev/pts /dev/pts none rw,bind 0 0
|
||||
/dev/shm /dev/shm none rw,bind 0 0
|
||||
EOF
|
||||
|
||||
|
||||
cat >> ${DIRCONF}/schroot.conf << EOF
|
||||
[linux]
|
||||
description=$VERSION
|
||||
type=block-device
|
||||
device=$SCHROOTDEVICE
|
||||
EOF
|
||||
|
||||
|
||||
|
||||
|
||||
schroot -c linux
|
||||
|
||||
schroot -end-sessiona --all-sessions
|
||||
}
|
||||
|
||||
|
||||
#/** @function ogDiskToRelativeDev: @brief Traduce los ID de discos o particiones EAC a ID Linux relativos, es decir 1 1 => sda1
|
||||
#@param Admite 1 parametro: $1 int_numdisk
|
||||
#@param Admite 2 parametro: $1 int_numdisk $2 int_partition
|
||||
#@return Para 1 parametros traduce Discos Duros: Devuelve la ruta relativa linux del disco duro indicado con nomenclatura EAC.........ejemplo: IdPartition 1 => sda
|
||||
#@return Para 2 parametros traduce Particiones: Devuelve la ruta relativa linux de la particion indicado con nomenclatura EAC........... ejemplo: IdPartition 2 1 => sdb1
|
||||
#@warning No definidas
|
||||
#@attention
|
||||
#@note Notas sin especificar
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: IdPartition en ATA.lib
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 27/10/2008
|
||||
#*/
|
||||
function ogDiskToRelativeDev () {
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
Msg "Info: Traduce el identificador del dispositivo EAC a dispositivo linux \n" info
|
||||
Msg "Sintaxis1: IdPartition int_disk -----------------Ejemplo1: IdPartition 1 -> sda " example
|
||||
Msg "Sintaxis2: IdPartition int_disk int_partition --Ejemplo2: IdPartition 1 2 -> sda2 " example
|
||||
|
||||
return
|
||||
fi
|
||||
#PART="$(Disk|cut -f$1 -d' ')$2" # se comenta esta linea porque doxygen no reconoce la funcion disk y no crea los enlaces y referencias correctas.
|
||||
PART=$(ogDiskToDev|cut -f$1 -d' ')$2
|
||||
echo $PART | cut -f3 -d \/
|
||||
}
|
||||
|
||||
|
||||
#/** @function ogDeletePartitionsLabels: @brief Elimina la informacion que tiene el kernel del cliente og sobre los labels de los sistemas de archivos
|
||||
#@param No requiere
|
||||
#@return Nada
|
||||
#@warning
|
||||
#@attention Requisitos: comando interno linux rm
|
||||
#@note
|
||||
#@version 0.1 - Integracion para Opengnsys - EAC: DeletePartitionTable() en ATA.lib
|
||||
#@author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#@date 27/10/2008
|
||||
#*/
|
||||
function ogDeletePartitionsLabels () {
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME " \
|
||||
"$FUNCNAME "
|
||||
return
|
||||
fi
|
||||
|
||||
rm /dev/disk/by-label/* # */ COMENTARIO OBLIGATORIO PARA DOXYGEN
|
||||
}
|
||||
|
||||
|
||||
#/** @function ogInfoCache: @brief muestra la informacion de la CACHE.
|
||||
#@param sin parametros
|
||||
#@return texto que se almacena en $IP.-InfoCache. punto_montaje, tama?oTotal, TamanioOcupado, TaminioLibre, imagenes dentro de la cahce
|
||||
#@warning Salidas de errores no determinada
|
||||
#@warning printf no soportado por busybox
|
||||
#@attention
|
||||
#@version 0.1 Date: 27/10/2008 Author Antonio J. Doblas Viso. Universidad de Malaga
|
||||
#*/
|
||||
function ogInfoCache ()
|
||||
{
|
||||
local info infoFilesystem infoSize infoUsed infoUsedPorcet infoMountedOn content
|
||||
if ogMountCache
|
||||
then
|
||||
info=`df -h | grep $OGCAC`
|
||||
infoFilesystem=`echo $info | cut -f1 -d" "`
|
||||
infoSize=`echo $info | cut -f2 -d" "`
|
||||
infoUsed=`echo $info | cut -f3 -d" "`
|
||||
infoAvail=`echo $info | cut -f4 -d" "`
|
||||
infoUsedPorcet=`echo $info | cut -f5 -d" "`
|
||||
infoMountedOn=`echo $info | cut -f2 -d" "`
|
||||
if `ls ${OGCAC}$OGIMG > /dev/null 2>&1`
|
||||
then
|
||||
cd ${OGCAC}${OPENGNSYS}
|
||||
#content=`find images/ -type f -printf "%h/ %f %s \n"` busybox no soporta printf
|
||||
content=`find images/ -type f`
|
||||
cd /
|
||||
echo $info
|
||||
echo -ne $content
|
||||
echo " "
|
||||
#echo "$info" > ${OGLOG}/${IP}-InfoCache
|
||||
#echo "$content" >> {$OGLOG}/${IP}-InfoCache
|
||||
else
|
||||
echo $info
|
||||
#echo "$info" > {$OGLOG}/${IP}-InfoCache
|
||||
fi
|
||||
ogUnmountCache
|
||||
else
|
||||
echo " "
|
||||
#echo " " > {$OGLOG}/${IP}-InfoCache
|
||||
|
||||
fi
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
OpenGnsys Client Cloning Engine README
|
||||
=======================================
|
||||
|
||||
En este directorio se incluirán las funciones del motor de
|
||||
clonación de OpenGnsys y la documentación asociada.
|
||||
|
||||
Este directorio estará localizado en el directorio del servidor
|
||||
/opt/opengnsys/client/lib/engine/bin
|
||||
|
||||
Las funciones serán accesibles por el cliente en el directorio
|
||||
/opt/opengnsys/lib/engine/bin
|
||||
|
||||
OpenGnsys Client Cloning Engine se distribuye en un conjunto de
|
||||
librerías que incluyen funciones BASH que deben ser exportadas
|
||||
al entorno del cliente.
|
||||
|
||||
Librerías:
|
||||
|
||||
- Boot.lib funciones de arranque y posconfiguración de
|
||||
sistemas operativos.
|
||||
- Cache.lib funciones de gestión de la caché local del cliente.
|
||||
- Disk.lib funciones de control de dispositivos de disco.
|
||||
- File.lib funciones de manipulación de ficheros.
|
||||
- FileSystem.lib funciones de gestión de sistemas de ficheros.
|
||||
- Image.lib funciones de administración de imágenes de
|
||||
sistemas operativos.
|
||||
- Inventory.lib funciones de control de inventario e informes.
|
||||
- Net.lib funciones básicas de control de acceso a la red.
|
||||
- Postconf.lib funciones de post-configuración de sistemas
|
||||
operativos.
|
||||
- Protocol.lib funciones de implementación de protocolos de
|
||||
comunicaciones.
|
||||
- Registry.lib funciones de gestión del registro de Windows.
|
||||
- Rsync.lib funciones de sincronización de ficheros.
|
||||
- String.lib funciones de control de cadena.
|
||||
- System.lib funciones básicas del sistema.
|
||||
|
|
@ -0,0 +1,455 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file Registry.lib
|
||||
#@brief Librería o clase Registry
|
||||
#@class Boot
|
||||
#@brief Funciones para gestión del registro de Windows.
|
||||
#@version 1.1.0
|
||||
#@warning License: GNU GPLv3+
|
||||
#*/
|
||||
|
||||
|
||||
# Función ficticia para lanzar chntpw con timeout de 5 s., evitando cuelgues del programa.
|
||||
function chntpw ()
|
||||
{
|
||||
local CHNTPW
|
||||
CHNTPW=$(which drbl-chntpw)
|
||||
CHNTPW=${CHNTPW:-$(which chntpw)}
|
||||
timeout --foreground 5s $CHNTPW -e "$@"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogAddRegistryKey path_mountpoint str_hive str_keyname
|
||||
#@brief Añade una nueva clave al registro de Windows.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_keyname nombre de la clave
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { default, sam, security, software, system, components }
|
||||
#@warning Requisitos: chntpw
|
||||
#@warning El sistema de archivos de Windows debe estar montada previamente.
|
||||
#@version 1.0.1 - Nueva función
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-25
|
||||
#*/ ##
|
||||
function ogAddRegistryKey ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey'"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
|
||||
# Añadir nueva clave.
|
||||
chntpw "$FILE" << EOT &> /dev/null
|
||||
cd ${3%\\*}
|
||||
nk ${3##*\\}
|
||||
q
|
||||
y
|
||||
EOT
|
||||
}
|
||||
|
||||
#/**
|
||||
# ogAddRegistryValue path_mountpoint str_hive str_valuename [str_valuetype]
|
||||
#@brief Añade un nuevo valor al registro de Windows, indicando su tipo de datos.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_valuename nombre del valor
|
||||
#@param str_valuetype tipo de datos del valor (opcional)
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { DEFAULT, SAM, SECURITY, SOFTWARE, SYSTEM, COMPONENTS }
|
||||
#@note valuetype = { STRING, BINARY, DWORD }, por defecto: STRING
|
||||
#@warning Requisitos: chntpw
|
||||
#@warning El sistema de archivos de Windows debe estar montada previamente.
|
||||
#@version 1.0.1 - Nueva función
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-25
|
||||
#*/ ##
|
||||
function ogAddRegistryValue ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE TYPE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename [str_valuetype]" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1'" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1' DWORD"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 o 4 parámetros.
|
||||
[ $# == 3 -o $# == 4 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
case "${4^^}" in
|
||||
STRING|"") TYPE=1 ;;
|
||||
BINARY) TYPE=3 ;;
|
||||
DWORD) TYPE=4 ;;
|
||||
*) ogRaiseError $OG_ERR_OUTOFLIMIT "$4"
|
||||
return $? ;;
|
||||
esac
|
||||
|
||||
# Devolver el dato del valor de registro.
|
||||
# /* (comentario Doxygen)
|
||||
chntpw "$FILE" << EOT &> /dev/null
|
||||
cd ${3%\\*}
|
||||
nv $TYPE ${3##*\\}
|
||||
q
|
||||
y
|
||||
EOT
|
||||
# (comentario Doxygen) */
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogDeleteRegistryKey path_mountpoint str_hive str_keyname
|
||||
#@brief Elimina una clave del registro de Windows con todo su contenido.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_keyname nombre de la clave
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { default, sam, security, software, system, components }
|
||||
#@warning Requisitos: chntpw
|
||||
#@warning El sistema de archivos de Windows debe estar montada previamente.
|
||||
#@warning La clave debe estar vacía para poder ser borrada.
|
||||
#@version 1.0.1 - Nueva función
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-25
|
||||
#*/ ##
|
||||
function ogDeleteRegistryKey ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey'"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
|
||||
# Añadir nueva clave.
|
||||
chntpw "$FILE" << EOT &> /dev/null
|
||||
cd ${3%\\*}
|
||||
dk ${3##*\\}
|
||||
q
|
||||
y
|
||||
EOT
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogDeleteRegistryValue path_mountpoint str_hive str_valuename
|
||||
#@brief Elimina un valor del registro de Windows.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_valuename nombre del valor
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { default, sam, security, software, system, components }
|
||||
#@warning Requisitos: chntpw
|
||||
#@warning El sistema de archivos de Windows debe estar montada previamente.
|
||||
#@version 1.0.1 - Nueva función
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-25
|
||||
#*/ ##
|
||||
function ogDeleteRegistryValue ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1'"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
|
||||
# Devolver el dato del valor de registro.
|
||||
# /* (comentario Doxygen)
|
||||
chntpw "$FILE" << EOT &> /dev/null
|
||||
cd ${3%\\*}
|
||||
dv ${3##*\\}
|
||||
q
|
||||
y
|
||||
EOT
|
||||
# (comentario Doxygen) */
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetHivePath path_mountpoint [str_hive|str_user]
|
||||
#@brief Función básica que devuelve el camino del fichero con una sección del registro.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@return str_path - camino del fichero de registro
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { DEFAULT, SAM, SECURITY, SOFTWARE, SYSTEM, COMPONENTS, NombreDeUsuario }
|
||||
#@warning El sistema de archivos de Windows debe estar montada previamente.
|
||||
#@version 1.0.1 - Nueva función
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-18
|
||||
#@version 1.1.0 - Soportar registro de un usuario local.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2015-10-14
|
||||
#*/ ##
|
||||
function ogGetHivePath ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE HIVE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint [str_hive|str_user]" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE => /mnt/sda1/WINDOWS/System32/config/SOFTWARE" \
|
||||
"$FUNCNAME /mnt/sda1 user1 => /mnt/sda1/Users/user1/NTUSER.DAT"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 2 parámetros.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
# Camino del fichero de registro de usuario o de sistema (de menor a mayor prioridad).
|
||||
FILE="$(ogGetPath "/$1/Windows/System32/config/$2")"
|
||||
[ -z "$FILE" ] && FILE="$(ogGetPath "/$1/Users/$2/NTUSER.DAT")"
|
||||
[ -z "$FILE" ] && FILE="$(ogGetPath "/$1/winnt/system32/config/$2")"
|
||||
[ -z "$FILE" ] && FILE="$(ogGetPath "/$1/Documents and Settings/$2/NTUSER.DAT")"
|
||||
[ -f "$FILE" ] && echo "$FILE" || ogRaiseError $OG_ERR_NOTFOUND "$1 $2" || return $?
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetRegistryValue path_mountpoint str_hive str_valuename
|
||||
#@brief Devuelve el dato de un valor del registro de Windows.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_valuename nombre del valor
|
||||
#@return str_valuedata - datos del valor.
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { default, sam, security, software, system, components }
|
||||
#@warning Requisitos: chntpw, awk
|
||||
#@warning El sistema de archivos de Windows debe estar montado previamente.
|
||||
#@version 0.9 - Adaptación para OpenGNSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-11
|
||||
#@version 1.1.0 - Soportar tipos BINARY (parejas hexadecimales separadas por espacio).
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2015-09-28
|
||||
#*/ ##
|
||||
function ogGetRegistryValue ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1' ==> 1"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
|
||||
# Devolver el dato del valor de registro.
|
||||
# /* (comentario Doxygen)
|
||||
chntpw "$FILE" << EOT 2> /dev/null | awk '/> Value/ {if (index($0, "REG_BINARY") > 0)
|
||||
{data=""}
|
||||
else
|
||||
{getline; data=$0;} }
|
||||
/^:[0-9A-F]+ / {data=data""substr($0, 9, 48);}
|
||||
END {print data;}'
|
||||
cd ${3%\\*}
|
||||
cat ${3##*\\}
|
||||
q
|
||||
EOT
|
||||
# (comentario Doxygen) */
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogListRegistryKeys path_mountpoint str_hive str_key
|
||||
#@brief Lista los nombres de subclaves de una determinada clave del registro de Windows.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_key clave de registro
|
||||
#@return str_subkey ... - lista de subclaves
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { default, sam, security, software, system, components }
|
||||
#@warning Requisitos: chntpw, awk
|
||||
#@warning El sistema de archivos de Windows debe estar montado previamente.
|
||||
#@version 0.9 - Adaptación para OpenGNSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-23
|
||||
#*/ ##
|
||||
function ogListRegistryKeys ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\Windows\CurrentVersion'"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
|
||||
# Devolver la lista de claves de registro.
|
||||
chntpw "$FILE" << EOT 2> /dev/null | awk 'BEGIN {FS="[<>]"} $1~/^ $/ {print $2}'
|
||||
ls $3
|
||||
q
|
||||
EOT
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogListRegistryValues path_mountpoint str_hive str_key
|
||||
#@brief Lista los nombres de valores de una determinada clave del registro de Windows.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_key clave de registro
|
||||
#@return str_value ... - lista de valores
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { default, sam, security, software, system, components }
|
||||
#@warning Requisitos: chntpw, awk
|
||||
#@warning El sistema de archivos de Windows debe estar montado previamente.
|
||||
#@version 1.0.1 - Nueva función.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-26
|
||||
#*/ ##
|
||||
function ogListRegistryValues ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\Windows\CurrentVersion'"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 3 parámetros.
|
||||
[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
|
||||
# Devolver la lista de claves de registro.
|
||||
chntpw "$FILE" << EOT 2> /dev/null | awk 'BEGIN {FS="[<>]"} $1~/REG_/ {print $2}'
|
||||
ls $3
|
||||
q
|
||||
EOT
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogSetRegistryValue path_mountpoint str_hive str_valuename str_valuedata
|
||||
#@brief Establece el dato asociado a un valor del registro de Windows.
|
||||
#@param path_mountpoint directorio donde está montado el sistema Windows
|
||||
#@param str_hive sección del registro
|
||||
#@param str_valuename nombre del valor de registro
|
||||
#@param str_valuedata dato del valor de registro
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND Fichero de registro no encontrado.
|
||||
#@note hive = { default, sam, security, software, system, components }
|
||||
#@warning Requisitos: chntpw
|
||||
#@warning El sistema de archivos de Windows debe estar montado previamente.
|
||||
#@version 0.9 - Adaptación para OpenGNSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-09-24
|
||||
#@version 1.1.0 - Soportar tipos BINARY (parejas hexadecimales separadas por espacio).
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2015-09-28
|
||||
#*/ ##
|
||||
function ogSetRegistryValue ()
|
||||
{
|
||||
# Variables locales.
|
||||
local FILE i n tmpfile
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename str_data" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Key\SubKey\StringValue' \"Abcde Fghij\"" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Key\SubKey\DwordValue' 1" \
|
||||
"$FUNCNAME /mnt/sda1 SOFTWARE '\Key\SubKey\BinaryValue' \"04 08 0C 10\""
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 4 parámetros.
|
||||
[ $# == 4 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
# Camino del fichero de registro.
|
||||
FILE=$(ogGetHivePath "$1" "$2") || return $?
|
||||
|
||||
# Fichero temporal para componer la entrada al comando "chntpw".
|
||||
tmpfile=/tmp/chntpw$$
|
||||
trap "rm -f $tmpfile" 1 2 3 9 15
|
||||
|
||||
# Comprobar tipo de datos del valor del registro.
|
||||
cat << EOT >$tmpfile
|
||||
ls ${3%\\*}
|
||||
q
|
||||
EOT
|
||||
if [ -n "$(chntpw "$FILE" < $tmpfile 2> /dev/null | grep "BINARY.*<${3##*\\}>")" ]; then
|
||||
# Procesar tipo binario (incluir nº de bytes y líneas de 16 parejas hexadecimales).
|
||||
[[ "$4 " =~ ^([0-9A-F]{2} )*$ ]] || ogRaiseError $OG_ERR_FORMAT "\"$4\"" || return $?
|
||||
let n=${#4}+1
|
||||
cat << EOT >$tmpfile
|
||||
cd ${3%\\*}
|
||||
ed ${3##*\\}
|
||||
$[n/3]
|
||||
EOT
|
||||
# Formato de líneas hexadecimales: :OFFSET XX YY ZZ ... (hasta 16 parejas).
|
||||
for (( i=0; i<n; i+=48 )); do
|
||||
printf ":%05x %s\n" $[i/3] "${4:$i:48}" >> $tmpfile
|
||||
done
|
||||
echo -e "s\nq\ny" >> $tmpfile
|
||||
else
|
||||
# Cambiar el dato del valor de registro para cadenas y bytes.
|
||||
cat << EOT >$tmpfile
|
||||
cd ${3%\\*}
|
||||
ed ${3##*\\}
|
||||
$4
|
||||
q
|
||||
y
|
||||
EOT
|
||||
|
||||
fi
|
||||
|
||||
# Aplicar cambios.
|
||||
chntpw "$FILE" < $tmpfile &> /dev/null
|
||||
rm -f $tmpfile
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,900 @@
|
|||
#!/bin/bash
|
||||
|
||||
#/**
|
||||
# rsync
|
||||
#@brief Función para utilizar la versión de rsync situada en $OPENGNSYS/bin en vez de la del sistema operativo.
|
||||
#@param los mismos que el comando rsync del sistema operativo.
|
||||
#@warning Solo en clientes ogLive de 32 bits.
|
||||
#@return instrucción para ser ejecutada.
|
||||
#*/
|
||||
function rsync ()
|
||||
{
|
||||
local RSYNC
|
||||
[ "$(arch)" == "i686" -a -x $OPENGNSYS/bin/rsync ] && RSYNC=$OPENGNSYS/bin/rsync
|
||||
RSYNC=${RSYNC:-$(which rsync)}
|
||||
|
||||
$RSYNC "$@"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogCreateFileImage [ REPO | CACHE ] image_name extension size
|
||||
#@brief Crear el archivo
|
||||
#@param 1 Repositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo imagen [ img |diff ]
|
||||
#@param 4 Tamaño de la imagen
|
||||
#@return instrucción para ser ejecutada.
|
||||
#*/
|
||||
|
||||
function ogCreateFileImage () {
|
||||
local SIZEREQUIRED IMGDIR IMGFILE DIRMOUNT LOOPDEVICE IMGSIZE IMGEXT KERNELVERSION
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO|CACHE ] image_name extension size(K)" \
|
||||
"$FUNCNAME REPO Ubuntu12 img 300000" \
|
||||
"$FUNCNAME CACHE Windows7 diff 20000000"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO|CACHE ] image_name extension size(k)"
|
||||
return $?
|
||||
fi
|
||||
|
||||
SIZEREQUIRED=$4
|
||||
[ $SIZEREQUIRED -lt 300000 ] && SIZEREQUIRED=300000
|
||||
KERNELVERSION=$(uname -r| awk '{printf("%d",$1);sub(/[0-9]*\./,"",$1);printf(".%02d",$1)}')
|
||||
|
||||
if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
|
||||
IMGDIR="$(ogGetParentPath "$1" "/$2")"
|
||||
[ "$3" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
|
||||
IMGFILE="${IMGDIR}/$(basename "/$2").$IMGEXT"
|
||||
## Si no existe, crear subdirectorio de la imagen.
|
||||
if [ $? != 0 ]; then
|
||||
ogEcho log session " $MSG_HELP_ogMakeDir \"$1 $(dirname "$2")."
|
||||
ogMakeDir "$1" "$(dirname "/$2")" || return $(ogRaiseError $OG_ERR_NOTWRITE "$3 /$4"; echo $?)
|
||||
IMGDIR="$(ogGetParentPath "$1" "/$2")" || return $(ogRaiseError $OG_ERR_NOTWRITE "$3 /$4"; echo $?)
|
||||
fi
|
||||
DIRMOUNT="/tmp/$(ogGetMountImageDir "$2" "$3")"
|
||||
mkdir -p "$DIRMOUNT"
|
||||
LOOPDEVICE=$(losetup -f)
|
||||
# Si existe el fichero de la imagen se hace copia de seguridad, si no existe se crea.
|
||||
if [ -f "$IMGFILE" ]; then
|
||||
# Si la imagen esta montada la desmonto
|
||||
if [ -r "$DIRMOUNT/ogimg.info" ]; then
|
||||
umount "$DIRMOUNT"
|
||||
[ $? -ne 0 ] && return $(ogRaiseError $OG_ERR_DONTUNMOUNT_IMAGE "$1 $2.$IMGEXT"; echo $?)
|
||||
fi
|
||||
|
||||
if [ "$BACKUP" == "true" -o "$BACKUP" == "TRUE" ]; then
|
||||
# Copia seguridad
|
||||
ogEcho log session " $MSG_SCRIPTS_FILE_RENAME \"$IMGFILE\" -> \"$IMGFILE.ant\"."
|
||||
cp -f "$IMGFILE" "$IMGFILE.ant"
|
||||
mv -f "$IMGFILE.torrent" "$IMGFILE.torrent.ant" 2>/dev/null
|
||||
rm -f "$IMGFILE.sum"
|
||||
fi
|
||||
|
||||
IMGSIZE=$(ls -l --block-size=1024 "$IMGFILE" | awk '{print $5}')
|
||||
if [ $IMGSIZE -lt $SIZEREQUIRED ];then
|
||||
ogEcho log session " $MSG_SYNC_RESIZE"
|
||||
echo " truncate --size=>$SIZEREQUIRED k $IMGFILE"
|
||||
truncate --size=">$SIZEREQUIRED"k "$IMGFILE" &> $OGLOGCOMMAND
|
||||
# FS de la imagen segun el contenido del archivo .img
|
||||
if file "$IMGFILE" |grep -i -e " ext4 filesystem " 2>&1 > /dev/null ; then
|
||||
losetup $LOOPDEVICE "$IMGFILE"
|
||||
echo " resize2fs -f $LOOPDEVICE"
|
||||
resize2fs -f $LOOPDEVICE &> $OGLOGCOMMAND
|
||||
|
||||
else
|
||||
echo " ogMountImage $1 "$2" $3"
|
||||
ogMountImage $1 "$2" $3
|
||||
echo " btrfs filesystem resize max $DIRMOUNT"
|
||||
btrfs filesystem resize max "$DIRMOUNT" &> $OGLOGCOMMAND
|
||||
fi
|
||||
fi
|
||||
else
|
||||
touch "$IMGFILE"
|
||||
echo " truncate --size=>$SIZEREQUIRED k $IMGFILE"
|
||||
truncate --size=">$SIZEREQUIRED"k "$IMGFILE" &> $OGLOGCOMMAND
|
||||
#Formateamos imagen
|
||||
losetup $LOOPDEVICE $IMGFILE
|
||||
# FS de la imagen segun la configuracion y la version del kernel: < 3.7 ext4, si >= btrfs
|
||||
[ $KERNELVERSION \< 3.07 ] && IMGFS="EXT4" || IMGFS=${IMGFS:-"BTRFS"}
|
||||
|
||||
if [ "$IMGFS" == "EXT4" ]; then
|
||||
echo " mkfs.ext4 -i 4096 -b 4096 -L "${2##*\/}" $LOOPDEVICE"
|
||||
mkfs.ext4 -i 4096 -b 4096 -L "${2##*\/}" $LOOPDEVICE 2>&1 |tee -a $OGLOGCOMMAND
|
||||
else
|
||||
echo " mkfs.btrfs -L ${2##*\/} $LOOPDEVICE "
|
||||
mkfs.btrfs -L "${2##*\/}" $LOOPDEVICE 2>&1 | tee -a $OGLOGCOMMAND
|
||||
fi
|
||||
fi
|
||||
# Monto la imagen
|
||||
ogMountImage $1 "$2" $3 &>/dev/null
|
||||
[ $? -eq 0 ] || return $( ogRaiseError $OG_ERR_IMAGE "$3 $4"; echo $?)
|
||||
echo "mounted"> $IMGFILE.lock
|
||||
|
||||
# Si existe dispositivo de loop lo borro.
|
||||
[ $LOOPDEVICE ] && losetup -d $LOOPDEVICE 2>&1 &>/dev/null
|
||||
|
||||
else
|
||||
[ -z $REPOIP ] && REPOIP=$(ogGetRepoIp)
|
||||
echo " hose $REPOIP 2009 --out sh -c \"echo -ne CREATE_IMAGE $2 $3 $SIZEREQUIRED \""
|
||||
hose $REPOIP 2009 --out sh -c "echo -ne CREATE_IMAGE \"$2\" $3 $SIZEREQUIRED"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogCreateInfoImage
|
||||
#@brief Crear listados con la informacion de la imagen, los situa en /tmp.
|
||||
#@param 1 num_disk
|
||||
#@param 2 num_part
|
||||
#@param 3 Repositorio [ REPO | CACHE ] (opcional en las completas)
|
||||
#@param 4 Nombre Imagen Basica (opcional en las completas)
|
||||
#@param 5 Tipo imagen [ img | diff ]
|
||||
#@version 1.0.6 rsync opcion W (whole) para que sea más rápido
|
||||
#*/
|
||||
function ogCreateInfoImage () {
|
||||
local IMGTYPE IMGDIRAUX DIRMOUNT DESTRSYNC PASSWORD USERRSYNC ORIG FSTYPE PART DIREMPTY IMGLIST IMGINFO IMGACL KERNELVERSION
|
||||
# Ayuda o menos de 5 parametros y la imagen no es basica
|
||||
if [ "$*" == "help" -o $# -lt 5 -a "$3" != "img" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME num_disk num_part [ REPO|CACHE ] [ base_image_name ] extension " \
|
||||
"base image -> $FUNCNAME 1 2 img" \
|
||||
"diff image -> $FUNCNAME 1 1 CACHE Windows7 diff "
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -lt 3 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME num_disk num_part [ REPO|CACHE ] [ base_image_name] extension "
|
||||
return $?
|
||||
fi
|
||||
|
||||
# Comprobar errores.
|
||||
PART=$(ogDiskToDev "$1" "$2") || return $?
|
||||
ORIG=$(ogMount $1 $2) || return $?
|
||||
|
||||
if [ $3 == "img" ]; then
|
||||
IMGTYPE="img"
|
||||
else
|
||||
# Comprobamos que las extension sea valida
|
||||
ogCheckStringInGroup $5 "img diff" || return $( ogRaiseError $OG_ERR_FORMAT "$MSG_SYNC_EXTENSION"; echo $?)
|
||||
IMGTYPE=$5
|
||||
if [ "$IMGTYPE" == "diff" ]; then
|
||||
# Imagen completa con la que comparo la particion.
|
||||
IMGDIRAUX="$(ogGetMountImageDir "$4" "img")"
|
||||
if [ "$3" == "CACHE" -o "$3" == "cache" ]; then
|
||||
DIRMOUNT="/tmp/$IMGDIRAUX"
|
||||
DESTRSYNC="$DIRMOUNT"
|
||||
else
|
||||
[ -z $REPOIP ] && REPOIP=$(ogGetRepoIp)
|
||||
DIRMOUNT="$OGIMG/$IMGDIRAUX"
|
||||
USERRSYNC="opengnsys"
|
||||
PASSWORD="--password-file=/scripts/passrsync"
|
||||
DESTRSYNC="$USERRSYNC@$REPOIP::ogimages/$IMGDIRAUX"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
FSTYPE=$(ogGetFsType $1 $2)
|
||||
|
||||
# Creamos la lista del contenido y lo situamos en la particion a copiar.
|
||||
DIREMPTY="/tmp/empty$$"
|
||||
IMGLIST="/tmp/ogimg.list"
|
||||
IMGINFO="/tmp/ogimg.info"
|
||||
IMGACL="/tmp/ogimg.acl"
|
||||
|
||||
# Borramos archivos antiguos.
|
||||
rm -f /tmp/ogimg.* 2>/dev/null
|
||||
rm -f $ORIG/ogimg.* 2>/dev/null
|
||||
|
||||
# En las diferenciales no sabemos el tamaño -> ponemos una constante.
|
||||
SIZEDATA=${SIZEDATA:-"SIZEDATA"}
|
||||
|
||||
# Incluimos información de la imagen. Segun el kernel sera ext4 o btrfs.
|
||||
KERNELVERSION=$(uname -r| awk '{printf("%d",$1);sub(/[0-9]*\./,"",$1);printf(".%02d",$1)}')
|
||||
[ $KERNELVERSION \< 3.07 ] && IMGFS="EXT4" || IMGFS=${IMGFS:-"BTRFS"}
|
||||
echo "#$IMGFS:NO:$FSTYPE:$SIZEDATA" > $IMGINFO
|
||||
|
||||
if [ "$IMGTYPE" == "img" ]; then
|
||||
# Imagen Basica
|
||||
echo " rsync -aHAXWvn --delete $ORIG/ $DIREMPTY >> $IMGINFO"
|
||||
rsync -aHAXWvn --delete $ORIG/ $DIREMPTY>> $IMGINFO
|
||||
sed -i -e s/"^sent.*.bytes\/sec"//g -e s/^total.*.speedup.*.$//g -e s/"sending.*.list"//g $IMGINFO
|
||||
sed -i '/^\.\//d' $IMGINFO
|
||||
|
||||
else
|
||||
# Imagen Diferencial
|
||||
echo " rsync -aHAXWvn --delete $ORIG/ $DESTRSYNC a $IMGLIST"
|
||||
rsync -aHAXWvn $PASSWORD --delete "$ORIG/" "$DESTRSYNC" >> $IMGLIST
|
||||
sed -i -e s/"^sent.*.bytes\/sec"//g -e s/^total.*.speedup.*.$//g -e s/"sending.*.list"//g $IMGLIST
|
||||
sed -i '/^\.\//d' $IMGLIST
|
||||
|
||||
# Creamos informacion de la imagen
|
||||
grep -e '\->' -e '\=>' $IMGLIST > /tmp/ogimg.ln
|
||||
grep -e ^deleting $IMGLIST | sed s/^deleting\ //g | grep -v ^ogimg > /tmp/ogimg.rm
|
||||
#grep -v -e '\->' -e '\=>' -e ^deleting $IMGLIST >> $IMGINFO
|
||||
grep -v -e '\->' -e '\=>' -e ^deleting -e ^created $IMGLIST >> $IMGINFO
|
||||
|
||||
rm -f $IMGLIST
|
||||
|
||||
# Comprobamos que los ficheros de diferencias no esten vacios o salimos con error.
|
||||
if [ $(grep -v -e "^$" -e "^#" $IMGINFO /tmp/ogimg.ln /tmp/ogimg.rm |wc -l) -eq 0 ]; then
|
||||
ogRaiseError $OG_ERR_NOTDIFFERENT "$1 $2 $3 $4 $5"
|
||||
return $?
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Guardamos el contenido de las acl (Solo win) Necesario particion desmontada (esta asi)
|
||||
ogUnmount $1 $2
|
||||
if [ $FSTYPE == "NTFS" ]; then
|
||||
echo " ntfs-3g.secaudit -b $PART /"
|
||||
ntfs-3g.secaudit -b $PART / > $IMGACL
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogAclFilter
|
||||
#@brief Del fichero de acl de la partición extraemos las acl de los ficheros de la diferencial (falla: no se usa)
|
||||
#@param No.
|
||||
#@return (nada)
|
||||
#*/
|
||||
function ogAclFilter () {
|
||||
local IMGACL IMGINFO FILES ACLTMP
|
||||
|
||||
# Ayuda
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
IMGACL="/tmp/ogimg.acl"
|
||||
IMGINFO="/tmp/ogimg.info"
|
||||
FILES="/tmp/files$$"
|
||||
ACLTMP="/tmp/acl$$.tmp"
|
||||
ACLFILES="/tmp/aclfiles$$"
|
||||
|
||||
# comprobamos que existan los archivos de origen. Si no salimos sin error.
|
||||
[ -f $IMGACL -a -f $IMGINFO ] || return 0
|
||||
|
||||
echo "" > $ACLTMP
|
||||
grep -n -e "File" -e "Directory" $IMGACL > $ACLFILES
|
||||
|
||||
# Al listado de ficheros le quitamos las líneas sobrantes: comentarios y lineas vacias.
|
||||
sed -e s/"^#.*$"//g -e '/^$/d' $IMGINFO > $FILES
|
||||
|
||||
|
||||
# Recorremos el listado y extraemos la acl correspondiente al fichero o directorio.
|
||||
while read LINE; do
|
||||
read END INI <<< "$(grep -A 1 "$LINE" $ACLFILES | awk -F : '!(NR%2){print $1" "p}{p=$1}' )"
|
||||
let NUM=$END-$INI-1
|
||||
# Si algún archivo no se encuentra, el error lo mandamos a /dev/null
|
||||
sed -n -e $INI,+"$NUM"p $IMGACL 2>/dev/null >> $ACLTMP
|
||||
echo "aclfilter: $LINE" >> $OGLOGCOMMAND
|
||||
done < $FILES
|
||||
|
||||
cp $ACLTMP $IMGACL
|
||||
rm -f $FILES $ACLTMP $ACLFILES
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogRestoreInfoImage
|
||||
#@brief Crear o modificar enlaces y restaurar las ACL. La informacion esta ya copiada a la particion.
|
||||
#@param 1 num_disk
|
||||
#@param 2 num_part
|
||||
#*/
|
||||
function ogRestoreInfoImage () {
|
||||
local DEST PART IMGACL IMGLN OPTLN LINEA DESTLN ORIGLN TYPELN
|
||||
|
||||
# Ayuda o menos de 5 parametros y la imagen no es basica
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME num_disk num_part" \
|
||||
"base image -> $FUNCNAME 1 2 " \
|
||||
"diff image -> $FUNCNAME 1 1 "
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME num_disk num_part "
|
||||
return $?
|
||||
fi
|
||||
|
||||
# Control de errores.
|
||||
PART=$(ogDiskToDev "$1" "$2") || return $?
|
||||
DEST=$(ogMount $1 $2) || return $?
|
||||
|
||||
IMGACL="ogimg.acl"
|
||||
IMGLN="ogimg.ln"
|
||||
IMGINFO="ogimg.info"
|
||||
|
||||
# Copiamos informacion de la imagen a /tmp (para basicas)
|
||||
[ -r $DEST/$IMGINFO ] && cp $DEST/ogimg.* /tmp
|
||||
|
||||
#Creamos o modificamos los enlaces.
|
||||
# La imagen diferencial tiene ogimg.ln
|
||||
# para la completa lo generamos con los enlaces que contengan /mnt/
|
||||
[ -r "/tmp/$IMGLN" ] || grep -e "->" -e "=>" "/tmp/$IMGINFO"|grep "/mnt/" > "/tmp/$IMGLN"
|
||||
if [ $(wc -l "/tmp/$IMGLN"|cut -f1 -d" ") -ne 0 ]; then
|
||||
while read LINEA
|
||||
do
|
||||
ORIGLN="${LINEA#*> }"
|
||||
# Si origen hace referencia a la particion lo modificamos
|
||||
echo $ORIGLN|grep "/mnt/"> /dev/null && ORIGLN="$DEST/${ORIGLN#/mnt/*/}"
|
||||
# rsync marca - los enlaces simbolicos y = enlaces "duros"
|
||||
LINEA="${LINEA%>*}"
|
||||
TYPELN="${LINEA##* }"
|
||||
DESTLN="${LINEA% *}"
|
||||
|
||||
if [ "$TYPELN" == "-" ]
|
||||
then
|
||||
OPTLN='-s'
|
||||
else
|
||||
OPTLN=''
|
||||
fi
|
||||
cd "$DEST/$(dirname "$DESTLN")"
|
||||
rm -f "$(basename "$DESTLN")"
|
||||
ln $OPTLN "$ORIGLN" "$(basename "$DESTLN")"
|
||||
echo -n "."
|
||||
done < "/tmp/$IMGLN" 2>/dev/null
|
||||
echo ""
|
||||
|
||||
fi
|
||||
cd /
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogRestoreAclImage
|
||||
#@brief Restaurar las ACL. La informacion esta ya copiada al directorio /tmp
|
||||
#@param 1 num_disk
|
||||
#@param 2 num_part
|
||||
#*/
|
||||
function ogRestoreAclImage () {
|
||||
local PART IMGACL
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME num_disk num_part" \
|
||||
"$FUNCNAME 1 1"
|
||||
return
|
||||
fi
|
||||
|
||||
PART=$(ogDiskToDev "$1" "$2") || return $?
|
||||
IMGACL="ogimg.acl"
|
||||
|
||||
# Restauramos acl
|
||||
if [ "$(ogGetFsType $1 $2)" == "NTFS" -a -f "/tmp/$IMGACL" ] ; then
|
||||
cd /
|
||||
ogUnmount "$1" "$2"
|
||||
echo "ntfs-3g.secaudit -se $PART /tmp/$IMGACL"
|
||||
ntfs-3g.secaudit -se $PART /tmp/$IMGACL
|
||||
# Para evitar que de falso error
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogSyncCreate
|
||||
#@brief sincroniza los datos de la partición a la imagen para crearla. La imagen esta montada en un directorio.
|
||||
#@param 1 num_disk
|
||||
#@param 2 num_part
|
||||
#@param 3 Repositorio [ REPO | CACHE ]
|
||||
#@param 4 Nombre Imagen
|
||||
#@param 5 Tipo imagen [ img | diff ]
|
||||
#*/
|
||||
function ogSyncCreate () {
|
||||
local ORIG DIRAUX DIRMOUNT DESTRSYNC USERRSYNC PASSWORD OPTRSYNC RETVAL
|
||||
|
||||
# Limpiamos los archivo de log
|
||||
echo "" >$OGLOGCOMMAND;
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME num_disk num_part [ REPO|CACHE ] image_name extension " \
|
||||
"$FUNCNAME 1 2 REPO Ubuntu12 img" \
|
||||
"$FUNCNAME 1 1 CACHE Windows7 diff "
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME num_disk num_part [ REPO|CACHE ] image_name extension "
|
||||
return $?
|
||||
fi
|
||||
|
||||
ORIG=$(ogMount $1 $2) || return $?
|
||||
|
||||
DIRMOUNT="$(ogGetMountImageDir "$4" $5)"
|
||||
# Si la imagen es diferencial la lista de ficheros a transferir esta dentro de la imagen.
|
||||
if [ "$5" == "diff" ]; then
|
||||
FILESFROM=" --files-from=/tmp/ogimg.info"
|
||||
# Borramos los directorios
|
||||
sed -i '/\/$/d' /tmp/ogimg.info
|
||||
else
|
||||
FILESFROM=""
|
||||
fi
|
||||
|
||||
if [ "$3" == "CACHE" -o "$3" == "cache" ]; then
|
||||
DESTRSYNC="/tmp/$DIRMOUNT"
|
||||
else
|
||||
[ -z $REPOIP ] && REPOIP=$(ogGetRepoIp)
|
||||
PASSWORD="--password-file=/scripts/passrsync"
|
||||
[ "$ogrsyncz" == "true" ] && OPTRSYNC="z "
|
||||
[ "$ogrsyncw" == "true" ] && OPTRSYNC="W$OPTRSYNC"
|
||||
USERRSYNC="opengnsys"
|
||||
DESTRSYNC="$USERRSYNC@$REPOIP::ogimages/$DIRMOUNT"
|
||||
fi
|
||||
# Sincronizamos los datos de la partición a la imagen
|
||||
echo " rsync -aHAX$OPTRSYNC --progress --inplace --delete $FILESFROM $ORIG/ $DESTRSYNC"
|
||||
rsync -aHAX$OPTRSYNC $PASSWORD --progress --inplace --delete $FILESFROM "$ORIG/" "$DESTRSYNC" 2>$OGLOGCOMMAND | egrep "^deleting|^sent|^sending|^total|%" |tee -a $OGLOGCOMMAND
|
||||
RETVAL=${PIPESTATUS[0]}
|
||||
echo " rsync -aHAX$OPTRSYNC --inplace /tmp/ogimg* $DESTRSYNC"
|
||||
rsync -aHAX$OPTRSYNC $PASSWORD --inplace /tmp/ogimg* "$DESTRSYNC"
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogSyncRestore
|
||||
#@brief sincroniza los datos de la imagen a la partición para restaurarla.
|
||||
#@param 1 Repositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo imagen [ img | diff ]
|
||||
#@param 4 num_disk
|
||||
#@param 5 num_part
|
||||
#*/
|
||||
function ogSyncRestore () {
|
||||
local DIRMOUNT ORIG DESTRSYNC PASSWORD OPTRSYNC USERRSYNC IMGINFO FILESFROM
|
||||
|
||||
# Limpiamos los archivo de log
|
||||
echo "" >$OGLOGCOMMAND;
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO|CACHE ] image_name extension num_disk num_part " \
|
||||
"$FUNCNAME REPO Ubuntu12 img 1 2" \
|
||||
"$FUNCNAME CACHE Windows7 diff 1 1"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -lt 5 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO|CACHE ] image_name extension num_disk num_part "
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
||||
DIRMOUNT="$(ogGetMountImageDir "$2" "$3")"
|
||||
DESTRSYNC=$(ogGetMountPoint $4 $5)
|
||||
|
||||
# Borramos ficheros de informacion de restauraciones antiguas
|
||||
rm -rf $DESTRSYNC/ogimg.*
|
||||
rm -rf /tmp/ogimg.*
|
||||
|
||||
# Origen y destino de la sincronizacion y en REPO opciones rsync
|
||||
if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
|
||||
ORIG="/tmp/$DIRMOUNT"
|
||||
else
|
||||
[ -z $REPOIP ] && REPOIP=$(ogGetRepoIp)
|
||||
PASSWORD="--password-file=/scripts/passrsync"
|
||||
[ "$ogrsyncz" == "true" ] && OPTRSYNC="z "
|
||||
[ "$ogrsyncw" == "true" ] && OPTRSYNC="W$OPTRSYNC"
|
||||
USERRSYNC="opengnsys"
|
||||
ORIG="$USERRSYNC@$REPOIP::ogimages/$DIRMOUNT"
|
||||
fi
|
||||
|
||||
# Opciones rsync en cache y repo
|
||||
# Para la imagen basica, opcion de borrar archivos de la particion que no existen en la imagen
|
||||
[ "$3" == "img" ] && [ "$ogrsyncdel" != "false" ] && OPTRSYNC="$OPTRSYNC --delete"
|
||||
|
||||
# Nos traemos listado ficheros y bajamos la imagen
|
||||
|
||||
ogEcho log session " $MSG_SYNC_RESTORE"
|
||||
|
||||
# Si la imagen es diferencial nos traemos los archivos de informacion de la imagen.
|
||||
if [ "$3" == "diff" ]; then
|
||||
# Lista de archivos a copiar:
|
||||
IMGINFO="ogimg.info"
|
||||
FILESFROM=" --files-from=/tmp/$IMGINFO"
|
||||
|
||||
echo " rsync -aHAX$OPTRSYNC --progress $ORIG/ogimg* /tmp"
|
||||
rsync -aHAX$OPTRSYNC $PASSWORD --progress "$ORIG"/ogimg* /tmp
|
||||
# Borramos linea de información de la imagen, sino busca un fichero con ese nombre
|
||||
sed -i '/^\#/d' /tmp/$IMGINFO
|
||||
|
||||
cd $DESTRSYNC
|
||||
# Diferencial: Borramos archivos sobrantes.
|
||||
ogEcho log session " $MSG_SYNC_DELETE"
|
||||
sed -e s/^/\"/g -e s/$/\"/g "/tmp/ogimg.rm" 2>/dev/null | xargs rm -rf
|
||||
|
||||
fi
|
||||
|
||||
echo " rsync -aHAX$OPTRSYNC --progress $FILESFROM $ORIG/ $DESTRSYNC"
|
||||
rsync -aHAX$OPTRSYNC $PASSWORD --progress $FILESFROM "$ORIG/" "$DESTRSYNC" 2>$OGLOGCOMMAND | egrep "^deleting|^sent|^sending|^total|%" |tee -a $OGLOGCOMMAND
|
||||
RETVAL=${PIPESTATUS[0]}
|
||||
cd /
|
||||
#*/ " Comentario Doxygen
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogMountImage
|
||||
#@brief Monta la imagen para sincronizar.
|
||||
#@param 1 Repositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo imagen [ img |diff ]
|
||||
#@return punto de montaje
|
||||
#*/
|
||||
function ogMountImage () {
|
||||
local IMGEXT IMGFILE DIRMOUNT KERNELVERSION
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO|CACHE ] image_name [ extension ]" \
|
||||
"$FUNCNAME REPO Ubuntu12" \
|
||||
"$FUNCNAME CACHE Windows7 diff"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO|CACHE ] image_name [ extension ]"
|
||||
return $?
|
||||
fi
|
||||
|
||||
[ "$3" == "" -o "$3" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
|
||||
|
||||
DIRMOUNT="$(ogGetMountImageDir "$2" ${IMGEXT#*\.})"
|
||||
|
||||
if [ "$1" == "REPO" -o "$1" == "repo" ]; then
|
||||
[ -z $REPOIP ] && REPOIP=$(ogGetRepoIp)
|
||||
hose $REPOIP 2009 --out sh -c "echo -ne MOUNT_IMAGE \"$2\" ${IMGEXT#*\.}"
|
||||
echo "$OGIMG/$DIRMOUNT"
|
||||
else
|
||||
# Si está montado nada que hacer.
|
||||
df | grep "$DIRMOUNT$" 2>&1 >/dev/null && echo "/tmp/$DIRMOUNT" && return 0
|
||||
|
||||
IMGFILE="$(ogGetPath "$1" /"$2.$IMGEXT")" \
|
||||
|| return $(ogRaiseError $OG_ERR_NOTFOUND "$1 $2.$IMGEXT"; echo $?)
|
||||
mkdir -p "/tmp/$DIRMOUNT"
|
||||
|
||||
|
||||
# FS de la imagen segun el contenido del archivo .img
|
||||
if file "$IMGFILE" |grep -i -e " ext4 filesystem " 2>&1 > /dev/null ; then
|
||||
mount -t ext4 -o loop "$IMGFILE" "/tmp/$DIRMOUNT" 1>/dev/null
|
||||
else
|
||||
mount -o compress=lzo "$IMGFILE" "/tmp/$DIRMOUNT" 1>/dev/null
|
||||
fi
|
||||
|
||||
# Comprobamos que se ha montado bien
|
||||
[ $? -eq 0 ] || return $(ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $3"; echo $?)
|
||||
echo "/tmp/$DIRMOUNT"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogUnmountImage [ REPO | CACHE ] Image_name [ extension ]
|
||||
#@brief Desmonta la imagen para sincronizar.
|
||||
#@param 1 Repositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo imagen [ img |diff ]
|
||||
#*/
|
||||
function ogUnmountImage () {
|
||||
local IMGTYPE DIRMOUNT
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO|CACHE ] image_name [ extension ]" \
|
||||
"$FUNCNAME REPO Ubuntu12" \
|
||||
"$FUNCNAME CACHE Windows7 diff"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO|CACHE ] image_name [ extension ]"
|
||||
return $?
|
||||
fi
|
||||
|
||||
[ "$3" == "" ] && IMGTYPE="img" || IMGTYPE="$3"
|
||||
|
||||
if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
|
||||
DIRMOUNT="/tmp/$(ogGetMountImageDir "$2" $IMGTYPE)"
|
||||
umount "$DIRMOUNT"
|
||||
rmdir "$DIRMOUNT"
|
||||
[ -f $IMGFILE.lock ] && sed -i s/"mounted"//g $IMGFILE.lock
|
||||
else
|
||||
[ -z $REPOIP ] && REPOIP=$(ogGetRepoIp)
|
||||
echo " hose $REPOIP 2009 --out sh -c echo -ne UMOUNT_IMAGE \"$2\" $IMGTYPE"
|
||||
hose $REPOIP 2009 --out sh -c "echo -ne UMOUNT_IMAGE \"$2\" $IMGTYPE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetMountImageDir
|
||||
#@brief Devuelve el directorio de montaje de la imagen.
|
||||
#@param 1 Nombre Imagen
|
||||
#@param 2 Tipo imagen [ img |diff ]
|
||||
#*/
|
||||
function ogGetMountImageDir () {
|
||||
local DIRMOUNT
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME image_name [ extension ]" \
|
||||
"$FUNCNAME Ubuntu12" \
|
||||
"$FUNCNAME Windows7 diff"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME image_name [ extension ]"
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
||||
DIRMOUNT="mount/$1"
|
||||
[ "$2" == "diff" ] && DIRMOUNT="$DIRMOUNT.diff"
|
||||
echo "$DIRMOUNT"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogWaitSyncImage image_name extension stado imagen_size
|
||||
#@brief Se espera un tiempo a que se monte la imagen en el servidor.
|
||||
#@brief Cuando se esta creando la imagen hay que dar el tamaño, para que espere el tiempo de creación.
|
||||
#@param 1 Respositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo imagen [ img | diff ]
|
||||
#@param 4 Estado [ mounted | reduced ]
|
||||
#@param 5 Tamaño imagen (opcional)
|
||||
#*/
|
||||
function ogWaitSyncImage () {
|
||||
local SIZE TIME DIRMOUNT TIMEOUT TIMEAUX LOCKFILE IMGDIR IMGEXT STATE
|
||||
|
||||
TIME=$SECONDS
|
||||
|
||||
# Ayuda o menos de 5 parametros y la imagen no es basica
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO | CACHE ] image_name extension state [ image_size ] " \
|
||||
"$FUNCNAME REPO Ubuntu12 img 30000000" \
|
||||
"$FUNCNAME CACHE Windows7 diff "
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO | CACHE ] image_name extension state [ image_size ] "
|
||||
return $?
|
||||
fi
|
||||
|
||||
SIZE=${5:-"300000"}
|
||||
STATE="$4"
|
||||
ogCheckStringInGroup "$STATE" "mounted reduced" || \
|
||||
return $(ogRaiseError command $OG_ERR_FORMAT "STATE = [ mounted | reduced ]" )
|
||||
|
||||
IMGDIR="$(ogGetParentPath "$1" "/$2")"
|
||||
[ "$3" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
|
||||
LOCKFILE="${IMGDIR}/$(basename "/$2").$IMGEXT.lock"
|
||||
|
||||
if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
|
||||
DIRMOUNT="/tmp/$(ogGetMountImageDir "$2" $3)"
|
||||
else
|
||||
DIRMOUNT="$OGIMG/$(ogGetMountImageDir "$2" $3)"
|
||||
fi
|
||||
|
||||
echo -n -e " $MSG_SYNC_SLEEP: $DIRMOUNT\n #" | tee -a $OGLOGSESSION $OGLOGFILE
|
||||
|
||||
# Comprobamos: mounted -> que exista $DIRMOUNT/ogimg.info o que el fichero de lock contenga mounted
|
||||
# reduced -> que el fichero de lock contenga reduced.
|
||||
|
||||
# time-out segun el tamaño de la imagen. por defecto: 100000k -> 3s
|
||||
let TIMEOUT=$SIZE/$CREATESPEED
|
||||
[ $TIMEOUT -lt 60 ] && TIMEOUT=60
|
||||
until $(grep -i $STATE $LOCKFILE &>/dev/null) ; do
|
||||
[ $STATE = "mounted" -a -f "$DIRMOUNT/ogimg.info" ] && ogEcho log session "" && return 0
|
||||
TIMEAUX=$[SECONDS-TIME]
|
||||
[ "$TIMEAUX" -lt "$TIMEOUT" ] || return $(ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $4 $IMGEXT: time_out."; echo $?)
|
||||
echo -n "#" | tee -a $OGLOGSESSION $OGLOGFILE
|
||||
sleep 5
|
||||
done
|
||||
echo "" | tee -a $OGLOGSESSION $OGLOGFILE
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogReduceImage
|
||||
#@brief Reduce el archivo de la imagen a tamaño datos + 500M
|
||||
#@param 1 Repositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo Imagen [ img |diff ]
|
||||
#@return
|
||||
#@exception OG_ERR_FORMAT # 1 formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND # 2 Fichero o dispositivo no encontrado.
|
||||
#*/
|
||||
function ogReduceImage () {
|
||||
local IMGEXT DIRMOUNT AVAILABLE USED IMGDIR IMGFILE ENDSIZE LOOPDEVICE
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO|CACHE ] image_name [ extension ]" \
|
||||
"$FUNCNAME REPO Ubuntu12" \
|
||||
"$FUNCNAME CACHE Windows7 diff"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO|CACHE ] image_name [ extension ]"
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
||||
[ "$3" == "" -o "$3" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
|
||||
IMGDIR="$(ogGetParentPath "$1" "/$2")"
|
||||
IMGFILE="${IMGDIR}/$(basename "/$2").$IMGEXT"
|
||||
|
||||
|
||||
if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
|
||||
# Para imagenes EXT4 reduzco, para BTRFS solo desmonto.
|
||||
if file "$IMGFILE" | grep -i " ext4 filesystem " 2>&1 > /dev/null; then
|
||||
# Al montar se comprueba la existencia de la imagen
|
||||
DIRMOUNT="$(ogMountImage $1 "$2" ${IMGEXT#*\.})"
|
||||
AVAILABLE=$(df -k|grep "$DIRMOUNT$"|awk '{print $4}')
|
||||
# Si el espacio libre menor que 500Mb nos salimos
|
||||
if [ $AVAILABLE -lt 200000 ]; then
|
||||
ogUnmountImage $1 "$2" ${IMGEXT#*\.}
|
||||
echo "reduced" > "$IMGFILE.lock"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Calculamos la diferencia entre el tamaño interno y externo
|
||||
EXTSIZE=$(ls -l --block-size=1024 "$IMGFILE" | cut -f5 -d" ")
|
||||
INTSIZE=$(df -k|grep "$DIRMOUNT"|awk '{print $2}')
|
||||
let EDGESIZE=$EXTSIZE-$INTSIZE
|
||||
ogUnmountImage $1 "$2" ${IMGEXT#*\.}
|
||||
LOOPDEVICE=$(losetup -f)
|
||||
losetup $LOOPDEVICE "$IMGFILE"
|
||||
|
||||
# Redimensiono sistema de ficheros
|
||||
echo " resize2fs -fpM $LOOPDEVICE"
|
||||
resize2fs -fpM $LOOPDEVICE |tee -a $OGLOGCOMMAND
|
||||
ogMountImage $1 "$2" ${IMGEXT#*\.} >/dev/null
|
||||
|
||||
# Calculamos el tamaño final del archivo
|
||||
INTSIZE=$(df -k|grep "$DIRMOUNT"|awk '{print $2}')
|
||||
let EXTSIZE=$INTSIZE+$EDGESIZE
|
||||
umount "$DIRMOUNT"
|
||||
|
||||
# Si existe dispositivo de loop lo borro.
|
||||
[ $LOOPDEVICE ] && losetup -d $LOOPDEVICE
|
||||
|
||||
# Corto el archivo al tamaño del sistema de ficheros.
|
||||
echo " truncate --size=\"$EXTSIZE\"k $IMGFILE "
|
||||
truncate --size="$EXTSIZE"k "$IMGFILE"
|
||||
else
|
||||
# Desmonto la imagen
|
||||
umount "$DIRMOUNT"
|
||||
fi
|
||||
|
||||
echo "reduced" > "$IMGFILE.lock"
|
||||
rmdir "$DIRMOUNT"
|
||||
|
||||
else
|
||||
[ -z $REPOIP ] && REPOIP=$(ogGetRepoIp)
|
||||
echo " hose $REPOIP 2009 --out sh -c echo -ne REDUCE_IMAGE \"$2\" ${IMGEXT#*\.}"
|
||||
hose $REPOIP 2009 --out sh -c "echo -ne REDUCE_IMAGE \"$2\" ${IMGEXT#*\.}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#/**
|
||||
# ogIsSyncImage
|
||||
#@brief Comprueba si la imagen es sincronizable
|
||||
#@param 1 Repositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo Imagen [ img |diff ]
|
||||
#@return
|
||||
#@exception OG_ERR_FORMAT # 1 formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND # 2 Fichero o dispositivo no encontrado.
|
||||
#*/
|
||||
function ogIsSyncImage () {
|
||||
local IMGEXT IMGDIR IMGFILE
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO|CACHE ] image_name [ extension ]" \
|
||||
"$FUNCNAME REPO Ubuntu12" \
|
||||
"$FUNCNAME CACHE Windows7 diff"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO|CACHE ] image_name [ extension ]"
|
||||
return $?
|
||||
fi
|
||||
|
||||
[ "$3" == "" -o "$3" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
|
||||
IMGDIR="$(ogGetParentPath "$1" "/$2")"
|
||||
IMGFILE="${IMGDIR}"/$(basename "/$2").$IMGEXT
|
||||
|
||||
file "$IMGFILE" | grep -i -e " BTRFS Filesystem " -e " ext4 filesystem " >/dev/null
|
||||
[ $? -eq 0 ] && return 0 || return $OG_ERR_DONTSYNC_IMAGE
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogCheckSyncImage
|
||||
#@brief Muestra el contenido de la imagen para comprobarla.
|
||||
#@param 1 Repositorio [ REPO | CACHE ]
|
||||
#@param 2 Nombre Imagen
|
||||
#@param 3 Tipo Imagen [ img |diff ]
|
||||
#@return
|
||||
#@exception OG_ERR_FORMAT # 1 formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND # 2 Fichero o dispositivo no encontrado.
|
||||
#*/
|
||||
function ogCheckSyncImage () {
|
||||
local IMGEXT IMGDIR IMGFILE DIRMOUNT ISMOUNT RETVAL KERNELVERSION
|
||||
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" \
|
||||
"$FUNCNAME [ REPO|CACHE ] image_name [ extension ]" \
|
||||
"$FUNCNAME REPO Ubuntu12" \
|
||||
"$FUNCNAME CACHE Windows7 diff"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO|CACHE ] image_name [ extension ]"
|
||||
return $?
|
||||
fi
|
||||
|
||||
[ "$3" == "" -o "$3" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
|
||||
IMGDIR="$(ogGetParentPath "$1" "/$2")"
|
||||
IMGFILE="${IMGDIR}/$(basename "/$2").$IMGEXT"
|
||||
|
||||
ogIsSyncImage $1 "$2" "${IMGEXT#*\.}" || return $(ogRaiseError $OG_ERR_DONTSYNC_IMAGE "$3 $4"; echo $?)
|
||||
|
||||
# Comprobamos que no esté montada (daria falso error)
|
||||
if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
|
||||
$(df | grep "/tmp/mount/$2${IMGEXT#img}$" &>/dev/null) && ISMOUNT=TRUE
|
||||
else
|
||||
[ -f "$OGIMG/mount/$2${IMGEXT#img}/ogimg.info" ] && ISMOUNT=TRUE
|
||||
fi
|
||||
[ "$ISMOUNT" == TRUE ] && ogEcho log session warning "$MSG_SYNC_NOCHECK" && return 0
|
||||
|
||||
DIRMOUNT="/tmp/ogCheckImage$$"
|
||||
mkdir "$DIRMOUNT"
|
||||
# FS de la imagen segun el contenido del archivo .img
|
||||
if file "$IMGFILE" |grep -i -e " ext4 filesystem " 2>&1 > /dev/null ; then
|
||||
mount -t ext4 -o loop "$IMGFILE" "$DIRMOUNT" 2>&1 | tee -a $OGLOGCOMMAND
|
||||
RETVAL=${PIPESTATUS[0]}
|
||||
else
|
||||
mount -o compress=lzo "$IMGFILE" "$DIRMOUNT" 2>&1 | tee -a $OGLOGCOMMAND
|
||||
RETVAL=${PIPESTATUS[0]}
|
||||
fi
|
||||
ls -C "$DIRMOUNT" | tee -a $OGLOGCOMMAND
|
||||
umount "$DIRMOUNT"
|
||||
|
||||
rmdir "$DIRMOUNT"
|
||||
return $RETVAL
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
#!/bin/bash
|
||||
|
||||
#/**
|
||||
# ogCheckStringInGroup
|
||||
#@brief Función para determinar si el elemento pertenece a un conjunto
|
||||
#@param 1 elemento a comprobar
|
||||
#@param 2 grupo de elementos para comprobar tipo "valor1 valor2 valor3"
|
||||
#@return 0 si pertenece al grupo
|
||||
#@return 1 si NO pertenece al grupo
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@note
|
||||
#@todo
|
||||
#@version 0.91 - Definición de
|
||||
#@author Antonio Doblas Viso, Universidad de Málaga
|
||||
#@date 2010/05/09
|
||||
#*/ ##
|
||||
|
||||
function ogCheckStringInGroup ()
|
||||
{
|
||||
local i
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME str_elemento str_grupo" \
|
||||
"$FUNCNAME full-duplex \"full-duplex half-duplex broadcast\" "
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 2 parámetro.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
|
||||
for i in `echo $2`
|
||||
do
|
||||
if [ "$1" == "$i" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#/**
|
||||
# ogCheckStringInReg
|
||||
#@brief Función para determinar si el elemento contiene una "expresión regular"
|
||||
#@param 1 elemento a comprobar
|
||||
#@param 2 expresión regular"
|
||||
#@return 0 si coincide con la expresión
|
||||
#@return 1 si NO coincide con la expresión
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@note
|
||||
#@todo
|
||||
#@version 0.91 - Definición de
|
||||
#@author Antonio Doblas Viso, Universidad de Málaga
|
||||
#@date 2010/05/09
|
||||
#*/ ##
|
||||
|
||||
function ogCheckStringInReg()
|
||||
{
|
||||
|
||||
local REG
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME str_elemento str_expresión_regular" \
|
||||
"$FUNCNAME 50M \"^[0-9]{1,2}\M$\" "
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 2 parámetro.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
REG=$2
|
||||
[[ $1 =~ $REG ]] && return 0 || return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
#/**
|
||||
# ogCheckIpAddress
|
||||
#@brief Función para determinar si una cadena es una dirección ipv4 válida
|
||||
#@param 1 string de la ip a comprobar
|
||||
#@return 0 si es una dirección válida
|
||||
#@return 1 si NO es una dirección válida
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@note
|
||||
#@todo
|
||||
#@version 0.91 - Definición de
|
||||
#@author Antonio Doblas Viso, Universidad de Málaga
|
||||
#@date 2010/05/09
|
||||
#*/ ##
|
||||
|
||||
function ogCheckIpAddress()
|
||||
{
|
||||
local REG IP arrIP
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME str_IpAddressToCheck" \
|
||||
"$FUNCNAME 192.18.35.3"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# == 1 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
|
||||
IP=$1
|
||||
REG="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
|
||||
if [[ "$IP" =~ $REG ]]
|
||||
then
|
||||
OIFS=$IFS;
|
||||
IFS='.' ;
|
||||
arrIP=($IP)
|
||||
IFS=$OIFS
|
||||
if [[ ${arrIP[0]} -le 255 && ${arrIP[1]} -le 255 && ${arrIP[2]} -le 255 && ${arrIP[3]} -le 255 ]]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
|
@ -0,0 +1,339 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file System.lib
|
||||
#@brief Librería o clase System
|
||||
#@class System
|
||||
#@brief Funciones básicas del sistema.
|
||||
#@version 1.1.0
|
||||
#@warning License: GNU GPLv3+
|
||||
#*/
|
||||
|
||||
|
||||
#/**
|
||||
# ogEcho [str_logtype ...] [str_loglevel] "str_message" ...
|
||||
#@brief Muestra mensajes en consola y lo registra en fichero de incidencias.
|
||||
#@param str_logtype tipo de registro de incidencias.
|
||||
#@param str_loglevel nivel de registro de incidencias.
|
||||
#@param str_message mensaje (puede recibir más de 1 parámetro.
|
||||
#@return Mensaje mostrado.
|
||||
#@warning Si no se indica nivel de registro, solo muestra mensaje en pantalla.
|
||||
#@warning Si DEBUG="no", no se registran mensajes de error.
|
||||
#@note logfile = { log, command, session }; usa "log" si se indica nivel de registro.
|
||||
#@note loglevel = { help, info, warning, error }
|
||||
#@note El nivel de ayuda \c (help) no se registra en el fichero de incidencias.
|
||||
#@version 0.9 - Primera versión para OpenGnSys
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-07-23
|
||||
#@version 1.0.5 - Elegir fichero de log.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-03-17
|
||||
#@version 1.1.0 - Posibilidad de no registrar mensajes en ficheros.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2015-11-10
|
||||
#*/
|
||||
function ogEcho () {
|
||||
|
||||
# Variables locales
|
||||
local CONT=1 LOGS LOGLEVEL DATETIME
|
||||
|
||||
# Selección de ficheros de rgistro de incidencias.
|
||||
while [ $CONT ]; do
|
||||
case "${1,,}" in
|
||||
log) LOGS="$LOGS $OGLOGFILE"; shift ;;
|
||||
command) LOGS="$LOGS $OGLOGCOMMAND"; shift ;;
|
||||
session) LOGS="$LOGS $OGLOGSESSION"; shift ;;
|
||||
*) CONT= ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Selección del nivel de registro (opcional).
|
||||
case "${1,,}" in
|
||||
help) shift ;;
|
||||
info) LOGLEVEL="$1"; shift ;;
|
||||
warning) LOGLEVEL="$1"; shift ;;
|
||||
error) LOGLEVEL="$1"; shift ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
if [ -n "$LOGLEVEL" ]; then
|
||||
DATETIME=$(date +"%F %T")
|
||||
# Registrar mensajes en fichero de log si la depuración no está desactivada.
|
||||
[ "${DEBUG,,}" != "no" ] && LOGS="$OGLOGFILE $LOGS"
|
||||
logger -s -t "OpenGnsys $LOGLEVEL" "$DATETIME $*" 2>&1 | tee -a $LOGS
|
||||
else
|
||||
echo "$*" | tee -a $LOGS
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogExecAndLog str_logfile ... str_command ...
|
||||
#@brief Ejecuta un comando y guarda su salida en fichero de registro.
|
||||
#@param str_logfile fichero de registro (pueden ser varios).
|
||||
#@param str_command comando y comandos a ejecutar.
|
||||
#@return Salida de ejecución del comando.
|
||||
#@note str_logfile = { LOG, SESSION, COMMAND }
|
||||
#@version 1.0.6 - Primera versión para OpenGnSys
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2013-07-02
|
||||
#*/
|
||||
function ogExecAndLog () {
|
||||
|
||||
# Variables locales
|
||||
local ISCOMMAND ISLOG ISSESSION COMMAND CONTINUE=1 FILES REDIREC
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME str_logfile ... str_command ..." \
|
||||
"$FUNCNAME COMMAND ls -al /"
|
||||
return
|
||||
fi
|
||||
|
||||
# Procesar parámetros.
|
||||
while [ $CONTINUE ]; do
|
||||
case "${1,,}" in
|
||||
command) ISCOMMAND=1; shift ;;
|
||||
log) ISLOG=1; shift ;;
|
||||
session) ISSESSION=1; shift ;;
|
||||
*) COMMAND="$@"
|
||||
CONTINUE= ;;
|
||||
esac
|
||||
done
|
||||
# Error si no se recibe un comando que ejecutar.
|
||||
[ -n "$COMMAND" ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
# Componer lista de ficheros de registro.
|
||||
if [ $ISCOMMAND ]; then
|
||||
FILES="$OGLOGCOMMAND"
|
||||
> $FILES
|
||||
REDIREC="2>&1"
|
||||
fi
|
||||
[ $ISLOG ] && FILES="$FILES $OGLOGFILE"
|
||||
[ $ISSESSION ] && FILES="$FILES $OGLOGSESSION"
|
||||
|
||||
# Ejecutar comando.
|
||||
eval $COMMAND $REDIREC | tee -a $FILES
|
||||
# Salida de error del comando ejecutado.
|
||||
return ${PIPESTATUS[0]}
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGetCaller
|
||||
#@brief Devuelve nombre del programa o script ejecutor (padre).
|
||||
#@param No.
|
||||
#@return str_name - Nombre del programa ejecutor.
|
||||
#@version 0.10 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-01-17
|
||||
#*/
|
||||
function ogGetCaller () {
|
||||
|
||||
# Obtener el nombre del programa o del script que ha llamado al proceso actual.
|
||||
basename "$(COLUMNS=200 ps hp $PPID -o args | \
|
||||
awk '{if ($1~/bash/ && $2!="") { print $2; }
|
||||
else { sub(/^-/,"",$1); print $1; } }')"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogHelp ["str_function" ["str_format" ["str_example" ... ]]]
|
||||
#@brief Muestra mensaje de ayuda para una función determinda.
|
||||
#@param str_function Nombre de la función.
|
||||
#@param str_format Formato de ejecución de la función.
|
||||
#@param str_example Ejemplo de ejecución de la función.
|
||||
#@return str_help - Salida de ayuda.
|
||||
#@note Si no se indican parámetros, la función se toma de la variable \c $FUNCNAME
|
||||
#@note La descripción de la función se toma de la variable compuesta por \c MSG_FUNC_$función incluida en el fichero de idiomas.
|
||||
#@note Pueden especificarse varios mensajes con ejemplos.
|
||||
#@version 0.9 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-07-27
|
||||
#*/
|
||||
function ogHelp () {
|
||||
|
||||
# Variables locales.
|
||||
local FUNC MSG
|
||||
|
||||
# Mostrar función, descripción y formato.
|
||||
FUNC="${1:-${FUNCNAME[${#FUNCNAME[*]}-1]}}"
|
||||
MSG="MSG_HELP_$FUNC"
|
||||
ogEcho help "$MSG_FUNCTION $FUNC: ${!MSG}"
|
||||
[ -n "$2" ] && ogEcho help " $MSG_FORMAT: $2"
|
||||
# Mostrar ejemplos (si existen).
|
||||
shift 2
|
||||
while [ $# -gt 0 ]; do
|
||||
ogEcho help " $MSG_EXAMPLE: $1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogRaiseError [str_logtype ...] int_errcode ["str_errmessage" ...]
|
||||
#@brief Devuelve el mensaje y el código de error correspondiente.
|
||||
#@param str_logtype tipo de registro de incidencias.
|
||||
#@param int_errcode código de error.
|
||||
#@param str_errmessage mensajes complementarios de error.
|
||||
#@return str_message - Mensaje de error, incluyendo las funciones relacionadas.
|
||||
#@warning No definidas
|
||||
#@note Mensajes internacionales del fichero de idiomas.
|
||||
#@version 0.9 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-07-21
|
||||
#@version 1.0.5 - Muestra en el mensaje todas las funciones relacionadas (separadas por <-).
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-03-17
|
||||
#*/
|
||||
function ogRaiseError () {
|
||||
|
||||
# Variables locales
|
||||
local CONT=1 LOGS MSG CODE FUNCS
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [str_logfile ...] int_errorcode str_errormessage"
|
||||
return
|
||||
fi
|
||||
|
||||
# Selección de rgistros de incidencias.
|
||||
while [ $CONT ]; do
|
||||
case "${1,,}" in
|
||||
log|command|session) LOGS="$LOGS $1"; shift ;;
|
||||
*) CONT= ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Obtener código y mensaje de error.
|
||||
CODE="$1"
|
||||
case "$CODE" in
|
||||
$OG_ERR_FORMAT) MSG="$MSG_ERR_FORMAT \"$2\"" ;;
|
||||
$OG_ERR_NOTFOUND) MSG="$MSG_ERR_NOTFOUND \"$2\"" ;;
|
||||
$OG_ERR_OUTOFLIMIT) MSG="$MSG_ERR_OUTOFLIMIT \"$2\"" ;;
|
||||
$OG_ERR_PARTITION) MSG="$MSG_ERR_PARTITION \"$2\"" ;;
|
||||
$OG_ERR_LOCKED) MSG="$MSG_ERR_LOCKED \"$2\"" ;;
|
||||
$OG_ERR_CACHE) MSG="$MSG_ERR_CACHE \"$2\"" ;;
|
||||
$OG_ERR_NOGPT) MSG="$MSG_ERR_NOGPT \"$2\"" ;;
|
||||
$OG_ERR_REPO) MSG="$MSG_ERR_REPO \"$2\"" ;;
|
||||
$OG_ERR_FILESYS) MSG="$MSG_ERR_FILESYS \"$2\"" ;;
|
||||
$OG_ERR_IMAGE) MSG="$MSG_ERR_IMAGE \"$2\"" ;;
|
||||
$OG_ERR_NOTOS) MSG="$MSG_ERR_NOTOS \"$2\"" ;;
|
||||
$OG_ERR_NOTEXEC) MSG="$MSG_ERR_NOTEXEC \"$2\"" ;;
|
||||
$OG_ERR_NOTWRITE) MSG="$MSG_ERR_NOTWRITE \"$2\"" ;;
|
||||
$OG_ERR_NOTCACHE) MSG="$MSG_ERR_NOTCACHE \"$2\"" ;;
|
||||
$OG_ERR_CACHESIZE) MSG="$MSG_ERR_CACHESIZE \"$2\"" ;;
|
||||
$OG_ERR_REDUCEFS) MSG="$MSG_ERR_REDUCEFS \"$2\"" ;;
|
||||
$OG_ERR_EXTENDFS) MSG="$MSG_ERR_EXTENDFS \"$2\"" ;;
|
||||
$OG_ERR_IMGSIZEPARTITION) MSG="$MSG_ERR_IMGSIZEPARTITION \"$2\"" ;;
|
||||
$OG_ERR_UPDATECACHE) MSG="$MSG_ERR_UPDATECACHE \"$2\"" ;;
|
||||
$OG_ERR_DONTFORMAT) MSG="$MSG_ERR_DONTFORMAT \"$2\"" ;;
|
||||
$OG_ERR_IMAGEFILE) MSG="$MSG_ERR_IMAGEFILE \"$2\"" ;;
|
||||
$OG_ERR_UCASTSYNTAXT) MSG="$MSG_ERR_UCASTSYNTAXT \"$2\"" ;;
|
||||
$OG_ERR_UCASTSENDPARTITION) MSG="$MSG_ERR_UCASTSENDPARTITION \"$2\"" ;;
|
||||
$OG_ERR_UCASTSENDFILE) MSG="$MSG_ERR_UCASTSENDFILE \"$2\"" ;;
|
||||
$OG_ERR_UCASTRECEIVERPARTITION) MSG="$MSG_ERR_UCASTRECEIVERPARTITION \"$2\"" ;;
|
||||
$OG_ERR_UCASTRECEIVERFILE) MSG="$MSG_ERR_UCASTRECEIVERFILE \"$2\"" ;;
|
||||
$OG_ERR_MCASTSYNTAXT) MSG="$MSG_ERR_MCASTSYNTAXT \"$2\"" ;;
|
||||
$OG_ERR_MCASTSENDFILE) MSG="$MSG_ERR_MCASTSENDFILE \"$2\"" ;;
|
||||
$OG_ERR_MCASTRECEIVERFILE) MSG="$MSG_ERR_MCASTRECEIVERFILE \"$2\"" ;;
|
||||
$OG_ERR_MCASTSENDPARTITION) MSG="$MSG_ERR_MCASTSENDPARTITION \"$2\"" ;;
|
||||
$OG_ERR_MCASTRECEIVERPARTITION) MSG="$MSG_ERR_MCASTRECEIVERPARTITION \"$2\"" ;;
|
||||
$OG_ERR_PROTOCOLJOINMASTER) MSG="$MSG_ERR_PROTOCOLJOINMASTER \"$2\"" ;;
|
||||
$OG_ERR_DONTMOUNT_IMAGE) MSG="$MSG_ERR_DONTMOUNT_IMAGE \"$2\"" ;;
|
||||
$OG_ERR_DONTUNMOUNT_IMAGE) MSG="$MSG_ERR_DONTUNMOUNT_IMAGE \"$2\"" ;;
|
||||
$OG_ERR_DONTSYNC_IMAGE) MSG="$MSG_ERR_DONTSYNC_IMAGE \"$2\"" ;;
|
||||
$OG_ERR_NOTDIFFERENT) MSG="$MSG_ERR_NOTDIFFERENT \"$2\"" ;;
|
||||
$OG_ERR_SYNCHRONIZING) MSG="$MSG_ERR_SYNCHRONIZING \"$2\"" ;;
|
||||
$OG_ERR_NOTUEFI) MSG="$MSG_ERR_NOTUEFI \"$2\"" ;;
|
||||
$OG_ERR_NOMSDOS) MSG="$MSG_ERR_NOMSDOS \"$2\"" ;;
|
||||
$OG_ERR_NOTBIOS) MSG="$MSG_ERR_NOTBIOS \"$2\"" ;;
|
||||
*) MSG="$MSG_ERR_GENERIC"; CODE=$OG_ERR_GENERIC ;;
|
||||
esac
|
||||
|
||||
# Obtener lista de funciones afectadas, incluyendo el script que las llama.
|
||||
FUNCS="${FUNCNAME[@]:1}"
|
||||
FUNCS="${FUNCS/main/$(basename $0 2>/dev/null)}"
|
||||
|
||||
# Mostrar mensaje de error si es función depurable y salir con el código indicado.
|
||||
if [ $CODE == $OG_ERR_FORMAT ] || ogCheckStringInGroup "$FUNCS" "$NODEBUGFUNCTIONS" || ! ogCheckStringInGroup "${FUNCS%% *}" "$NODEBUGFUNCTIONS"; then
|
||||
ogEcho $LOGS error "${FUNCS// /<-}: $MSG" >&2
|
||||
fi
|
||||
return $CODE
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogIsRepoLocked
|
||||
#@brief Comprueba si el repositorio está siendo usado (tiene ficheros abiertos).
|
||||
#@param No.
|
||||
#@return Código de salida: 0 - bloqueado, 1 - sin bloquear o error.
|
||||
#@version 0.10 - Primera versión para OpenGnSys.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-01-17
|
||||
#@version 1.0.1 - Devolver falso en caso de error.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-05-18
|
||||
#*/
|
||||
function ogIsRepoLocked ()
|
||||
{
|
||||
# Variables locales.
|
||||
local f FILES
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" "if $FUNCNAME; then ...; fi"
|
||||
return
|
||||
fi
|
||||
|
||||
# No hacer nada, si no está definido el punto de montaje del repositorio.
|
||||
[ -z "$OGIMG" ] && return 1
|
||||
|
||||
# Comprobar si alguno de los ficheros abiertos por los procesos activos está en el
|
||||
# punto de montaje del repositorio de imágenes.
|
||||
FILES=$(for f in /proc/[0-9]*/fd/*; do readlink -f "$f"; done | grep "^$OGIMG") # */ (comentario Doxygen)
|
||||
test -n "$FILES"
|
||||
}
|
||||
|
||||
|
||||
function ogCheckProgram ()
|
||||
{
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME \"str_program ...\"" \
|
||||
"$FUNCNAME \"partimage partclone mbuffer\""
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# == 1 ] || ogRaiseError $OG_ERR_FORMAT || return $?
|
||||
|
||||
local PERROR PLOG i
|
||||
PERROR=0
|
||||
PLOG=" "
|
||||
for i in `echo $1`
|
||||
do
|
||||
if [ ! `which $i` ]
|
||||
then
|
||||
PERROR=1
|
||||
PLOG="$PLOG $i"
|
||||
fi
|
||||
done
|
||||
if [ "$PERROR" == "1" ]
|
||||
then
|
||||
ogRaiseError $OG_ERR_NOTEXEC "$PLOG" || return $?
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
#### PRUEBA
|
||||
function ogIsVirtualMachine() {
|
||||
case "$(dmidecode -s system-product-name)" in
|
||||
KVM|VirtualBox)
|
||||
return 1 ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
# * @mainpage Proyecto OpenGnSys
|
||||
# *
|
||||
# * Documentación de la API de funciones del motor de clonación de OpenGnSys.
|
||||
# *
|
||||
# *
|
||||
# * @file ToolsGNU.c
|
||||
# * @brief Librería o clase Tools GNU used by OpenGNSys
|
||||
# * @class Tools
|
||||
# * @brief Herramientas gnu utilizadas por opengnsys.
|
||||
# * @version 0.9
|
||||
# * @warning License: GNU GPLv3+
|
||||
# */
|
||||
|
||||
function install ()
|
||||
{
|
||||
[ $# = 0 ] && echo pasar url del tar.gz && return
|
||||
cd /tmp
|
||||
wget -O download.tgz $1
|
||||
mkdir download || directorio no creado
|
||||
tar xzvf download.tgz -C download
|
||||
for i in `ls download`
|
||||
do
|
||||
cd download/$i
|
||||
[ -e "configure" ] && ./configure
|
||||
make && make install
|
||||
cd - && rm -fr download*
|
||||
done
|
||||
}
|
||||
|
||||
function mbuffer ()
|
||||
{
|
||||
if [ "$1" = install ]
|
||||
then
|
||||
install "http://www.maier-komor.de/software/mbuffer/mbuffer-20110119.tgz"
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
function ms-sys ()
|
||||
{
|
||||
if [ "$1" = install ]
|
||||
then
|
||||
install "http://prdownloads.sourceforge.net/ms-sys/ms-sys-2.2.1.tar.gz?download"
|
||||
#install "http://downloads.sourceforge.net/project/ms-sys/ms-sys%20development/2.1.5/ms-sys-2.1.5.tar.gz"
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
function ctorrent ()
|
||||
{
|
||||
if [ "$1" = install ]
|
||||
then
|
||||
install "http://sourceforge.net/projects/dtorrent/files/dtorrent/3.3.2/ctorrent-dnh3.3.2.tar.gz/download"
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
function udpcast ()
|
||||
{
|
||||
if [ "$1" = install ]
|
||||
then
|
||||
install "http://udpcast.linux.lu/download/udpcast-20100130.tar.gz"
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
function ntfs-3g ()
|
||||
{
|
||||
if [ "$1" = install ]
|
||||
then
|
||||
install "http://tuxera.com/opensource/ntfs-3g-2011.1.15.tgz"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function partitionsaving ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function awk ()
|
||||
{
|
||||
}
|
||||
|
||||
function chntpw ()
|
||||
{
|
||||
}
|
||||
|
||||
function ctorrent ()
|
||||
{
|
||||
}
|
||||
|
||||
function fdisk ()
|
||||
{
|
||||
}
|
||||
|
||||
function fsck ()
|
||||
{
|
||||
}
|
||||
|
||||
function kexec ()
|
||||
{
|
||||
}
|
||||
|
||||
function lshw ()
|
||||
{
|
||||
}
|
||||
|
||||
function mkfs ()
|
||||
{
|
||||
}
|
||||
|
||||
function mount ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
function parted ()
|
||||
{
|
||||
}
|
||||
|
||||
function partimage ()
|
||||
{
|
||||
}
|
||||
|
||||
function partprobe ()
|
||||
{
|
||||
}
|
||||
|
||||
function sfdisk ()
|
||||
{
|
||||
}
|
||||
|
||||
function umount ()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,679 @@
|
|||
#!/bin/bash
|
||||
# Libreria provisional para uso de UEFI
|
||||
# Las funciones se incluirán las librerías ya existentes
|
||||
|
||||
#/**
|
||||
# ogNvramActiveEntry
|
||||
#@brief Activa entrada de la NVRAM identificada por la etiqueta o el orden
|
||||
#@param Num_order_entry | Label_entry Número de orden o la etiqueta de la entrada a borrar.
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#*/ ##
|
||||
function ogNvramActiveEntry () {
|
||||
local NUMENTRY
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ Num_order_entry | Label_entry ] " \
|
||||
"$FUNCNAME 2" \
|
||||
"$FUNCNAME \"Windows Boot Manager\""
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# -eq 1 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME [ Num_order_entry | Label_entry ]" || return $?
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
# Distingo si es número de orden o etiqueta
|
||||
if [[ $1 =~ ^([0-9a-fA-F]+)$ ]]; then
|
||||
NUMENTRY=$( efibootmgr |awk -v NUM="$(printf %04x 0x$1|tr '[:lower:]' '[:upper:]')" '{ if($1~NUM) print substr($1,5,4)}')
|
||||
else
|
||||
NUMENTRY=$(efibootmgr |awk -v LABEL="$1" '{ if(substr($0, index($0,$2))==LABEL) print substr($1,5,4)}')
|
||||
fi
|
||||
|
||||
[ "$NUMENTRY" == "" ] && return $(ogRaiseError $OG_ERR_NOTFOUND "NVRAM entry '$1'")
|
||||
|
||||
efibootmgr -a -b $NUMENTRY &>/dev/null
|
||||
}
|
||||
|
||||
#/**
|
||||
# ogNvramAddEntry
|
||||
#@brief Crea nueva entrada en el gestor de arranque (NVRAM), opcionalmente la incluye al final del orden de arranque.
|
||||
#@param Str_Label_entry Número de disco o etiqueta de la entrada a crear.
|
||||
#@param Str_BootLoader Número de partición o cargador de arranque.
|
||||
#@param Bool_Incluir_Arranque Incluir en el orden de arranque (por defecto FALSE) (opcional)
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#*/ ##
|
||||
function ogNvramAddEntry () {
|
||||
local EFIDISK EFIPART BOOTLABEL BOOTLOADER ADDORDER
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME Str_label_entry Str_boot_loader [ Bool_add_bootorder ]" \
|
||||
"$FUNCNAME 1 2 TRUE" \
|
||||
"$FUNCNAME grub /EFI/grub/grubx64.efi TRUE" \
|
||||
"$FUNCNAME Windows /EFI/Microsoft/Boot/bootmgfw.efi"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# -ge 2 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME Str_label_entry Str_boot_locader" || return $?
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
read -e EFIDISK EFIPART <<<"$(ogGetEsp)"
|
||||
[ -n "$EFIPART" ] || ogRaiseError $OG_ERR_NOTFOUND "ESP" || return $?
|
||||
|
||||
# Recogemos parámetros
|
||||
# Distinguimos si es disco/partición o etiqueta/cargador
|
||||
if [[ "$1$2" =~ ^([0-9]+)$ ]]; then
|
||||
BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
|
||||
BOOTLOADER="/EFI/$BOOTLABEL/Boot/ogloader.efi"
|
||||
else
|
||||
BOOTLABEL="$1"
|
||||
BOOTLOADER="$2"
|
||||
fi
|
||||
|
||||
|
||||
# Si existe entrada con la misma etiqueta la borramos
|
||||
ogNvramDeleteEntry "$BOOTLABEL" 2>/dev/null
|
||||
|
||||
efibootmgr -C -d $(ogDiskToDev $EFIDISK) -p $EFIPART -L "$BOOTLABEL" -l "$BOOTLOADER" &>/dev/null
|
||||
|
||||
# Incluimos la entrada en el orden de arranque (opcional)
|
||||
if [ "${3^^}" == "TRUE" ]; then
|
||||
NUMENTRY=$(efibootmgr |awk -v LABEL="$BOOTLABEL" '{ if(substr($0, index($0,$2))==LABEL) print substr($1,5,4)}')
|
||||
ogNvramSetOrder $(ogNvramGetOrder |tr , " ") $NUMENTRY
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogCopyEfiBootLoader int_ndisk str_repo path_image
|
||||
#@brief Copia el cargador de arranque desde la partición EFI a la de sistema.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_part nº de partición
|
||||
#@return (nada, por determinar)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#@note Si existe el cargador en la partición de sistema no es válido
|
||||
#*/ ##
|
||||
function ogCopyEfiBootLoader () {
|
||||
# Variables locales
|
||||
local MNTDIR EFIDIR BOOTLABEL OSVERSION LOADER f
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_part" \
|
||||
"$FUNCNAME 1 2"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 2 arámetros.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME int_ndisk int_part" || return $?
|
||||
|
||||
# Comprobamos que exista partición de sistema y la ESP
|
||||
MNTDIR=$(ogMount $1 $2) || ogRaiseError $OG_ERR_PARTITION "$DISK $PART" || return $?
|
||||
EFIDIR=$(ogMount $(ogGetEsp)) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
|
||||
|
||||
# Comprobamos que exista el cargador
|
||||
BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
|
||||
OSVERSION=$(ogGetOsVersion $1 $2)
|
||||
case $OSVERSION in
|
||||
*Windows\ 10*)
|
||||
for f in $EFIDIR/EFI/{Microsoft,$BOOTLABEL}/Boot/bootmgfw.efi; do
|
||||
[ -r $f ] && LOADER=$f
|
||||
done
|
||||
[ -n "$LOADER" ] || ogRaiseError $OG_ERR_NOTOS "$1 $2 ($OSVERSION, EFI)" || return $?
|
||||
# Si existe el directorio Boot lo borramos
|
||||
[ -d $MNTDIR/ogBoot ] && rm -rf $MNTDIR/ogBoot
|
||||
DIRLOADER=$(realpath "${LOADER%/*}/..")
|
||||
cp -r ${DIRLOADER}/Boot $MNTDIR/ogBoot
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramDeleteEntry
|
||||
#@brief Borra entrada de la NVRAM identificada por la etiqueta o el orden
|
||||
#@param Num_order_entry | Label_entry Número de orden o la etiqueta de la entrada a borrar.
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado (entrada en NVRAM).
|
||||
#*/ ##
|
||||
function ogNvramDeleteEntry () {
|
||||
local NUMENTRY n
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ Num_order_entry | Label_entry ] " \
|
||||
"$FUNCNAME 2" \
|
||||
"$FUNCNAME \"Windows Boot Manager\""
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# -eq 1 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME [ Num_order_entry | Label_entry ]" || return $?
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
# Distingo si es número de orden o etiqueta
|
||||
if [[ $1 =~ ^([0-9a-fA-F]+)$ ]]; then
|
||||
NUMENTRY=$( efibootmgr |awk -v NUM="$(printf %04x 0x$1|tr '[:lower:]' '[:upper:]')" '{ if($1~NUM) print substr($1,5,4)}')
|
||||
else
|
||||
NUMENTRY=$(efibootmgr |awk -v LABEL="$1" '{ if(substr($0, index($0,$2))==LABEL) print substr($1,5,4)}')
|
||||
fi
|
||||
|
||||
[ "$NUMENTRY" == "" ] && return $(ogRaiseError $OG_ERR_NOTFOUND "NVRAM entry '$1'")
|
||||
|
||||
for n in $NUMENTRY; do
|
||||
efibootmgr -B -b $n &>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramGetCurrent
|
||||
#@brief Muestra la entrada del gestor de arranque (NVRAM) que ha iniciado el equipo.
|
||||
#@return Entrada con la que se ha iniciado el equipo
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#*/ ##
|
||||
function ogNvramGetCurrent () {
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" \
|
||||
"$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
efibootmgr| awk -v bootentry=99999 '{if ($1~/BootCurrent/) bootentry=$2; if ($1~bootentry) printf "%s %s %s\n", gensub(/^0{1,3}/,"",1,substr($1,5,4))," ", substr($0, index($0,$2))}'
|
||||
}
|
||||
|
||||
|
||||
# ogNvramGetNext
|
||||
#@brief Muestra la entrada del gestor de arranque (NVRAM) que se utilizará en el próximo arranque.
|
||||
#@return Entrada que se utilizará en el próximo arranque
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#*/ ##
|
||||
function ogNvramGetNext () {
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" \
|
||||
"$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
efibootmgr|awk '{ if ($1 == "BootNext:") print $2}'
|
||||
}
|
||||
|
||||
|
||||
# ogNvramGetOrder
|
||||
#@brief Muestra el orden de las entradas del gestor de arranque (NVRAM)
|
||||
#@return Orden de las entradas
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#*/ ##
|
||||
function ogNvramGetOrder () {
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" \
|
||||
"$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
efibootmgr|awk '{ if ($1 == "BootOrder:") print $2}'
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramGetTimeout
|
||||
#@brief Muestra el tiempo de espera del gestor de arranque (NVRAM)
|
||||
#@return Timeout de la NVRAM
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#*/ ##
|
||||
function ogNvramGetTimeout () {
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" \
|
||||
"$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
efibootmgr|awk '{ if ($1 == "Timeout:") print substr($0, index($0,$2))}'
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogGrubUefiConf int_ndisk int_part str_dir_grub
|
||||
#@brief Genera el fichero grub.cfg de la ESP
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_part nº de partición
|
||||
#@param str_dir_grub prefijo del directorio de grub en la partición de sistema. ej: /boot/grubPARTITION
|
||||
#@return (nada, por determinar)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#@TODO Confirmar si el fichero "$EFIDIR/EFI/$BOOTLABEL/grub.cfg" es necesario.
|
||||
#*/ ##
|
||||
function ogGrubUefiConf () {
|
||||
local EFIDIR BOOTLABEL GRUBEFI UUID DEVICE PREFIXSECONDSTAGE EFIGRUBDIR
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_part [ str_dir_grub ]" \
|
||||
"$FUNCNAME 1 2" \
|
||||
"$FUNCNAME 1 3 /boot/grubPARTITION"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben al menos 2 parámetros.
|
||||
[ $# -ge 2 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME int_ndisk int_part [ str_dir_grub ]" || return $?
|
||||
|
||||
# Directorio del grub en la partición de sistema
|
||||
PREFIXSECONDSTAGE="$3"
|
||||
|
||||
EFIDIR=$(ogMount $(ogGetEsp)) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
|
||||
BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
|
||||
EFIGRUBDIR="$EFIDIR/EFI/$BOOTLABEL/boot/grub"
|
||||
# Comprobamos que existe directorio
|
||||
[ -d "$EFIGRUBDIR" ] || mkdir -p "$EFIGRUBDIR"
|
||||
# Parcheamos uuid y particion en grub.cfg
|
||||
UUID=$(blkid -o value -s UUID $(ogDiskToDev $1 $2))
|
||||
DEVICE="hd$(expr $1 - 1 ),gpt$2"
|
||||
|
||||
cat << EOT > $EFIGRUBDIR/grub.cfg
|
||||
set root='$DEVICE'
|
||||
set prefix=(\$root)'${PREFIXSECONDSTAGE}/boot/grub'
|
||||
configfile \$prefix/grub.cfg
|
||||
EOT
|
||||
|
||||
# Provisional: confirmar si el segundo archivo se utiliza
|
||||
cp $EFIGRUBDIR/grub.cfg "$EFIDIR/EFI/$BOOTLABEL/grub.cfg"
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramInactiveEntry
|
||||
#@brief Inactiva entrada de la NVRAM identificada por la etiqueta o el orden
|
||||
#@param Num_order_entry | Label_entry Número de orden o la etiqueta de la entrada a borrar.
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#*/ ##
|
||||
function ogNvramInactiveEntry () {
|
||||
local NUMENTRY
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ Num_order_entry | Label_entry ] " \
|
||||
"$FUNCNAME 2" \
|
||||
"$FUNCNAME \"Windows Boot Manager\""
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# -eq 1 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME [ Num_order_entry | Label_entry ]" || return $?
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
# Distingo si es número de orden o etiqueta
|
||||
if [[ $1 =~ ^([0-9a-fA-F]+)$ ]]; then
|
||||
NUMENTRY=$( efibootmgr |awk -v NUM="$(printf %04x 0x$1|tr '[:lower:]' '[:upper:]')" '{ if($1~NUM) print substr($1,5,4)}')
|
||||
else
|
||||
NUMENTRY=$(efibootmgr |awk -v LABEL="$1" '{ if(substr($0, index($0,$2))==LABEL) print substr($1,5,4)}')
|
||||
fi
|
||||
|
||||
[ "$NUMENTRY" == "" ] && return $(ogRaiseError $OG_ERR_NOTFOUND "NVRAM entry '$1'")
|
||||
|
||||
efibootmgr -A -b $NUMENTRY &>/dev/null
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramList
|
||||
#@brief Lista las entradas de la NVRAN (sólo equipos UEFI)
|
||||
#@return Entradas de la NVRAM con el formato: orden etiqueta [* (si está activa) ]
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#*/ ##
|
||||
function ogNvramList () {
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" \
|
||||
"$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
efibootmgr |awk '{if($1~/Boot[[:digit:]]/) ; active="" ;if ($1~/*/) active="*"; if($1~/Boot[[:digit:]]/) printf "%4s %s %s %s\n", gensub(/^0{1,3}/,"",1,substr($1,5,4))," ", substr($0, index($0,$2)), active}'
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramPxeFirstEntry
|
||||
#@brief Sitúa la entrada de la tarjeta de red en el primer lugar en la NVRAM.
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#*/ ##
|
||||
function ogNvramPxeFirstEntry (){
|
||||
local NUMENTRY ORDER
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME" \
|
||||
"$FUNCNAME"
|
||||
return
|
||||
fi
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
NUMENTRY=$(printf %04X 0x$(efibootmgr|awk '/IP[vV]{0,1}4/ {print gensub(/^0{1,3}/,"",1,substr($1,5,4))}'))
|
||||
|
||||
# Si la entrada es la primera nos salimos.
|
||||
[[ $(ogNvramGetOrder) =~ ^$NUMENTRY ]] && return
|
||||
|
||||
# Si la entrada ya existe la borramos.
|
||||
ORDER="$NUMENTRY $(ogNvramGetOrder| sed -e s/$NUMENTRY//g -e s/,/' '/g)"
|
||||
|
||||
ogNvramSetOrder $ORDER
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogRestoreEfiBootLoader int_ndisk str_repo
|
||||
#@brief Copia el cargador de arranque de la partición de sistema a la partición EFI.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_part nº de partición
|
||||
#@return (nada, por determinar)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado (partición de sistema o EFI).
|
||||
#@exception OG_ERR_NOTOS sin sistema operativo.
|
||||
#*/ ##
|
||||
function ogRestoreEfiBootLoader () {
|
||||
# Variables locales
|
||||
local MNTDIR EFIDIR BOOTLABEL OSVERSION LOADER f UUID DEVICE
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_part" \
|
||||
"$FUNCNAME 1 2"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben 2 arámetros.
|
||||
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME int_ndisk int_part" || return $?
|
||||
|
||||
# Comprobamos que exista partición de sistema y la ESP
|
||||
MNTDIR=$(ogMount $1 $2) || ogRaiseError $OG_ERR_PARTITION "$DISK $PART" || return $?
|
||||
EFIDIR=$(ogMount $(ogGetEsp))
|
||||
if [ "$EFIDIR" == "" ]; then
|
||||
ogFormat $(ogGetEsp) FAT32
|
||||
EFIDIR=$(ogMount $(ogGetEsp)) || ogRaiseError $OG_ERR_PARTITION "ESP" || return $?
|
||||
fi
|
||||
|
||||
# Comprobamos que exista el cargador
|
||||
#BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
|
||||
OSVERSION=$(ogGetOsVersion $1 $2)
|
||||
case $OSVERSION in
|
||||
*Windows\ 10*)
|
||||
BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
|
||||
LOADER=$(ogGetPath $MNTDIR/ogBoot/bootmgfw.efi)
|
||||
[ -n "$LOADER" ] || ogRaiseError $OG_ERR_NOTOS "$1 $2 ($OSVERSION, EFI)" || return $?
|
||||
[ -r $EFIDIR/EFI/$BOOTLABEL ] && rm -rf $EFIDIR/EFI/$BOOTLABEL
|
||||
mkdir -p $EFIDIR/EFI/$BOOTLABEL
|
||||
cp -r "${LOADER%/*}" $EFIDIR/EFI/$BOOTLABEL/Boot
|
||||
# Nombre OpenGnsys para cargador
|
||||
cp $LOADER $EFIDIR/EFI/$BOOTLABEL/Boot/ogloader.efi
|
||||
|
||||
# Si existe subcarpeta Microsoft en la partición EFI la renombramos
|
||||
[ "$(ogGetPath $EFIDIR/EFI/Microsoft)" == "" ] || mv $EFIDIR/EFI/{Microsoft,Microsoft.backup.og}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogRestoreUuidPartitions
|
||||
#@brief Restaura los uuid de las particiones y la tabla de particiones
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_nfilesys nº de orden del sistema de archivos
|
||||
#@param REPO|CACHE repositorio
|
||||
#@param str_imgname nombre de la imagen
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT Formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND No encontrado fichero de información de la imagen (con uuid)
|
||||
#*/ ##
|
||||
function ogRestoreUuidPartitions () {
|
||||
local DISK PART IMGNAME INFOFILE DEVICE DATA GUID UUID IMGGUID
|
||||
local EFIDEVICE EFIDATA EFIGUID EFIUUID EFIUUID IMGEFIGUID
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME REPO|CACHE str_imgname int_ndisk int_npart" \
|
||||
"$FUNCNAME REPO Windows 1 2"
|
||||
return
|
||||
fi
|
||||
# Error si no se reciben 4 parámetros.
|
||||
[ $# -eq 4 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME REPO|CACHE str_imgname int_ndisk int_npart" || return $?
|
||||
|
||||
# Sólo se ejecuta si es UEFI
|
||||
ogIsEfiActive || return
|
||||
|
||||
# Parámetros de entrada
|
||||
IMGNAME="$2"
|
||||
INFOFILE="$OGIMG/.$IMGNAME.img.json"
|
||||
[ "${1^^}" == "CACHE" ] && INFOFILE="$OGCAC$INFOFILE"
|
||||
# TODO: que la función getPath soporte archivos ocultos
|
||||
ls $INFOFILE &>/dev/null || ogRaiseError $OG_ERR_NOTFOUND "$INFOFILE" || return $?
|
||||
DISK=$3
|
||||
PART=$4
|
||||
|
||||
DEVICE=$(ogDiskToDev $DISK)
|
||||
read -e EFIDISK EFIPART <<<"$(ogGetEsp)"
|
||||
|
||||
# Datos de la imagen
|
||||
IMGGUID=$(jq .guid $INFOFILE|tr -d \")
|
||||
IMGEFIGUID=$(jq .espguid $INFOFILE|tr -d \")
|
||||
|
||||
# Datos actuales
|
||||
DATA=$(sfdisk -J $DEVICE)
|
||||
GUID=$(echo $DATA|jq ".partitiontable|.id"|tr -d \")
|
||||
|
||||
if [ "$IMGGUID" != "$GUID" ]; then
|
||||
echo sgdisk -U "$IMGGUID" "$DEVICE"
|
||||
sgdisk -U "$IMGGUID" "$DEVICE"
|
||||
partprobe
|
||||
fi
|
||||
|
||||
if [ $DISK -eq $EFIDISK ]; then
|
||||
EFIDATA=$DATA
|
||||
EFIDEVICE=$DEVICE
|
||||
else
|
||||
EFIDEVICE=$(ogDiskToDev $EFIDISK) || return $?
|
||||
EFIDATA=$(sfdisk -J $EFIDEVICE)
|
||||
EFIGUID=$(echo $EFIDATA|jq ".partitiontable|.id"|tr -d \")
|
||||
if [ "$IMGEFIGUID" != "$EFIGUID" ]; then
|
||||
echo sgdisk -U "$IMGEFIGUID" "$EFIDEVICE"
|
||||
sgdisk -U "$IMGEFIGUID" "$EFIDEVICE"
|
||||
partprobe
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramSetNext
|
||||
#@brief Configura el próximo arranque con la entrada del gestor de arranque (NVRAM) identificada por la etiqueta o el orden.
|
||||
#@param Num_order_entry | Label_entry Número de orden o la etiqueta de la entrada a borrar.
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#*/ ##
|
||||
function ogNvramSetNext () {
|
||||
local NUMENTRY
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME [ Num_order_entry | Label_entry ] " \
|
||||
"$FUNCNAME 2" \
|
||||
"$FUNCNAME \"Windows Boot Manager\""
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# -eq 1 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME [ Num_order_entry | Label_entry ]" || return $?
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
# Distingo si es número de orden o etiqueta
|
||||
if [[ $1 =~ ^([0-9a-fA-F]+)$ ]]; then
|
||||
NUMENTRY=$( efibootmgr |awk -v NUM="$(printf %04x 0x$1|tr '[:lower:]' '[:upper:]')" '{ if($1~NUM) print substr($1,5,4)}')
|
||||
else
|
||||
NUMENTRY=$(efibootmgr |awk -v LABEL="$1" '{ if(substr($0, index($0,$2))==LABEL) print substr($1,5,4)}')
|
||||
fi
|
||||
|
||||
[ "$NUMENTRY" == "" ] && return $(ogRaiseError $OG_ERR_NOTFOUND "NVRAM entry '$1'")
|
||||
|
||||
efibootmgr -n $NUMENTRY &>/dev/null
|
||||
}
|
||||
|
||||
#/**
|
||||
# ogNvramSetOrder
|
||||
#@brief Configura el orden de las entradas de la NVRAM
|
||||
#@param Orden de las entradas separadas por espacios
|
||||
#@return (nada)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTUEFI UEFI no activa.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado (entrada NVRAM).
|
||||
#*/ ##
|
||||
function ogNvramSetOrder () {
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME Num_order1 [ Num_order2 ] ... " \
|
||||
"$FUNCNAME 1 3"
|
||||
return
|
||||
fi
|
||||
#
|
||||
# Error si no se recibe al menos 1 parámetro.
|
||||
[ $# -ge 1 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME Num_order1 [ Num_order2 ] ..." || return $?
|
||||
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
# Comprobamos que sean números
|
||||
[[ "$@" =~ ^([0-9a-fA-F ]+)$ ]] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME Num_order1 [ Num_order2 ] ..." || return $?
|
||||
|
||||
# Entradas de la NVRAM actuales
|
||||
NUMENTRYS=$(efibootmgr|awk '{ if ($1~/Boot[0-9a-fA-F]{4}/) printf "0%s ", substr($1,5,4)}')
|
||||
|
||||
ORDER=""
|
||||
for ARG in $@; do
|
||||
# Si no existe la entrada me salgo
|
||||
ARG=$(printf %04X 0x$ARG)
|
||||
echo $NUMENTRYS | grep "$ARG" &>/dev/null || ogRaiseError $OG_ERR_NOTFOUND "NVRAM entry order \"$ARG\"" || return $?
|
||||
ORDER=${ORDER},$ARG
|
||||
done
|
||||
|
||||
# Cambiamos el orden
|
||||
efibootmgr -o ${ORDER#,} &>/dev/null
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogNvramSetTimeout
|
||||
#@brief Configura el tiempo de espera de la NVRAM
|
||||
#@param Orden de las entradas separadas por espacios
|
||||
#@return (nada)
|
||||
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#*/ ##
|
||||
function ogNvramSetTimeout () {
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_Timeout (seg)" \
|
||||
"$FUNCNAME 2"
|
||||
return
|
||||
fi
|
||||
#
|
||||
# Si no es equipo UEFI salir con error
|
||||
ogIsEfiActive || ogRaiseError $OG_ERR_NOTUEFI || return $?
|
||||
|
||||
# Error si no se recibe 1 parámetro.
|
||||
[ $# -eq 1 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME int_Timeout (seg)" || return $?
|
||||
|
||||
# Comprobamos que sea un número
|
||||
[[ "$1" =~ ^([0-9 ]+)*$ ]] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME int_Timeout (seg)" || return $?
|
||||
|
||||
# Cambiamos el orden
|
||||
efibootmgr -t $1 &>/dev/null
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogUuidChange int_ndisk str_repo
|
||||
#@brief Reemplaza el UUID de un sistema de ficheros.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_part nº de partición
|
||||
#@return (nada, por determinar)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
#*/ ##
|
||||
function ogUuidChange () {
|
||||
local MNTDIR DEVICE UUID NEWUUID f
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if [ "$*" == "help" ]; then
|
||||
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_part" \
|
||||
"$FUNCNAME 1 2"
|
||||
return
|
||||
fi
|
||||
|
||||
# Error si no se reciben al menos 2 parámetros.
|
||||
[ $# -eq 2 ] || ogRaiseError $OG_ERR_FORMAT "$FUNCNAME int_ndisk int_part" || return $?
|
||||
|
||||
# Comprobamos que exista la partición
|
||||
MNTDIR=$(ogMount $1 $2) || ogRaiseError $OG_ERR_NOTFOUND "Device $1 $2" || return $?
|
||||
DEVICE=$(ogDiskToDev $1 $2)
|
||||
UUID=$(blkid -o value -s UUID $DEVICE)
|
||||
NEWUUID=$(cat /proc/sys/kernel/random/uuid)
|
||||
|
||||
# Cambiamos UUID a la partición
|
||||
ogUnmount $1 $2
|
||||
tune2fs $DEVICE -U $NEWUUID
|
||||
|
||||
# Cambiamos UUID en la configuración (fstab y grub)
|
||||
ogMount $1 $2
|
||||
for f in $MNTDIR/etc/fstab $MNTDIR/{,boot/}{{grubMBR,grubPARTITION}/boot/,}{grub{,2},{,efi/}EFI/*}/{menu.lst,grub.cfg}; do
|
||||
[ -r $f ] && sed -i s/$UUID/$NEWUUID/g $f
|
||||
done
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
OpenGsSys Client README
|
||||
==========================
|
||||
|
||||
|
||||
Este directorio contiene la estructura principal de datos que será
|
||||
importada por los cleintes OpenGnsys mediante Samba (o NFS en las
|
||||
primeras versiones del Proyecto).
|
||||
|
||||
Los subdirectorios se copian íntegramente al servidor bajo
|
||||
/opt/opengnsys/client y serán importados por los clientes en
|
||||
/opt/opengnsys.
|
||||
|
||||
La estructura de datos es la siguiente:
|
||||
|
||||
- bin scripts o binarios ejecutables por el cliente (compilados
|
||||
estáticamente).
|
||||
- cache directorio donde se montará la caché local del cliente.
|
||||
- etc ficheros de configuración del cliente.
|
||||
- lib librerías de funciones.
|
||||
- engine/bin ficheros con las funciones del motor de clonación.
|
||||
- httpd ficheros de configuración del servicio lighttpd.
|
||||
- modules módulos extra para el Kernel del cliente.
|
||||
- qtlib librerías Qt complementarias del Browser.
|
||||
- qtplugins plugins Qt para el Browser.
|
||||
- images repositorio de imágenes de sistemas operativos.
|
||||
- log registro de incidencias de los clientes.
|
||||
- scripts funciones de alto nivel ejecutables por OpenGnsys Browser
|
||||
y OpenGnsys Admin.
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file poweroffconf
|
||||
#@brief Control de parada tras tiempo de inactividad para ahorro de energía.
|
||||
#@license GNU GPLv3+
|
||||
#@param int_minutos Minutos de inactividad (opcional); "no" para deshabilitar..
|
||||
#@note La comprobación periódica debe ejecutarse en el "cron" del sistema.
|
||||
#@note Fichero de configuración: /etc/poweroff.conf
|
||||
#@author Ramón Gómez - Univ. Sevilla
|
||||
#@date 2011-10-25
|
||||
#@version 1.0.5: incluir opción para deshabilitar ahorro de energía.
|
||||
#@author Ramón Gómez - Univ. Sevilla
|
||||
#@date 2014-02-07
|
||||
#@version 1.1.1: Corregir problema al cambiar de día
|
||||
#@author Ramón Gómez - Univ. Sevilla
|
||||
#@date 2018-07-04
|
||||
#*/
|
||||
|
||||
|
||||
# Variables generales.
|
||||
OPENGNSYS=${OPENGNSYS:-/opt/opengnsys} # Instalación de OpenGnsys
|
||||
OGETC=${OGETC:-$OPENGNSYS/etc} # Configuración de OpenGnsys
|
||||
POWEROFFCONF=/etc/poweroff.conf # Configuración del script
|
||||
|
||||
# Error si no existe el fichero de configuración de ahorro de energía.
|
||||
if [ ! -f $POWEROFFCONF ]; then
|
||||
ogRaiseError $OG_ERR_NOTFOUND "$POWEROFFCONF"
|
||||
exit $?
|
||||
fi
|
||||
# Obtener parámetros de configuración de ahorro de energía.
|
||||
source $POWEROFFCONF
|
||||
export TZ
|
||||
|
||||
case $# in
|
||||
0) # Sin parámetros, comprobar que existe la variable POWEROFFSLEEP.
|
||||
if [ -z "$POWEROFFSLEEP" ]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "Sin tiempo de espera."
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
1) # Nuevo timepo de espera.
|
||||
POWEROFFSLEEP="$1"
|
||||
# Se deshabilita si se introduce la cadena "no" como tiempo de espera.
|
||||
[ "$POWEROFFSLEEP" == "no" ] && POWEROFFSLEEP=
|
||||
# Error si tiempo de espera no es nulo o entero positivo.
|
||||
if [[ ! "$POWEROFFSLEEP" =~ ^[0-9]*$ ]]; then
|
||||
ogRaiseError $OG_ERR_FORMAT "Parámetro debe ser núm. minutos o \"no\" para deshabilitar."
|
||||
exit $?
|
||||
fi
|
||||
# Actualizar fichero de configuración con nuevo periodo de parada.
|
||||
perl -pi -e "s/POWEROFFSLEEP=.*/POWEROFFSLEEP=$POWEROFFSLEEP/" $POWEROFFCONF
|
||||
# Si se necesita, recalcular tiempo de parada.
|
||||
if [ -n "POWEROFFTIME" ]; then
|
||||
# Asignar tiempo de apagado si no está deshabilitado y actualizar fichero.
|
||||
POWEROFFTIME=${POWEROFFSLEEP:+$(date --date="$POWEROFFSLEEP min" +"%s")}
|
||||
perl -pi -e "s/POWEROFFTIME=.*/POWEROFFTIME=$POWEROFFTIME/" $POWEROFFCONF
|
||||
fi
|
||||
exit 0 ;;
|
||||
*) # Error de formato de ejecución.
|
||||
ogRaiseError $OG_ERR_FORMAT "Formato: $0 [int_minutos | no]"
|
||||
exit $? ;;
|
||||
esac
|
||||
# Comprobar si hay algún script en ejecución (verificando compatibilidad de "pgrep").
|
||||
[ -n "$(pgrep -fa 2>&1 | grep "invalid")" ] && PGREP="pgrep -fl" || PGREP="pgrep -fa"
|
||||
if [ -n "$($PGREP $OPENGNSYS | egrep -v "$OGETC|$0")" ]; then
|
||||
# Eliminar tiempo de inicio de espera, si se está ejecutando operación.
|
||||
perl -pi -e 's/POWEROFFTIME=.*$/POWEROFFTIME=/' $POWEROFFCONF
|
||||
else
|
||||
# Si el sistema está en estado de espera, ...
|
||||
NOW=$(date +"%s")
|
||||
if [ -z "$POWEROFFTIME" ]; then
|
||||
# Asignar tiempo de inicio, si no estaba definido.
|
||||
POWEROFFTIME=$(date --date="$POWEROFFSLEEP min" +"%s")
|
||||
perl -pi -e "s/POWEROFFTIME=.*$/POWEROFFTIME=$POWEROFFTIME/" $POWEROFFCONF
|
||||
else
|
||||
# Apagar el equipo si se sobrepasa el periodo de espera.
|
||||
if [ $NOW -ge $POWEROFFTIME ]; then
|
||||
$OPENGNSYS/scripts/poweroff
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import doctest
|
||||
import re
|
||||
|
||||
FIRST_SCRIPT = 'prepare'
|
||||
LAST_SCRIPT = 'cleanup'
|
||||
|
||||
PRE_EXTENSION = '.pre'
|
||||
POST_EXTENSION = '.post'
|
||||
|
||||
PYTHON_TEST_EXTENSION = '.pytest'
|
||||
BASH_TEST_EXTENSION = '.shtest'
|
||||
|
||||
|
||||
class RunTest:
|
||||
'''Runs the tests'''
|
||||
|
||||
def __init__(self):
|
||||
self.path = os.path.abspath('.')
|
||||
|
||||
# Only no-hide files
|
||||
self.all_files = [filename for filename in os.listdir(self.path)
|
||||
if filename[0] != '.' and os.path.isfile(filename)]
|
||||
|
||||
self.all_files = sorted(self.all_files)
|
||||
|
||||
self.python_tests = []
|
||||
self.bash_tests = []
|
||||
self.script_tests = []
|
||||
self.first_script = ''
|
||||
self.last_script = ''
|
||||
self.pre_scripts = []
|
||||
self.post_scripts = []
|
||||
|
||||
for filename in self.all_files:
|
||||
if filename.endswith(PYTHON_TEST_EXTENSION):
|
||||
self.python_tests.append(filename)
|
||||
|
||||
elif filename.endswith(BASH_TEST_EXTENSION):
|
||||
self.bash_tests.append(filename)
|
||||
|
||||
elif os.access(filename, os.X_OK):
|
||||
basename, extension = os.path.splitext(filename)
|
||||
if basename == FIRST_SCRIPT:
|
||||
if self.first_script:
|
||||
raise MoreThanOneFirstScript()
|
||||
self.first_script = filename
|
||||
elif basename == LAST_SCRIPT:
|
||||
if self.last_script:
|
||||
raise MoreThanOneLastScript()
|
||||
self.last_script = filename
|
||||
elif extension == PRE_EXTENSION:
|
||||
self.pre_scripts.append(filename)
|
||||
elif extension == POST_EXTENSION:
|
||||
self.post_scripts.append(filename)
|
||||
else:
|
||||
self.script_tests.append(filename)
|
||||
|
||||
self.fails = 0
|
||||
|
||||
def run_script(self, script):
|
||||
'''Run a script test'''
|
||||
path_script = os.path.join(self.path, script)
|
||||
proc = subprocess.Popen((path_script), shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
return_value = proc.wait()
|
||||
if return_value != 0:
|
||||
self.fails += 1
|
||||
stdout, stderr = proc.communicate()
|
||||
print("*******************************************************")
|
||||
print("Error %d in %s:" % (return_value, script))
|
||||
print(stdout.decode(), end='')
|
||||
print(stderr.decode(), end='')
|
||||
|
||||
return return_value
|
||||
|
||||
def run_bash_test(self, script):
|
||||
'''Run bash test'''
|
||||
#import pdb; pdb.set_trace()
|
||||
path_script = os.path.join(self.path, script)
|
||||
errors = 0
|
||||
test_no = 0
|
||||
|
||||
for command, result, line in read_bash_tests(path_script):
|
||||
test_no += 1
|
||||
try:
|
||||
proc = subprocess.Popen(('/bin/bash', '-c', command),
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
stdout = proc.communicate()[0]
|
||||
except OSError as exc:
|
||||
print('File "%s" line %d:' % (script, line))
|
||||
print('Failed example:')
|
||||
print(' ' + command)
|
||||
print("Exception was raised:")
|
||||
print(" ", end="")
|
||||
print(exc)
|
||||
print("*******************************************************")
|
||||
errors += 1
|
||||
|
||||
else:
|
||||
if result != stdout.decode():
|
||||
print('File "%s" line %d:' % (script, line))
|
||||
print('Failed example:')
|
||||
print(' ' + command)
|
||||
print("Expected:")
|
||||
for l in result.split('\n')[:-1]:
|
||||
print(' ' + l)
|
||||
print("Got:")
|
||||
for l in stdout.decode().split('\n')[:-1]:
|
||||
print(' ' + l)
|
||||
errors += 1
|
||||
print("*******************************************************")
|
||||
|
||||
if errors != 0:
|
||||
print("%d items had failures:" % errors)
|
||||
print(" %d of %d in %s" % (errors, test_no, script))
|
||||
print("***Test failed***")
|
||||
else:
|
||||
print("%3d tests PASSED in %s" % (test_no, script))
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
def run_pre_test(self, test):
|
||||
'''Run the pre-test of a test'''
|
||||
pre_test = test + PRE_EXTENSION
|
||||
return_value = 0
|
||||
if pre_test in self.pre_scripts:
|
||||
return_value = self.run_script(pre_test)
|
||||
if return_value:
|
||||
print("No running: %s %s" % (test, test + POST_EXTENSION))
|
||||
|
||||
return return_value
|
||||
|
||||
def run_post_test(self, test):
|
||||
'''Run the post-test of a test'''
|
||||
post_test = test + POST_EXTENSION
|
||||
if post_test in self.post_scripts:
|
||||
return self.run_script(post_test)
|
||||
|
||||
def run_tests(self):
|
||||
'''Run the tests in the correct order'''
|
||||
if self.first_script:
|
||||
if self.run_script(self.first_script) != 0:
|
||||
print('*Error in prepare script. Aborting.*')
|
||||
return self.show_errors()
|
||||
|
||||
all_tests = sorted(self.script_tests + self.python_tests + self.bash_tests)
|
||||
for test in all_tests:
|
||||
if self.run_pre_test(test) != 0:
|
||||
continue
|
||||
|
||||
if test in self.script_tests:
|
||||
self.run_script(test)
|
||||
elif test in self.bash_tests:
|
||||
fails = self.run_bash_test(test)
|
||||
self.fails += fails
|
||||
elif test in self.python_tests:
|
||||
fails, n_tests = doctest.testfile(test, module_relative=False)
|
||||
self.fails += fails
|
||||
|
||||
self.run_post_test(test)
|
||||
|
||||
if self.last_script:
|
||||
self.run_script(self.last_script)
|
||||
|
||||
return self.show_errors()
|
||||
|
||||
def show_errors(self):
|
||||
'''Show the total errors'''
|
||||
if self.fails:
|
||||
print("*******************************************************")
|
||||
print("Total errors: %d" % self.fails)
|
||||
|
||||
return self.fails
|
||||
|
||||
class MoreThanOneFirstScript(Exception):
|
||||
def __init__(self):
|
||||
super(MoreThanOneFirstScript, self).__init__(
|
||||
"More than one %s script" % FIRST_SCRIPT)
|
||||
|
||||
class MoreThanOneLastScript(Exception):
|
||||
def __init__(self):
|
||||
super(MoreThanOneLastScript, self).__init__(
|
||||
"More than one %s script" % LAST_SCRIPT)
|
||||
|
||||
|
||||
def read_bash_tests(file_name):
|
||||
'''Iterator that yields the found tests'''
|
||||
fd = open(file_name)
|
||||
command = ''
|
||||
result = ''
|
||||
tests = []
|
||||
line_no = 0
|
||||
command_line = 0
|
||||
command_re = re.compile("^\$ (.*)\n")
|
||||
|
||||
for line in fd.readlines():
|
||||
line_no += 1
|
||||
|
||||
match = command_re.match(line)
|
||||
if match:
|
||||
# Is it a command?
|
||||
if command:
|
||||
# If it is a command but we have a previous command to send
|
||||
yield (command, result, command_line)
|
||||
result = ''
|
||||
|
||||
command = match.group(1)
|
||||
command_line = line_no
|
||||
|
||||
elif command:
|
||||
# If not a command but we have a previous command
|
||||
if line != "\n":
|
||||
# It's a part of the result
|
||||
if line == "<BLANKLINE>\n":
|
||||
result += '\n'
|
||||
else:
|
||||
result += line
|
||||
|
||||
else:
|
||||
# Or it's the end of the result, yielding
|
||||
|
||||
yield (command, result, command_line)
|
||||
command = ''
|
||||
result = ''
|
||||
|
||||
|
||||
else:
|
||||
# This line is a comment
|
||||
pass
|
||||
|
||||
if command:
|
||||
# Cheking if the last command was sent
|
||||
yield (command, result, command_line)
|
||||
|
||||
fd.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
r = RunTest()
|
||||
r.run_tests()
|
|
@ -0,0 +1,56 @@
|
|||
## Definicion general
|
||||
set -a
|
||||
OGENGINECONFIGURATE="TRUE"
|
||||
OGLOGSESSION="/tmp/session.log"
|
||||
OGLOGCOMMAND="/tmp/command.log"
|
||||
|
||||
##Configuracion de la PostConfiguracion OS WIndows
|
||||
#Hacer chkdisk tras la clonacion
|
||||
OGWINCHKDISK=TRUE
|
||||
|
||||
#Configuracion de interface restauracion
|
||||
#Que hacer cuando la cache no tenga espacio libre. [ NONE | FORMAT ] ]
|
||||
ACTIONCACHEFULL=NONE
|
||||
#Que protocolo de restauracion usar en el caso de que no exista cache o no exista espacio sufiente. [NONE | UNICAST | MULTICAST].NONE retorna error
|
||||
RESTOREPROTOCOLNOTCACHE=NONE
|
||||
|
||||
#script Creacion imagen
|
||||
IMGPROG="partclone"
|
||||
IMGCOMP="lzop"
|
||||
IMGEXT="img"
|
||||
IMGREDUCE="TRUE"
|
||||
|
||||
#Configuracion del asistente de Clonacion remota usando master
|
||||
#Al enviar particion reducir el sistema de archivos previamente.
|
||||
OGWINREDUCE=TRUE
|
||||
|
||||
# Sesion MULTICAST de cliente
|
||||
#timeout (segundos) para abortar la sesion de multicast si no contacta con el servidor de multicast. Valor asignado a 0, utiliza los valores por defecto de udp-cast
|
||||
MCASTERRORSESSION=120
|
||||
# timeout (segundos) para abortar la la transferencia si se interrumpe. Valor asignado a 0, utiliza los valores por defecto de udp-cast
|
||||
MCASTWAIT=30
|
||||
|
||||
# Imagenes sincronizadas
|
||||
# Factor para calcular el time-out al crear la imagen. 100000k -> 4s
|
||||
CREATESPEED=100000*4
|
||||
# Factor de compresion para las imagenes (windos en ext4).
|
||||
FACTORSYNC=120
|
||||
# Realizar copia de seguridad antes de crear la imagen.
|
||||
BACKUP=false
|
||||
# Sistema de archivo de la imagenes sincronizadas. EXT4 o BTRFS
|
||||
IMGFS=EXT4
|
||||
|
||||
# Tiempo de sleep antes de realizar el reboot
|
||||
OGSLEEP="20"
|
||||
|
||||
# La variable INSTALLOSCLIENT no se utiliza en OpenGnsys 1.1.0.
|
||||
|
||||
# Funciones que no deben mostrar salida de avisos si son llamadas por otras funciones.
|
||||
NODEBUGFUNCTIONS="ogCreateImageSyntax ogGetHivePath ogGetOsType ogRestoreImageSyntax ogUnmountAll ogUnmountCache"
|
||||
|
||||
# Velocidad de comunicación por defecto (muestra aviso en Browser si no se cumple):
|
||||
# "", no usar esta característica.
|
||||
# "100Mb/s", Fast Ethernet.
|
||||
# "1000Mb/s", Gigabit Ethernet.
|
||||
DEFAULTSPEED=""
|
||||
|
|
@ -0,0 +1,804 @@
|
|||
{
|
||||
"variables": [
|
||||
{
|
||||
"description": "applying engine configuration (boolean)",
|
||||
"name": "OGENGINECONFIGURATE",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"description": "session log file (path)",
|
||||
"name": "OGLOGSESSION",
|
||||
"value": "/tmp/session.log"
|
||||
},
|
||||
{
|
||||
"description": "command log file (path)",
|
||||
"name": "OGLOGCOMMAND",
|
||||
"value": "/tmp/command.log"
|
||||
},
|
||||
{
|
||||
"description": "image clonation program (string)",
|
||||
"name": "IMGPROG",
|
||||
"value": "partclone"
|
||||
},
|
||||
{
|
||||
"description": "image compresson (string)",
|
||||
"name": "IMGCOMP",
|
||||
"value": "lzop"
|
||||
},
|
||||
{
|
||||
"description": "filesystem image extension (string)",
|
||||
"name": "IMGEXT",
|
||||
"value": "img"
|
||||
},
|
||||
{
|
||||
"description": "disk image extension (string)",
|
||||
"name": "DISKIMGEXT",
|
||||
"value": "dsk"
|
||||
},
|
||||
{
|
||||
"description": "trying to reduce image (boolean)",
|
||||
"name": "IMGREDUCE",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"description": "trying to reduce Windows filesystem before creating image (boolean)",
|
||||
"name": "OGWINREDUCE",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"description": "time to sleep before reboot (seconds)",
|
||||
"name": "OGSLEEP",
|
||||
"value": 20
|
||||
},
|
||||
{
|
||||
"description": "do not show warnings in this functions (list of functions)",
|
||||
"name": "NODEBUGFUNCTIONS",
|
||||
"value": "ogCreateImageSyntax ogGetHivePath ogGetOsType ogRestoreImageSyntax ogUnmountAll ogUnmountCache"
|
||||
},
|
||||
{
|
||||
"description": "action to take if cache is full (NONE; FORMAT)",
|
||||
"name": "ACTIONCACHEFULL",
|
||||
"value": "NONE"
|
||||
},
|
||||
{
|
||||
"description": "restoration protocol if cache is full or it does not exists (NONE, returns error; UNICAST; MULTICAST)",
|
||||
"name": "RESTOREPROTOCOLNOTCACHE",
|
||||
"value": "UNICAST"
|
||||
},
|
||||
{
|
||||
"description": "timout if Multicast transfer does not begins (seconds)",
|
||||
"name": "MCASTERRORSESSION",
|
||||
"value": 120
|
||||
},
|
||||
{
|
||||
"description": "timout if Multicast transfer does it's interrupted (seconds)",
|
||||
"name": "MCASTWAIT",
|
||||
"value": 30
|
||||
},
|
||||
{
|
||||
"description": "run CHKDSK after Windows depolying (boolean)",
|
||||
"name": "OGWINCHKDISK",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"description": "timeout factor creating synchronized image (integer, 100000k => 4s)",
|
||||
"name": "CREATESPEED",
|
||||
"value": 400000
|
||||
},
|
||||
{
|
||||
"description": "compression factor creating synchronized image (integer)",
|
||||
"name": "FACTORSYNC",
|
||||
"value": 120
|
||||
},
|
||||
{
|
||||
"description": "make backup before creating synchronized image (boolean)",
|
||||
"name": "BACKUP",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"description": "filesystem type creating synchronized image (string)",
|
||||
"name": "IMGFS",
|
||||
"value": "EXT4"
|
||||
},
|
||||
{
|
||||
"description": "default communication speed (blank, do not use; 100Mb/s; 1000Mb/s)",
|
||||
"name": "DEFAULTSPEED",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
{
|
||||
"id": 1,
|
||||
"description": "format error",
|
||||
"name": "OG_ERR_FORMAT"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"description": "resource not found",
|
||||
"name": "OG_ERR_NOTFOUND"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"description": "partition error",
|
||||
"name": "OG_ERR_PARTITION"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"description": "resource locked",
|
||||
"name": "OG_ERR_LOCKED"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"description": "image error",
|
||||
"name": "OG_ERR_IMAGE"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"description": "operating system not detected",
|
||||
"name": "OG_ERR_NOTOS"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"description": "program or function not executable",
|
||||
"name": "OG_ERR_NOTEXEC"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"description": "cannot write",
|
||||
"name": "OG_ERR_NOTWRITE"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"description": "cache filesystem does not exists",
|
||||
"name": "OG_ERR_NOTCACHE"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"description": "cache filesystem is full",
|
||||
"name": "OG_ERR_CACHESIZE"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"description": "error reducing filesystem",
|
||||
"name": "OG_ERR_REDUCEFS"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"description": "error extending filesystem",
|
||||
"name": "OG_ERR_EXTENDFS"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"description": "value out of limit",
|
||||
"name": "OG_ERR_OUTOFLIMIT"
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"description": "filesystem error",
|
||||
"name": "OG_ERR_FILESYS"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"description": "cache error",
|
||||
"name": "OG_ERR_CACHE"
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"description": "no GPT partition table",
|
||||
"name": "OG_ERR_NOGPT"
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"description": "cannot mount repository",
|
||||
"name": "OG_ERR_REPO"
|
||||
},
|
||||
{
|
||||
"id": 30,
|
||||
"description": "trying to restore an image into an smaller partition",
|
||||
"name": "OG_ERR_IMGSIZEPARTITION"
|
||||
},
|
||||
{
|
||||
"id": 31,
|
||||
"description": "error updating cache",
|
||||
"name": "OG_ERR_UPDATECACHE"
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"description": "formatting error",
|
||||
"name": "OG_ERR_DONTFORMAT"
|
||||
},
|
||||
{
|
||||
"id": 40,
|
||||
"description": "unknown error",
|
||||
"name": "OG_ERR_GENERIC"
|
||||
},
|
||||
{
|
||||
"id": 50,
|
||||
"description": "error preparing Unicast syntax",
|
||||
"name": "OG_ERR_UCASTSYNTAXT"
|
||||
},
|
||||
{
|
||||
"id": 51,
|
||||
"description": "error sending partition using Unicast protocol",
|
||||
"name": "OG_ERR_UCASTSENDPARTITION"
|
||||
},
|
||||
{
|
||||
"id": 52,
|
||||
"description": "error sending file using Unicast protocol",
|
||||
"name": "OG_ERR_UCASTSENDFILE"
|
||||
},
|
||||
{
|
||||
"id": 52,
|
||||
"description": "error receiving partition using Unicast protocol",
|
||||
"name": "OG_ERR_UCASTRECEIVERPARTITION"
|
||||
},
|
||||
{
|
||||
"id": 53,
|
||||
"description": "error receiving file using Unicast protocol",
|
||||
"name": "OG_ERR_UCASTRECEIVERFILE"
|
||||
},
|
||||
{
|
||||
"id": 55,
|
||||
"description": "error preparing Multicast syntax",
|
||||
"name": "OG_ERR_MCASTSYNTAXT"
|
||||
},
|
||||
{
|
||||
"id": 56,
|
||||
"description": "error sending file using Multicast protocol",
|
||||
"name": "OG_ERR_MCASTSENDFILE"
|
||||
},
|
||||
{
|
||||
"id": 57,
|
||||
"description": "error receiving file using Multicast protocol",
|
||||
"name": "OG_ERR_MCASTRECEIVERFILE"
|
||||
},
|
||||
{
|
||||
"id": 58,
|
||||
"description": "error sending partition using Multicast protocol",
|
||||
"name": "OG_ERR_MCASTSENDPARTITION"
|
||||
},
|
||||
{
|
||||
"id": 59,
|
||||
"description": "error receiving partition using Multicast protocol",
|
||||
"name": "OG_ERR_MCASTRECEIVERPARTITION"
|
||||
},
|
||||
{
|
||||
"id": 60,
|
||||
"description": "error connecting master node",
|
||||
"name": "OG_ERR_PROTOCOLJOINMASTER"
|
||||
},
|
||||
{
|
||||
"id": 70,
|
||||
"description": "cannot mount a syncrhronized image",
|
||||
"name": "OG_ERR_DONTMOUNT_IMAGE"
|
||||
},
|
||||
{
|
||||
"id": 71,
|
||||
"description": "it's not a syncrhronized image",
|
||||
"name": "OG_ERR_DONTSYNC_IMAGE"
|
||||
},
|
||||
{
|
||||
"id": 72,
|
||||
"description": "cannot unmount a syncrhronized image",
|
||||
"name": "OG_ERR_DONTUNMOUNT_IMAGE"
|
||||
},
|
||||
{
|
||||
"id": 73,
|
||||
"description": "there are no differences between basic image and filesystem",
|
||||
"name": "OG_ERR_NOTDIFFERENT"
|
||||
},
|
||||
{
|
||||
"id": 74,
|
||||
"description": "synchronization error",
|
||||
"name": "OG_ERR_SYNCHRONIZING"
|
||||
}
|
||||
],
|
||||
"disks": [
|
||||
{
|
||||
"type": "DISK"
|
||||
},
|
||||
{
|
||||
"type": "USB"
|
||||
},
|
||||
{
|
||||
"type": "CDROM"
|
||||
},
|
||||
{
|
||||
"type": "RAID"
|
||||
},
|
||||
{
|
||||
"type": "MAPPER"
|
||||
}
|
||||
],
|
||||
"partitiontables": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "MSDOS",
|
||||
"partitions": [
|
||||
{
|
||||
"id": "0",
|
||||
"type": "EMPTY",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"type": "FAT12",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"type": "EXTENDED",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"type": "FAT16",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "7",
|
||||
"type": "NTFS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "b",
|
||||
"type": "FAT32",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "11",
|
||||
"type": "HFAT12",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "16",
|
||||
"type": "HFAT16",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "17",
|
||||
"type": "HNTFS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "1b",
|
||||
"type": "HFAT32",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "27",
|
||||
"type": "HNTFS-WINRE",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "82",
|
||||
"type": "LINUX-SWAP",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "83",
|
||||
"type": "LINUX",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "8e",
|
||||
"type": "LINUX-LVM",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a5",
|
||||
"type": "FREEBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a6",
|
||||
"type": "OPENBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a9",
|
||||
"type": "NETBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "af",
|
||||
"type": "HFS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "be",
|
||||
"type": "SOLARIS-BOOT",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "bf",
|
||||
"type": "SOLARIS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "ca",
|
||||
"type": "CACHE",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "da",
|
||||
"type": "DATA",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "ee",
|
||||
"type": "GPT",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "ef",
|
||||
"type": "EFI",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "fb",
|
||||
"type": "VMFS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "fd",
|
||||
"type": "LINUX-RAID",
|
||||
"clonable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "GPT",
|
||||
"partitions": [
|
||||
{
|
||||
"id": "700",
|
||||
"type": "WINDOWS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "c01",
|
||||
"type": "WIN-RESERV",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "2700",
|
||||
"type": "WIN-RECOV",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "7f00",
|
||||
"type": "CHROMEOS-KRN",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "7f01",
|
||||
"type": "CHROMEOS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "7f02",
|
||||
"type": "CHROMEOS-RESERV",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "8200",
|
||||
"type": "LINUX-SWAP",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "8300",
|
||||
"type": "LINUX",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "8301",
|
||||
"type": "LINUX-RESERV",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "8302",
|
||||
"type": "LINUX",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "8e00",
|
||||
"type": "LINUX-LVM",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a500",
|
||||
"type": "FREEBSD-DISK",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "a501",
|
||||
"type": "FREEBSD-BOOT",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a502",
|
||||
"type": "FREEBSD-SWAP",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "a503",
|
||||
"type": "FREEBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a504",
|
||||
"type": "FREEBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a901",
|
||||
"type": "NETBSD-SWAP",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "a902",
|
||||
"type": "NETBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a903",
|
||||
"type": "NETBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a904",
|
||||
"type": "NETBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a905",
|
||||
"type": "NETBSD",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "a906",
|
||||
"type": "NETBSD-RAID",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "ab00",
|
||||
"type": "HFS-BOOT",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "af00",
|
||||
"type": "HFS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "af01",
|
||||
"type": "HFS-RAID",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "af02",
|
||||
"type": "HFS-RAID",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "be00",
|
||||
"type": "SOLARIS-BOOT",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "bf00",
|
||||
"type": "SOLARIS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "bf01",
|
||||
"type": "SOLARIS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "bf02",
|
||||
"type": "SOLARIS-SWAP",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "bf03",
|
||||
"type": "SOLARIS-DISK",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "bf04",
|
||||
"type": "SOLARIS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "bf05",
|
||||
"type": "SOLARIS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "ca00",
|
||||
"type": "CACHE",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "ef00",
|
||||
"type": "EFI",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "ef01",
|
||||
"type": "MBR",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "ef02",
|
||||
"type": "BIOS-BOOT",
|
||||
"clonable": false
|
||||
},
|
||||
{
|
||||
"id": "fb00",
|
||||
"type": "VMFS",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "fb01",
|
||||
"type": "VMFS-RESERV",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "fb02",
|
||||
"type": "VMFS-KRN",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "fd00",
|
||||
"type": "LINUX-RAID",
|
||||
"clonable": true
|
||||
},
|
||||
{
|
||||
"id": "ffff",
|
||||
"type": "UNKNOWN",
|
||||
"clonable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "LVM",
|
||||
"partitions": [
|
||||
{
|
||||
"id": "10000",
|
||||
"type": "LVM-LV",
|
||||
"clonable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "ZPOOL",
|
||||
"partitions": [
|
||||
{
|
||||
"id": "10010",
|
||||
"type": "ZFS-VOL",
|
||||
"clonable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"filesystems": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "EMPTY"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "CACHE"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "BTRFS"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "EXT2"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "EXT3"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "EXT4"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": "FAT12"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "FAT16"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": "FAT32"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": "HFS"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"type": "HFSPLUS"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": "JFS"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"type": "NTFS"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": "REISERFS"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"type": "REISER4"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"type": "UFS"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"type": "XFS"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"type": "LINUX-SWAP"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"type": "EXFAT"
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"type": "F2FS"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"type": "NILFS2"
|
||||
}
|
||||
],
|
||||
"operatingsystems": [
|
||||
{
|
||||
"type": "Android"
|
||||
},
|
||||
{
|
||||
"type": "BSD"
|
||||
},
|
||||
{
|
||||
"type": "GrubLoader"
|
||||
},
|
||||
{
|
||||
"type": "Hurd"
|
||||
},
|
||||
{
|
||||
"type": "Linux"
|
||||
},
|
||||
{
|
||||
"type": "MacOS"
|
||||
},
|
||||
{
|
||||
"type": "Solaris"
|
||||
},
|
||||
{
|
||||
"type": "Windows"
|
||||
},
|
||||
{
|
||||
"type": "WinLoader"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
# Proceso general de arranque de OpenGnsys Client.
|
||||
|
||||
|
||||
# Fichero de registro de incidencias (en el servidor; si no, en local).
|
||||
OPENGNSYS=${OPENGNSYS:-/opt/opengnsys}
|
||||
OGLOGFILE=${OGLOGFILE:-$OPENGNSYS/log/$(ogGetIpAdderss).log}
|
||||
if ! touch $OGLOGFILE 2>/dev/null; then
|
||||
OGLOGFILE=/var/log/opengnsys.log
|
||||
fi
|
||||
LOGLEVEL=5
|
||||
|
||||
# Matando plymount para inicir browser o shell
|
||||
pkill -9 plymouthd
|
||||
|
||||
# Arranque de OpenGnsys Client daemon (socket).
|
||||
echo "${MSG_LAUNCHCLIENT:-.}"
|
||||
# Indicar fichero de teclado de Qt para el idioma especificado (tipo "es.qmap").
|
||||
[ -f /usr/local/etc/${LANG%_*}.qmap ] && export QWS_KEYBOARD="TTY:keymap=/usr/local/etc/${LANG%_*}.qmap"
|
||||
|
||||
if [ -x "$OPENGNSYS/bin/ogAdmClient" -a "$ogstatus" != "offline" ]; then
|
||||
# Ejecutar servicio cliente.
|
||||
$OPENGNSYS/bin/ogAdmClient -f $OPENGNSYS/etc/ogAdmClient.cfg -l $OGLOGFILE -d $LOGLEVEL
|
||||
else
|
||||
for FILE in index $OGGROUP $(ogGetIpAddress)
|
||||
do
|
||||
[ -f $OGCAC/menus/$FILE.html ] && OGMENU="$OGCAC/menus/$FILE.html"
|
||||
done
|
||||
$OPENGNSYS/bin/browser -qws $OGMENU
|
||||
fi
|
||||
|
||||
# Si fallo en cliente y modo "admin", cargar shell; si no, salir.
|
||||
if [ "$ogactiveadmin" == "true" ]; then
|
||||
bash
|
||||
fi
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
lang.ca_ES.conf
|
|
@ -0,0 +1,398 @@
|
|||
# Fichero de idioma: catalá.
|
||||
#@version 1.1.1
|
||||
#@author
|
||||
|
||||
|
||||
# Mensajes de error.
|
||||
MSG_ERR_GENERIC="Error imprevisto no definido"
|
||||
MSG_ERR_FORMAT="Formato de ejecución incorrecto"
|
||||
MSG_ERR_OUTOFLIMIT="Valor fuera de rango o no válido"
|
||||
MSG_ERR_NOTFOUND="Fichero o dispositivo no encontrado"
|
||||
MSG_ERR_PARTITION="Partición errónea o desconocida"
|
||||
MSG_ERR_LOCKED="Recurso bloqueado por operación de uso exclusivo"
|
||||
MSG_ERR_CACHE="Error en partición de caché local"
|
||||
MSG_ERR_NOGPT="El disco indicado no contiene una particion GPT"
|
||||
MSG_ERR_REPO="Error al montar el repositorio de imágenes"
|
||||
MSG_ERR_NOMSDOS="El disco indicado no contiene una partición MSDOS"
|
||||
MSG_ERR_FILESYS="Sistema de archivos desconocido o no se puede montar"
|
||||
MSG_ERR_NOTOS="Sistema operativo no detectado o no se puede iniciar"
|
||||
MSG_ERR_IMAGE="No se puede crear o restaurar una image de sistema"
|
||||
MSG_ERR_IMAGEFILE="Archivo de imagen corrupto o de otra versión de partclone"
|
||||
MSG_ERR_NOTEXEC="Programa o función no ejecutable"
|
||||
MSG_ERR_NOTWRITE="No hay acceso de escritura"
|
||||
MSG_ERR_NOTCACHE="No existe particion Cache en el cliente"
|
||||
MSG_ERR_NOTUEFI="La interfaz UEFI no está activa"
|
||||
MSG_ERR_NOTBIOS="La interfaz BIOS Legacy no está activa"
|
||||
MSG_ERR_CACHESIZE="El espacio de la cache local o remota no es suficiente"
|
||||
MSG_ERR_REDUCEFS="Error al reducir el sistema de archivos"
|
||||
MSG_ERR_EXTENDFS="Error al expandir el sistema de archivos"
|
||||
MSG_ERR_IMGSIZEPARTITION="Error al restaurar: Particion mas pequeña que la imagen"
|
||||
MSG_ERR_UPDATECACHE="Error al realizar el comando updateCache"
|
||||
MSG_ERR_UCASTSYNTAXT="Error en la generación de sintaxis de transferenica unicast"
|
||||
MSG_ERR_UCASTSENDPARTITION="Error en envio UNICAST de una particion"
|
||||
MSG_ERR_UCASTSENDFILE="Error en envio UNICAST de un fichero"
|
||||
MSG_ERR_UCASTRECEIVERPARTITION="Error en la recepcion UNICAST de una particion"
|
||||
MSG_ERR_UCASTRECEIVERFILE="Error en la recepcion UNICAST de un fichero"
|
||||
MSG_ERR_MCASTSYNTAXT="Error en la generación de sintaxis de transferenica multicast"
|
||||
MSG_ERR_MCASTSENDFILE="Error en envio MULTICAST de un fichero"
|
||||
MSG_ERR_MCASTRECEIVERFILE="Error en la recepcion MULTICAST de un fichero"
|
||||
MSG_ERR_MCASTSENDPARTITION="Error en envio MULTICAST de una particion"
|
||||
MSG_ERR_MCASTRECEIVERPARTITION="Error en la recepcion MULTICAST de un fichero"
|
||||
MSG_ERR_PROTOCOLJOINMASTER="Error en la conexion de una sesion UNICAST|MULTICAST con el MASTER"
|
||||
MSG_ERR_DONTFORMAT="Error al formatear"
|
||||
MSG_ERR_DONTMOUNT_IMAGE="Error al montar/reducir la imagen"
|
||||
MSG_ERR_DONTUNMOUNT_IMAGE="Error al desmontar la imagen"
|
||||
MSG_ERR_DONTSYNC_IMAGE="Imagen no sincronizable"
|
||||
MSG_ERR_NOTDIFFERENT="No se detectan diferencias entre la imagen basica y la particion."
|
||||
MSG_ERR_SYNCHRONIZING="Error al sincronizar, puede afectar la creacion|restauracion de la imagen"
|
||||
|
||||
# Mensajes de avisos.
|
||||
MSG_DONTUSE="NO USAR"
|
||||
MSG_DONTMOUNT="Sistema de archivos no montado"
|
||||
MSG_DONTUNMOUNT="El sistema de archivos no se puede desmontar o no está montado"
|
||||
MSG_MOUNT="Sistema de archivos montado"
|
||||
MSG_MOUNTREADONLY="Sistema de archivos montado solo de lectura"
|
||||
MSG_OBSOLETE="EN DESUSO"
|
||||
|
||||
# Mensajes complementarios para las ayudas.
|
||||
MSG_64BIT="64 bits"
|
||||
MSG_DISK="disc"
|
||||
MSG_ERROR="Error"
|
||||
MSG_EXAMPLE="Exemple"
|
||||
MSG_FORMAT="Format"
|
||||
MSG_FUNCTION="Funció"
|
||||
MSG_HARDWAREINVENTORY="Inventario de maquinari de la màquina"
|
||||
MSG_IMAGE="imatge"
|
||||
MSG_INSTALLED="instal-lat"
|
||||
MSG_NOCACHE="sense caché local"
|
||||
MSG_NOEXTENDED="sense partició estensa"
|
||||
MSG_PARTITION="partició"
|
||||
MSG_PROTOCOL="protocol"
|
||||
MSG_RESERVEDVALUE="Valor reservat"
|
||||
MSG_SEE="Veure"
|
||||
MSG_UNKNOWN="Desconegut"
|
||||
MSG_WARNING="Avís"
|
||||
|
||||
# Mensajes del proceso de arranque.
|
||||
MSG_DETECTLVMRAID="Detectar metadispositivos LVM y RAID."
|
||||
MSG_ERRBOOTMODE="$MSG_ERROR: Modo de arranque desconocido."
|
||||
MSG_LAUNCHCLIENT="Ejecutar cliente."
|
||||
MSG_LOADAPI="Cargar funciones del motor de clonación."
|
||||
MSG_LOADMODULES="Cargar módulos del kernel."
|
||||
MSG_MAKELINKS="Crear enlaces simbólicos."
|
||||
MSG_MOUNTREPO="Montar repositorio por %s en modo %s."
|
||||
MSG_OFFLINEMODE="Modo de arranque sin conexión."
|
||||
MSG_OTHERSERVICES="Iniciar servicios complementarios del cliente."
|
||||
MSG_POWEROFFCONF="Definir parámetros de ahorro de energía."
|
||||
|
||||
# Mensajes del menú por defecto.
|
||||
MSG_BOOT="Iniciar"
|
||||
MSG_DUPLEX="Dúplex"
|
||||
MSG_HOSTNAME="Equipo"
|
||||
MSG_IPADDR="Dirección IP"
|
||||
MSG_MACADDR="Dirección MAC"
|
||||
MSG_MENUTITLE="Menú de opciones"
|
||||
MSG_POWEROFF="Apagar el equipo"
|
||||
MSG_SPEED="Velocidad"
|
||||
|
||||
# Mensajes de descripción breve de las funciones de la API.
|
||||
MSG_HELP_ogAclFilter="Extrae las acl de los ficheros de la diferencial"
|
||||
MSG_HELP_ogAddCmd="Añade comandos al fichero creado por la función ogInstalMiniSetup."
|
||||
MSG_HELP_ogAddRegistryKey="Añade una nueva clave al registro de Windows."
|
||||
MSG_HELP_ogAddRegistryValue="Añade un nuevo valor al registro de Windows."
|
||||
MSG_HELP_ogAddToLaunchDaemon=""
|
||||
MSG_HELP_ogBoot="Arranca un sistema operativo instalado."
|
||||
MSG_HELP_ogBootLoaderDeleteEntry="$MSG_DONTUSE."
|
||||
MSG_HELP_ogBootLoaderHidePartitions="$MSG_DONTUSE."
|
||||
MSG_HELP_ogBootMbrGeneric=""
|
||||
MSG_HELP_ogBootMbrXP=""
|
||||
MSG_HELP_ogBurgDefaultEntry="Configura la entrada por defecto de Burg."
|
||||
MSG_HELP_ogBurgDeleteEntry="Borra en el Burg del MBR las entradas para el inicio en una particion."
|
||||
MSG_HELP_ogBurgHidePartitions="Configura el Burg del MBR para que oculte las particiones de windows que no se esten iniciando. Permite definir una partición que no se ocultará (ej: para datos)."
|
||||
MSG_HELP_ogBurgInstallMbr="Instal·la el carregador d'arrencada BURG al MBR del primer disc dur"
|
||||
MSG_HELP_ogBurgOgliveDefaultEntry="Configura la entrada de ogLive como la entrada por defecto de Burg."
|
||||
MSG_HELP_ogCalculateChecksum="Calcula la suma de comprobación (checksum) de un fichero."
|
||||
MSG_HELP_ogCalculateFullChecksum=""
|
||||
MSG_HELP_ogChangeRepo="Cambia el repositorio para el recurso remoto images."
|
||||
MSG_HELP_ogCheckFs="Comprueba la consistencia de un sistema de archivos."
|
||||
MSG_HELP_ogCheckIpAddress=""
|
||||
MSG_HELP_ogCheckProgram=""
|
||||
MSG_HELP_ogCheckStringInGroup=""
|
||||
MSG_HELP_ogCheckStringInReg=""
|
||||
MSG_HELP_ogCheckSyncImage="Muestra el contenido de la imagen para comprobarla."
|
||||
MSG_HELP_ogCleanLinuxDevices=""
|
||||
MSG_HELP_ogCleanOs="Elimina los archivos que no son necesarios en el sistema operativo."
|
||||
MSG_HELP_ogCompareChecksumFiles="Compara si coinciden las sumas de comprobación almacenadas de 2 ficheros."
|
||||
MSG_HELP_ogConfigureFstab=""
|
||||
MSG_HELP_ogConfigureOgagent="Configura el nuevo agente OGAgent para sistemas ooperativos."
|
||||
MSG_HELP_ogCopyFile="Copia un fichero a otro almacenamiento."
|
||||
MSG_HELP_ogCreateBootLoaderImage=""
|
||||
MSG_HELP_ogCreateCache="Reserva espacio para la partición de caché al final del disco."
|
||||
MSG_HELP_ogCreateDiskImage="Genera una imagen exacta de un disco completo."
|
||||
MSG_HELP_ogCreateFileImage="Crea/Redimensiona el archivo de la imagen sincronizada"
|
||||
MSG_HELP_ogCreateGptPartitions=""
|
||||
MSG_HELP_ogCreateImage="Genera una imagen exacta de un sistema operativo instalado localmente."
|
||||
MSG_HELP_ogCreateImageSyntax=""
|
||||
MSG_HELP_ogCreateInfoImage="Crea informacion del contenido de la imagen"
|
||||
MSG_HELP_ogCreateMbrImage="Genera una imagen del sector de arranque (MBR)."
|
||||
MSG_HELP_ogCreatePartitions="Define la estructura de particiones de un disco."
|
||||
MSG_HELP_ogCreatePartitionTable="Genera una tabla de particiones en caso de que no sea valida."
|
||||
MSG_HELP_ogCreateTorrent=""
|
||||
MSG_HELP_ogCopyEfiBootLoader="Copia el cargador de arranque desde la partición EFI a la de sistema."
|
||||
MSG_HELP_ogDeleteCache="Elimina la partición de caché local."
|
||||
MSG_HELP_ogDeleteFile="Borra un fichero de un espacio de almacenamiento."
|
||||
MSG_HELP_ogDeletePartitionTable="Elimina la tabla de particiones del disco"
|
||||
MSG_HELP_ogDeleteRegistryKey="Borra una clave vacía del registro de Windows."
|
||||
MSG_HELP_ogDeleteRegistryValue="Borra un valor del registro de Windows."
|
||||
MSG_HELP_ogDeleteTree="Borra un árbol de directorios de un espacio de almacenamiento."
|
||||
MSG_HELP_ogDevToDisk="Devuelve el nº de orden de disco o de partición correspondiente al camino del fichero de dispositivo."
|
||||
MSG_HELP_ogDiskToDev="Devuelve el camino del fichero de dispositivo correspondiente al nº de orden de disco o de partición."
|
||||
MSG_HELP_ogDomainScript=""
|
||||
MSG_HELP_ogEcho=""
|
||||
MSG_HELP_ogExecAndLog=""
|
||||
MSG_HELP_ogExtendFs="Extiende el tamaño de un sistema de archivo al máximo de su partición."
|
||||
MSG_HELP_ogFindCache="Indica la partición reservada para caché local."
|
||||
MSG_HELP_ogFixBootSector=""
|
||||
MSG_HELP_ogFormatCache="Formatea (inicia) el sistema de caché local."
|
||||
MSG_HELP_ogFormat="Formatea o reformatea un sistema de archivos."
|
||||
MSG_HELP_ogFormatFs=$MSG_HELP_ogFormat
|
||||
MSG_HELP_ogGetArch="Devuelve el tipo de arquitectura del cliente."
|
||||
MSG_HELP_ogGetCacheSize="Devuelve el tamaño de la partición de caché local."
|
||||
MSG_HELP_ogGetCacheSpace="Devuelve el espacio máximo disponible que puede ser reservado para la partición de caché local."
|
||||
MSG_HELP_ogGetCaller=""
|
||||
MSG_HELP_ogGetDiskSize="Devuelve el tamaño del disco."
|
||||
MSG_HELP_ogGetDiskType="Devuelve el mnemónico de tipo de disco."
|
||||
MSG_HELP_ogGetFreeSize=""
|
||||
MSG_HELP_ogGetFsSize="Devuelve el tamaño de un sistema de archivos."
|
||||
MSG_HELP_ogGetFsType="Devuelve el mnemónico de tipo de sistema de archivos."
|
||||
MSG_HELP_ogGetGroupDir="Devuelve el camino del directorio por defecto para el grupo del cliente."
|
||||
MSG_HELP_ogGetGroupName="Devuelve el nombre del grupo al que pertenece el cliente."
|
||||
MSG_HELP_ogGetHivePath="Devuelve el camino completo del fichero de una sección del registro de Windows."
|
||||
MSG_HELP_ogGetHostname="Devuelve el nombre de la máquina local."
|
||||
MSG_HELP_ogGetImageCompressor="Devuelve la herramienta de compresión de la imagen."
|
||||
MSG_HELP_ogGetImageInfo="Muestra información sobre la imagen monolitica: clonacion:compresor:sistemaarchivos:tamañoKB."
|
||||
MSG_HELP_ogGetImageProgram="Devuelve el programa usado para crear la imagen."
|
||||
MSG_HELP_ogGetImageSize="Devuelve el tamaño de una imagen de sistema."
|
||||
MSG_HELP_ogGetImageType="Devuelve el sistema de ficheros de la imagen."
|
||||
MSG_HELP_ogGetIpAddress="Devuelve la dirección IP del cliente."
|
||||
MSG_HELP_ogGetLastSector="Devuelve el último sector usable del disco o de una partición."
|
||||
MSG_HELP_ogGetMacAddress="Devuelve la dirección Ethernet del cliente."
|
||||
MSG_HELP_ogGetMountImageDir="Devuelve el directorio de montaje de una imagen."
|
||||
MSG_HELP_ogGetMountPoint="Devuelve el directorio donde está montado un sistema de archivos local."
|
||||
MSG_HELP_ogGetNetInterface=""
|
||||
MSG_HELP_ogGetOsType="Devuelve el tipo de un sistema operativo instalado."
|
||||
MSG_HELP_ogGetOsUuid=""
|
||||
MSG_HELP_ogGetOsVersion="Devuelve el tipo y la versión de un sistema operativo instalado."
|
||||
MSG_HELP_ogGetParentPath="Devuelve el camino completo del directorio padre de un fichero de sistema OpenGnsys."
|
||||
MSG_HELP_ogGetPartitionActive="Indica cual es la partición marcada como activa en un disco."
|
||||
MSG_HELP_ogGetPartitionId="Devuelve el identificador de tipo de una partición."
|
||||
MSG_HELP_ogGetPartitionSize="Devuelve el tamaño de una partición."
|
||||
MSG_HELP_ogGetPartitionsNumber=""
|
||||
MSG_HELP_ogGetPartitionTableType="Devuelve el tipo de tabla de particiones del disco"
|
||||
MSG_HELP_ogGetPartitionType="Devuelve el mnemónico de tipo de una partición."
|
||||
MSG_HELP_ogGetPath="Devuelve el camino completo de un fichero de sistema OpenGnsys."
|
||||
MSG_HELP_ogGetRegistryValue="Devuelve el dato de un valor del registro de Windows."
|
||||
MSG_HELP_ogGetRepoIp="Devuelve la dirección IP del repositorio de datos."
|
||||
MSG_HELP_ogGetSerialNumber="Devuelve el número de serie del cliente."
|
||||
MSG_HELP_ogGetServerIp="Devuelve la dirección IP del servidor principal."
|
||||
MSG_HELP_ogGetSizeParameters="Devuelve el tamaño de los datos de un sistema de ficheros, el espacio necesario para la imagen y si cabe en el repositorio elegido."
|
||||
MSG_HELP_ogGetWindowsName="Devuelve el nombre del cliente guardado en el registro de Windows."
|
||||
MSG_HELP_ogGrubAddOgLive="Incluye en el grub del MBR una entrada llamando al cliente de opengnsys."
|
||||
MSG_HELP_ogGrubDefaultEntry="Configura la entrada por defecto de GRUB."
|
||||
MSG_HELP_ogGrubDeleteEntry="Borra en el grub del MBR las entradas para el inicio en una particion."
|
||||
MSG_HELP_ogGrubHidePartitions="Configura el grub del MBR para que oculte las particiones de windows que no se esten iniciando. Permite definir una partición que no se ocultará (ej: para datos)."
|
||||
MSG_HELP_ogGrubInstallMbr="Instal·la el carregador d'arrencada GRUB al MBR del primer disc dur"
|
||||
MSG_HELP_ogGrubInstallPartition="Instal·la el carregador d'arrencada BURG al BootSector"
|
||||
MSG_HELP_ogGrubOgliveDefaultEntry="Configura la entrada de ogLive como la entrada por defecto de GRUB."
|
||||
MSG_HELP_ogGrubSecurity="Configura usuario y clave para modificar las entradas del menu del Grub."
|
||||
MSG_HELP_ogGrubUefiConf="Genera el fichero grub.cfg de la partición EFI."
|
||||
MSG_HELP_ogHelp="Muestra mensajes de ayudas para las funciones."
|
||||
MSG_HELP_ogHidePartition="Oculta una partición de Windows."
|
||||
MSG_HELP_ogIdToType="Devuelve el mnemónico asociado al identificador de tipo de partición."
|
||||
MSG_HELP_ogNvramActiveEntry="Configura a activa entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramAddEntry="Crea nueva entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramDeleteEntry="Borra entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramGetCurrent="Muestra la entrada del gestor de arranque (NVRAM) que ha iniciado el equipo."
|
||||
MSG_HELP_ogNvramGetNext="Muestra la entrada del gestor de arranque (NVRAM) que se utilizará en el próximo arranque."
|
||||
MSG_HELP_ogNvramGetOrder="Muestra el orden de las entradas del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramGetTimeout="Muestra el tiempo de espera del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramInactiveEntry="Configura a inactiva entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramList="Lista las entradas del gestor de arranque (NVRAN) marcando con un asterisco las activas"
|
||||
MSG_HELP_ogNvramSetNext="Configura el próximo arranque con la entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramSetOrder="Configura el orden de las entradas del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramSetTimeout="Configura el tiempo de espera del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogGetOsType="Devuelve el tipo de un sistema operativo instalado."
|
||||
MSG_HELP_ogInstallFirstBoot="Crea un archivo que se ejecutará en el primer arranque de Windows."
|
||||
MSG_HELP_ogInstallLaunchDaemon="Instala un archivo que se ejecutará en el arranque de macOS."
|
||||
MSG_HELP_ogInstallLinuxClient="$MSG_OBSOLETE."
|
||||
MSG_HELP_ogInstallMiniSetup="Instala un archivo que se ejecutará en el arranque de Windows."
|
||||
MSG_HELP_ogInstallRunonce="Crea un archivo que se ejecutará en el inicio de un usuario administrador de Windows."
|
||||
MSG_HELP_ogInstallWindowsClient="$MSG_OBSOLETE."
|
||||
MSG_HELP_ogIsFormated="Comprueba si un sistema de archivos está formateado."
|
||||
MSG_HELP_ogIsImageLocked="Comprueba si una imagen está bloqueada por una operación de uso exclusivo."
|
||||
MSG_HELP_ogIsLocked="Comprueba si una partición o su disco están bloqueados por una operación de uso exclusivo."
|
||||
MSG_HELP_ogIsDiskLocked="Comprueba si un disco está bloqueado por una operación de uso exclusivo."
|
||||
MSG_HELP_ogIsMounted="Comprueba si un sistema de archivos está montado."
|
||||
MSG_HELP_ogIsNewerFile="Comprueba si un fichero es más nuevo (se ha modificado después) que otro."
|
||||
MSG_HELP_ogIsPartitionLocked=$MSG_HELP_ogIsLocked
|
||||
MSG_HELP_ogIsRepoLocked=""
|
||||
MSG_HELP_ogIsSyncImage="Comprueba si la imagen es sincronizable."
|
||||
MSG_HELP_ogIsVirtualMachine=""
|
||||
MSG_HELP_ogIsWritable="Comprueba si un sistema de archivos está montado con permiso de escritura."
|
||||
MSG_HELP_ogLinuxBootParameters="Devuelve los parámetros de arranque de un sistema operativo Linux instalado."
|
||||
MSG_HELP_ogListHardwareInfo="Lista el inventario de dispositivos del cliente."
|
||||
MSG_HELP_ogListLogicalPartitions=""
|
||||
MSG_HELP_ogListPartitions="Lista la estructura de particiones de un disco."
|
||||
MSG_HELP_ogListPrimaryPartitions=""
|
||||
MSG_HELP_ogListRegistryKeys="Lista los nombres de las subclaves incluidas en una clave del registro de Windows."
|
||||
MSG_HELP_ogListRegistryValues="Lista los nombres de los valores incluidos en una clave del registro de Windows."
|
||||
MSG_HELP_ogListSoftware="Lista el inventario de programas instalados en un sistema operativo."
|
||||
MSG_HELP_ogLock="Bloquea una partición para operación de uso exclusivo."
|
||||
MSG_HELP_ogLockDisk="Bloquea un disco para operación de uso exclusivo."
|
||||
MSG_HELP_ogLockImage="Bloquea una imagen para operación de uso exclusivo."
|
||||
MSG_HELP_ogLockPartition=$MSG_HELP_ogLock
|
||||
MSG_HELP_ogMakeChecksumFile="Almacena la suma de comprobación de un fichero."
|
||||
MSG_HELP_ogMakeDir="Crea un directorio para OpenGnsys."
|
||||
MSG_HELP_ogMakeGroupDir="Crea el directorio de grupo (aula) en un repositorio."
|
||||
MSG_HELP_ogMcastReceiverFile=""
|
||||
MSG_HELP_ogMcastReceiverPartition=""
|
||||
MSG_HELP_ogMcastRequest=""
|
||||
MSG_HELP_ogMcastSendFile=""
|
||||
MSG_HELP_ogMcastSendPartition=""
|
||||
MSG_HELP_ogMcastSyntax=""
|
||||
MSG_HELP_ogMountCache="Monta el sistema de archivos dedicado a caché local."
|
||||
MSG_HELP_ogMountCdrom="Monta dispositivo óptico por defecto."
|
||||
MSG_HELP_ogMountFs=$MSG_HELP_ogMount
|
||||
MSG_HELP_ogMountImage="Monta una imagen sincronizable"
|
||||
MSG_HELP_ogMount="Monta un sistema de archivos y devuelve el punto de montaje."
|
||||
MSG_HELP_ogNvramActiveEntry="Configura a activa entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramAddEntry="Crea nueva entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramDeleteEntry="Borra entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramGetCurrent="Muestra la entrada del gestor de arranque (NVRAM) que ha iniciado el equipo."
|
||||
MSG_HELP_ogNvramGetNext="Muestra la entrada del gestor de arranque (NVRAM) que se utilizará en el próximo arranque."
|
||||
MSG_HELP_ogNvramGetOrder="Muestra el orden de las entradas del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramGetTimeout="Muestra el tiempo de espera del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramInactiveEntry="Configura a inactiva entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramList="Lista las entradas del gestor de arranque (NVRAN) marcando con un asterisco las activas"
|
||||
MSG_HELP_ogNvramPxeFirstEntry="Configura la tarjeta de red como primer arranque en la NVRAM."
|
||||
MSG_HELP_ogNvramSetNext="Configura el próximo arranque con la entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramSetOrder="Configura el orden de las entradas del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramSetTimeout="Configura el tiempo de espera del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogRaiseError="Muestra y registra mensajes de error y devuelve el código correspondiente."
|
||||
MSG_HELP_ogReduceFs="Reduce el tamaño del sistema de archivos al mínimo ocupado por sus datos."
|
||||
MSG_HELP_ogReduceImage="Reduce el tamaño de la imagen"
|
||||
MSG_HELP_ogRefindDeleteEntry="Borra en rEFInd las entradas para el inicio en una particion."
|
||||
MSG_HELP_ogRefindDefaultEntry="Configura la entrada por defecto de rEFInd."
|
||||
MSG_HELP_ogRefindOgliveDefaultEntry="Configura la entrada de ogLive como la entrada por defecto de rEFInd."
|
||||
MSG_HELP_ogRefindSetTheme="Asigna un tema al rEFInd."
|
||||
MSG_HELP_ogRefindSetTimeOut="Define el tiempo (segundos) que se muestran las opciones de inicio de rEFInd."
|
||||
MSG_HELP_ogRefindSetResolution="Define la resolución que usuará el thema del gestor de arranque rEFInd."
|
||||
MSG_HELP_ogRefindInstall="Instala y configura el gestor rEFInd en la particion EFI"
|
||||
MSG_HELP_ogRestoreAclImage=""
|
||||
MSG_HELP_ogRestoreBootLoaderImage=""
|
||||
MSG_HELP_ogRestoreDiskImage="Restaura una imagen de un disco completo."
|
||||
MSG_HELP_ogRestoreEfiBootLoader="Copia el cargador de arranque de la partición de sistema a la partición EFI."
|
||||
MSG_HELP_ogRestoreImage="Restaura una imagen de sistema operativo."
|
||||
MSG_HELP_ogRestoreInfoImage="Restablece informacion del sistema: acl y enlaces simbolicos"
|
||||
MSG_HELP_ogRestoreMbrImage="Restaura una imagen del sector de arranque (MBR)."
|
||||
MSG_HELP_ogRestoreUuidPartitions="Restaura los uuid de las particiones y la tabla de particiones."
|
||||
MSG_HELP_ogSaveImageInfo="Crea un fichero con la información de la imagen."
|
||||
MSG_HELP_ogSetLinuxName=""
|
||||
MSG_HELP_ogSetPartitionActive="Establece el número de partición activa de un disco."
|
||||
MSG_HELP_ogSetPartitionId="Modifica el tipo de una partición física usando el mnemónico del tipo."
|
||||
MSG_HELP_ogSetPartitionSize="Establece el tamaño de una partición."
|
||||
MSG_HELP_ogSetPartitionType="Modifica el identificador de tipo de una partición física."
|
||||
MSG_HELP_ogSetRegistryValue="Asigna un dato a un valor del registro de Windows."
|
||||
MSG_HELP_ogSetWindowsName="Asigna el nombre del cliente en el registro de Windows."
|
||||
MSG_HELP_ogSetWinlogonUser="Asigna el nombre de usuario por defecto para el gestor de entrada de Windows."
|
||||
MSG_HELP_ogSyncCreate="Sincroniza los datos de la particion a la imagen"
|
||||
MSG_HELP_ogSyncRestore="Sincroniza los datos de la imagen a la particion"
|
||||
MSG_HELP_ogTorrentStart=""
|
||||
MSG_HELP_ogTypeToId="Devuelve el identificador asociado al mnemónico de tipo de partición."
|
||||
MSG_HELP_ogUcastReceiverPartition=""
|
||||
MSG_HELP_ogUcastSendFile=""
|
||||
MSG_HELP_ogUcastSendPartition=""
|
||||
MSG_HELP_ogUcastSyntax=""
|
||||
MSG_HELP_ogUnhidePartition="Hace visible una partición de Windows."
|
||||
MSG_HELP_ogUninstallLinuxClient="Desinstala el cliente OpenGnSys en un sistema operativo Linux."
|
||||
MSG_HELP_ogUninstallWindowsClient="Desinstala el cliente OpenGnSys en un sistema operativo Windows."
|
||||
MSG_HELP_ogUnlock="Desbloquea una partición tras finalizar una operación de uso exclusivo."
|
||||
MSG_HELP_ogUnlockDisk="Desbloquea un disco tras finalizar una operación de uso exclusivo."
|
||||
MSG_HELP_ogUnlockImage="Desbloquea una imagen tras finalizar una operación de uso exclusivo."
|
||||
MSG_HELP_ogUnlockPartition=$MSG_HELP_ogUnlock
|
||||
MSG_HELP_ogUnmountAll="Desmonta todos los sistemas de archivos."
|
||||
MSG_HELP_ogUnmountCache="Desmonta el sistema de archivos de caché local."
|
||||
MSG_HELP_ogUnmount="Desmonta un sistema de archivos."
|
||||
MSG_HELP_ogUnmountFs=$MSG_HELP_ogUnmount
|
||||
MSG_HELP_ogUnmountImage="Desmonta la imagen"
|
||||
MSG_HELP_ogUnsetDirtyBit=""
|
||||
MSG_HELP_ogUpdateCacheIsNecesary="Comprueba si es necesario actualizar una archivo en la cache local."
|
||||
MSG_HELP_ogUpdatePartitionTable="Actualiza informacion tabla particiones del disco"
|
||||
MSG_HELP_ogUuidChange="Reemplaza el UUID de un sistema de ficheros."
|
||||
MSG_HELP_ogWaitSyncImage=""
|
||||
MSG_HELP_ogWindowsBootParameters=""
|
||||
MSG_HELP_ogWindowsRegisterPartition=""
|
||||
|
||||
# Scripts
|
||||
MSG_HELP_configureOs="Post-configura de arranque del sistema"
|
||||
MSG_HELP_createBaseImage="Genera imagen basica de la particion"
|
||||
MSG_HELP_createDiffImage="Genera imagen diferencial de la particion respecto a la imagen basica"
|
||||
MSG_HELP_installOfflineMode="Prepara el equipo cliente para el modo offline."
|
||||
MSG_HELP_partclone2sync="Convierte imagen de partclone en imagen sincronizable."
|
||||
MSG_HELP_restoreBaseImage="Restaura una imagen basica en una particion"
|
||||
MSG_HELP_restoreDiffImage="Restaura una imagen diferencial en una particion"
|
||||
MSG_HELP_updateCache="Realiza la actualizacion de la cache"
|
||||
|
||||
# Mensajes de descripción breve de la interfaz.
|
||||
MSG_INTERFACE_START="[START Interface] Ejecutar comando: "
|
||||
MSG_INTERFACE_END="[END Interface] Comando terminado con este código: "
|
||||
|
||||
# Mensajes de scripts.
|
||||
MSG_SCRIPTS_START=" INICIO scripts : "
|
||||
MSG_SCRIPTS_END=" FIN scripts: "
|
||||
MSG_SCRIPTS_TASK_END="Fin de la tarea"
|
||||
|
||||
MSG_SCRIPTS_TASK_SLEEP="Esperando para iniciar"
|
||||
MSG_SCRIPTS_TASK_START="Iniciando"
|
||||
MSG_SCRIPTS_TASK_ERR="Error"
|
||||
|
||||
# Script createImage.
|
||||
MSG_SCRIPTS_FILE_RENAME=" Renombrar fichero-imagen previo: "
|
||||
MSG_SCRIPTS_CREATE_SIZE=" Calcular espacio (KB) requerido para almacenarlo y el disponible: "
|
||||
|
||||
# Script updateCache.
|
||||
MSG_SCRIPTS_UPDATECACHE_DOUPDATE="comprovar si es necessari actualitzar el fitxer imatge"
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZECACHE="Comprobar que el tamaño de la cache es mayor que el fichero a descargar."
|
||||
# Script updateCache: para las imágenes sincronizadas tipo dir.
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZEDIR="Calculamos el tamaño de la imagen."
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZEIMG="Comprobamos si hay que la imagen del repositorio es mayor que la de la cache."
|
||||
MSG_SCRIPTS_UPDATECACHE_IFNOTCACHEDO="Comprobar el espacio libre de la cache y actuar según engine.cfg"
|
||||
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKMCASTSESSION="Comprobando sesion multicast: ServidorMcast:PuertoDatos"
|
||||
|
||||
# interface sustituye temporalmente al scritp restore
|
||||
MSG_SCRIPTS_CHECK_ENGINE="Analizar proceso a realizar según engine.cfg"
|
||||
MSG_SCRIPTS_MULTICAST_PRECHECK_PORT="Determinar puerto principal y auxiliar multicast."
|
||||
MSG_SCRIPTS_MULTICAST_CHECK_PORT="Comprobar puertos de sesion y datos"
|
||||
MSG_SCRIPTS_MULTICAST_REQUEST_PORT="Solicitar la apertura: "
|
||||
MSG_SCRIPTS_OS_CONFIGURE="Iniciar la configuracion del sistema restaurado"
|
||||
|
||||
# TIME MESSAGES
|
||||
MSG_SCRIPTS_TIME_TOTAL="tiempo total del proceso"
|
||||
MSG_SCRIPTS_TIME_PARTIAL="tiempo parcial del subproceso"
|
||||
|
||||
# HTTPLOG
|
||||
MSG_HTTPLOG_NOUSE="No apague este ordenador por favor"
|
||||
|
||||
# Mensajes sincronizadas
|
||||
MSG_SYNC_RESIZE="Redimensiona la imagen al tamaño necesario"
|
||||
MSG_SYNC_RESTORE="Trae el listado ficheros y baja la imagen"
|
||||
MSG_SYNC_DELETE="Diferencial: Borra archivos antiguos"
|
||||
MSG_SYNC_SLEEP="Espera que se monte/reduzca la imagen"
|
||||
# Mensajes sincronizadas complementarios a errores
|
||||
MSG_SYNC_DIFFERENTFS="El sistema de ficheros de destino no coincide con el de la imagen"
|
||||
MSG_SYNC_EXTENSION="Las extensiones de la imagenes deben ser img o diff"
|
||||
MSG_SYNC_NOCHECK="La imagen esta montada por otro proceso, no podemos comprobarla"
|
||||
|
||||
MSG_RESTORE="Restaura la imagen en"
|
||||
|
|
@ -0,0 +1 @@
|
|||
lang.en_GB.conf
|
|
@ -0,0 +1,385 @@
|
|||
# English language file.
|
||||
#@version 1.1.0
|
||||
#@author Jose Miguel Hernandez - Universidad de Salamanca
|
||||
#@date 2018-03-01
|
||||
|
||||
# Error messages.
|
||||
MSG_ERR_GENERIC="Undefined unknown error"
|
||||
MSG_ERR_FORMAT="Wrong execution format"
|
||||
MSG_ERR_OUTOFLIMIT="Out of range or invalid value"
|
||||
MSG_ERR_NOTFOUND="File or device not found"
|
||||
MSG_ERR_PARTITION="Unknown or wrong partition"
|
||||
MSG_ERR_LOCKED="Resource locked by exclusive use operation"
|
||||
MSG_ERR_CACHE="Local cache error"
|
||||
MSG_ERR_NOGPT="Current disk does not include GPT partition"
|
||||
MSG_ERR_REPO="Failed when mounting images repository"
|
||||
MSG_ERR_NOMSDOS="Current disk does not include MSDOS partition"
|
||||
MSG_ERR_FILESYS="Unknown or unmountable file system"
|
||||
MSG_ERR_NOTOS="Cannot detect or boot OS"
|
||||
MSG_ERR_IMAGE="Cannot create or restore a system image"
|
||||
MSG_ERR_IMAGEFILE="Image file corrupt or of other partclone version"
|
||||
MSG_ERR_NOTEXEC="Non executable program or function"
|
||||
MSG_ERR_NOTWRITE="Write access denied"
|
||||
MSG_ERR_NOTCACHE="No client cache partition"
|
||||
MSG_ERR_NOTUEFI="UEFI isn't active"
|
||||
MSG_ERR_NOTBIOS="BIOS legacy isn't active"
|
||||
MSG_ERR_CACHESIZE="Not enough space in local or remote cache"
|
||||
MSG_ERR_REDUCEFS="Error when reducing file system"
|
||||
MSG_ERR_EXTENDFS="Error when expanding file system"
|
||||
MSG_ERR_IMGSIZEPARTITION="Backup error: Partition smaller than image"
|
||||
MSG_ERR_UPDATECACHE="Error when running `updateCache´ command"
|
||||
MSG_ERR_UCASTSYNTAXT="Error when generating Unicast transfer syntax"
|
||||
MSG_ERR_UCASTSENDPARTITION="Error when sending a Unicast partition"
|
||||
MSG_ERR_UCASTSENDFILE="Error when sending a Unicast file"
|
||||
MSG_ERR_UCASTRECEIVERPARTITION="Error when receiving an Unicast partition"
|
||||
MSG_ERR_UCASTRECEIVERFILE="Error when receiving an Unicast file"
|
||||
MSG_ERR_MCASTSYNTAXT="Error when generating Multicast transfer syntax"
|
||||
MSG_ERR_MCASTSENDFILE="Error when sending Multicast file"
|
||||
MSG_ERR_MCASTRECEIVERFILE="Error when receiving Multicast file"
|
||||
MSG_ERR_MCASTSENDPARTITION="Error when sending Multicast partition"
|
||||
MSG_ERR_MCASTRECEIVERPARTITION="Error when receiving Multicast partition "
|
||||
MSG_ERR_PROTOCOLJOINMASTER="Error when connecting Unicast/Multicast session to Master"
|
||||
MSG_ERR_DONTFORMAT="Formatting Error"
|
||||
MSG_ERR_DONTMOUNT_IMAGE="Error when mounting/reducing image"
|
||||
MSG_ERR_DONTUNMOUNT_IMAGE="Error when unmounting image"
|
||||
MSG_ERR_DONTSYNC_IMAGE="Unsynchronizable image"
|
||||
MSG_ERR_NOTDIFFERENT="Basic image identical to partition"
|
||||
MSG_ERR_SYNCHRONIZING="Synchronizing error, it may affect image creation/restoration process"
|
||||
|
||||
# Warning messages.
|
||||
MSG_DONTUSE="DO NOT USE"
|
||||
MSG_DONTMOUNT="Unmounted file system"
|
||||
MSG_DONTUNMOUNT="Cannot unmount file system or it isn't mounted"
|
||||
MSG_MOUNT="File system already mounted"
|
||||
MSG_MOUNTREADONLY="Read-only file system mounted"
|
||||
MSG_OBSOLETE="OBSOLETE"
|
||||
|
||||
# Auxiliary help messages.
|
||||
MSG_64BIT="64-bit"
|
||||
MSG_DISK="Disk"
|
||||
MSG_ERROR="Error"
|
||||
MSG_EXAMPLE="Example"
|
||||
MSG_FORMAT="Format"
|
||||
MSG_FUNCTION="Function"
|
||||
MSG_HARDWAREINVENTORY="Hardware inventory"
|
||||
MSG_IMAGE="Image"
|
||||
MSG_INSTALLED="Installed"
|
||||
MSG_NOCACHE="No local cache"
|
||||
MSG_NOEXTENDED="No extended partition"
|
||||
MSG_PARTITION="Partition"
|
||||
MSG_PROTOCOL="Protocol"
|
||||
MSG_RESERVEDVALUE="Reserved value"
|
||||
MSG_SEE="See"
|
||||
MSG_UNKNOWN="Unknown"
|
||||
MSG_WARNING="Warning"
|
||||
|
||||
# Boot process messages.
|
||||
MSG_DETECTLVMRAID="Detecting LVM and RAID meta-devices."
|
||||
MSG_ERRBOOTMODE="$MSG_ERROR: Unknown boot mode."
|
||||
MSG_LAUNCHCLIENT="Launching client browser."
|
||||
MSG_LOADAPI="Loading cloning-engine functions."
|
||||
MSG_LOADMODULES="Loading kernel modules."
|
||||
MSG_MAKELINKS="Creating symbolic links."
|
||||
MSG_MOUNTREPO="Mounting repository using %s by %s mode."
|
||||
MSG_OFFLINEMODE="Off-line boot mode."
|
||||
MSG_OTHERSERVICES="Starting client complementary services."
|
||||
MSG_POWEROFFCONF="Defining power-saving parameters."
|
||||
|
||||
# Default menu messages.
|
||||
MSG_BOOT="Boot"
|
||||
MSG_DUPLEX="Duplex"
|
||||
MSG_HOSTNAME="Hostname"
|
||||
MSG_IPADDR="IP Address"
|
||||
MSG_MACADDR="MAC Address"
|
||||
MSG_MENUTITLE="Options menu"
|
||||
MSG_POWEROFF="Shutdown computer"
|
||||
MSG_SPEED="Speed"
|
||||
|
||||
# API functions messages.
|
||||
MSG_HELP_ogAclFilter="Draws ACL files from differential image."
|
||||
MSG_HELP_ogAddCmd="Adds commands to file created by ogInstalMiniSetup."
|
||||
MSG_HELP_ogAddRegistryKey="Adds new Windows registry key."
|
||||
MSG_HELP_ogAddRegistryValue="Adds new Windows registry value."
|
||||
MSG_HELP_ogAddToLaunchDaemon=""
|
||||
MSG_HELP_ogBoot="Boots installed OS."
|
||||
MSG_HELP_ogBootLoaderDeleteEntry="$MSG_DONTUSE."
|
||||
MSG_HELP_ogBootLoaderHidePartitions="$MSG_DONTUSE."
|
||||
MSG_HELP_ogBootMbrGeneric=""
|
||||
MSG_HELP_ogBootMbrXP=""
|
||||
MSG_HELP_ogBurgDefaultEntry="Sets default Burg entry."
|
||||
MSG_HELP_ogBurgDeleteEntry="Deletes partition start-entries from MBR BURG."
|
||||
MSG_HELP_ogBurgHidePartitions="Sets MBR Burg to hide non starting windows partitions. Allows you to select a partition that will not be hidden (e.g. for data)."
|
||||
MSG_HELP_ogBurgInstallMbr="Installs BURG boot-loader on 1st HD MBR."
|
||||
MSG_HELP_ogBurgOgliveDefaultEntry="Sets ogLive input as default Burg input."
|
||||
MSG_HELP_ogCalculateChecksum="Calculates file checksum."
|
||||
MSG_HELP_ogCalculateFullChecksum="Calculates file full checksum"
|
||||
MSG_HELP_ogChangeRepo="Changes repository for remote resource: images."
|
||||
MSG_HELP_ogCheckFs="Checks file system consistence."
|
||||
MSG_HELP_ogCheckIpAddress=""
|
||||
MSG_HELP_ogCheckProgram=""
|
||||
MSG_HELP_ogCheckStringInGroup=""
|
||||
MSG_HELP_ogCheckStringInReg=""
|
||||
MSG_HELP_ogCheckSyncImage="Displays image contents to check it."
|
||||
MSG_HELP_ogCleanLinuxDevices=""
|
||||
MSG_HELP_ogCleanOs="Deletes OS unnecessary files."
|
||||
MSG_HELP_ogCompareChecksumFiles="Compares if the checksums match."
|
||||
MSG_HELP_ogConfigureFstab=""
|
||||
MSG_HELP_ogConfigureOgagent="Sets OS new agent: OGAgent."
|
||||
MSG_HELP_ogCopyFile="Copies file to another storage unit ."
|
||||
MSG_HELP_ogCreateBootLoaderImage=""
|
||||
MSG_HELP_ogCreateCache="Saves space for cache partition at the end of disk."
|
||||
MSG_HELP_ogCreateDiskImage="Creates exact image from local disk."
|
||||
MSG_HELP_ogCreateFileImage="Creates/Resizes synchronized image file."
|
||||
MSG_HELP_ogCreateGptPartitions=""
|
||||
MSG_HELP_ogCreateImage="Creates exact image from local installed OS."
|
||||
MSG_HELP_ogCreateImageSyntax=""
|
||||
MSG_HELP_ogCreateInfoImage="Creates image content information."
|
||||
MSG_HELP_ogCreateMbrImage="Creates MBR image."
|
||||
MSG_HELP_ogCreatePartitions="Creates disk partition table."
|
||||
MSG_HELP_ogCreatePartitionTable="Creates partition table, if necessary."
|
||||
MSG_HELP_ogCreateTorrent=""
|
||||
MSG_HELP_ogCopyEfiBootLoader="Copy the boot loader from the EFI partition to system partition."
|
||||
MSG_HELP_ogDeleteCache="Deletes local cache partition."
|
||||
MSG_HELP_ogDeleteFile="Deletes file from storage."
|
||||
MSG_HELP_ogDeletePartitionTable="Deletes disk table partition"
|
||||
MSG_HELP_ogDeleteRegistryKey="Deletes empty Windows registry key."
|
||||
MSG_HELP_ogDeleteRegistryValue="Deletes Windows registry value."
|
||||
MSG_HELP_ogDeleteTree="Deletes directory tree."
|
||||
MSG_HELP_ogDevToDisk="Returns disk or partition ordinal number for device file path."
|
||||
MSG_HELP_ogDiskToDev="Returns device file path for disk or partition ordinal number."
|
||||
MSG_HELP_ogDomainScript=""
|
||||
MSG_HELP_ogEcho="Displays and log messages."
|
||||
MSG_HELP_ogExecAndLog="Runs and logs command"
|
||||
MSG_HELP_ogExtendFs="Expands file system size to partition maximum."
|
||||
MSG_HELP_ogFindCache="Shows local cache reserved partition."
|
||||
MSG_HELP_ogFixBootSector=""
|
||||
MSG_HELP_ogFormatCache="Formats (clears) local cache."
|
||||
MSG_HELP_ogFormat="Formats file system."
|
||||
MSG_HELP_ogFormatFs=$MSG_HELP_ogFormat
|
||||
MSG_HELP_ogGetArch="Returns client architecture."
|
||||
MSG_HELP_ogGetCacheSize="Returns local cache partition size."
|
||||
MSG_HELP_ogGetCacheSpace="Returns maximum available space that can be reserved for local cache partition."
|
||||
MSG_HELP_ogGetCaller="Returns program or function which is calling to current one"
|
||||
MSG_HELP_ogGetDiskSize="Returns disk size."
|
||||
MSG_HELP_ogGetDiskType="Returns disk type."
|
||||
MSG_HELP_ogGetFreeSize=""
|
||||
MSG_HELP_ogGetFsSize="Returns file system size."
|
||||
MSG_HELP_ogGetFsType="Returns file system type."
|
||||
MSG_HELP_ogGetGroupDir="Returns default directory path for client group."
|
||||
MSG_HELP_ogGetGroupName="Returns client group name."
|
||||
MSG_HELP_ogGetHivePath="Returns full path of file from Windows registry section."
|
||||
MSG_HELP_ogGetHostname="Returns local hostname."
|
||||
MSG_HELP_ogGetImageCompressor="Returns image compression tool."
|
||||
MSG_HELP_ogGetImageInfo="Displays monolithic image information: cloning; compressor; file system; size(KB)."
|
||||
MSG_HELP_ogGetImageProgram="Returns used program to create image."
|
||||
MSG_HELP_ogGetImageSize="Returns system image size."
|
||||
MSG_HELP_ogGetImageType="Returns image file system."
|
||||
MSG_HELP_ogGetIpAddress="Returns client IP."
|
||||
MSG_HELP_ogGetLastSector="Returns last available sector from disk or partition."
|
||||
MSG_HELP_ogGetMacAddress="Returns client Ethernet address."
|
||||
MSG_HELP_ogGetMountImageDir="Returns mounting directory of image."
|
||||
MSG_HELP_ogGetMountPoint="Returns directory of local file system mount point."
|
||||
MSG_HELP_ogGetNetInterface=""
|
||||
MSG_HELP_ogGetOsType="Returns installed OS type."
|
||||
MSG_HELP_ogGetOsUuid="Returns OS UUID"
|
||||
MSG_HELP_ogGetOsVersion="Returns OS version."
|
||||
MSG_HELP_ogGetParentPath="Returns full path of OpenGnsys system file parent directory."
|
||||
MSG_HELP_ogGetPartitionActive="Returns disk active partition."
|
||||
MSG_HELP_ogGetPartitionId="Returns partition type ID."
|
||||
MSG_HELP_ogGetPartitionSize="Returns partition size."
|
||||
MSG_HELP_ogGetPartitionsNumber="Returns disk partitions number."
|
||||
MSG_HELP_ogGetPartitionTableType="Returns disk partition table type."
|
||||
MSG_HELP_ogGetPartitionType="Returns partition type."
|
||||
MSG_HELP_ogGetPath="Returns full path of OpenGnsys system file."
|
||||
MSG_HELP_ogGetRegistryValue="Returns data from Windows registry value."
|
||||
MSG_HELP_ogGetRepoIp="Returns OpenGnsys Repository IP address ."
|
||||
MSG_HELP_ogGetSerialNumber="Returns host serial number."
|
||||
MSG_HELP_ogGetServerIp="Returns main OpenGnsys Server IP address."
|
||||
MSG_HELP_ogGetSizeParameters="Returns file system data size, required space for image and if it fits in the chosen repository."
|
||||
MSG_HELP_ogGetWindowsName="Returns saved client name on Windows registry."
|
||||
MSG_HELP_ogGrubAddOgLive="Adds MBR grub an entry calling Opengnsys client."
|
||||
MSG_HELP_ogGrubDefaultEntry="Sets GRUB default entry."
|
||||
MSG_HELP_ogGrubDeleteEntry="Deletes partition start entries on MBR grub."
|
||||
MSG_HELP_ogGrubHidePartitions="Sets MBR grub to hide non starting Windows partitions. Allows you to select a partition that will not be hidden (e.g. for data)."
|
||||
MSG_HELP_ogGrubInstallMbr="Installs GRUB boot loader on 1st HD MBR"
|
||||
MSG_HELP_ogGrubInstallPartition="Installs GRUB boot loader on BootSector"
|
||||
MSG_HELP_ogGrubOgliveDefaultEntry="Sets ogLive entry as default GRUB entry."
|
||||
MSG_HELP_ogGrubSecurity="Configures user and password for change the menu entries of grub."
|
||||
MSG_HELP_ogGrubUefiConf="Generates the grub.cfg file of the EFI partition."
|
||||
MSG_HELP_ogHelp="Shows functions help messages."
|
||||
MSG_HELP_ogHidePartition="Hides Windows partition."
|
||||
MSG_HELP_ogIdToType="Returns partition type identifier."
|
||||
MSG_HELP_ogInstallFirstBoot="Creates file to run on first Windows boot."
|
||||
MSG_HELP_ogInstallLaunchDaemon="Installs file to run on MACos boot."
|
||||
MSG_HELP_ogInstallLinuxClient="$MSG_OBSOLETE."
|
||||
MSG_HELP_ogInstallMiniSetup="Installs file to run on Windows boot."
|
||||
MSG_HELP_ogInstallRunonce="Creates file to run on admin-user Windows boot."
|
||||
MSG_HELP_ogInstallWindowsClient="$MSG_OBSOLETE."
|
||||
MSG_HELP_ogIsFormated="Checks file system if formatted."
|
||||
MSG_HELP_ogIsImageLocked="Checks image if blocked by exclusive use operation."
|
||||
MSG_HELP_ogIsLocked="Checks partition or disk if blocked by exclusive use operation."
|
||||
MSG_HELP_ogIsDiskLocked="Checks disk if blocked by exclusive use operation."
|
||||
MSG_HELP_ogIsMounted="Checks file system if mounted."
|
||||
MSG_HELP_ogIsNewerFile="Checks if one file is newer (or has been modified later) than another one."
|
||||
MSG_HELP_ogIsPartitionLocked=$MSG_HELP_ogIsLocked
|
||||
MSG_HELP_ogIsRepoLocked=""
|
||||
MSG_HELP_ogIsSyncImage="Checks image if synchronizable."
|
||||
MSG_HELP_ogIsVirtualMachine="Checks if client is a virtual machine"
|
||||
MSG_HELP_ogIsWritable="Checks if mounted file system has write permissions."
|
||||
MSG_HELP_ogLinuxBootParameters="Returns installed Linux boot parameters."
|
||||
MSG_HELP_ogListHardwareInfo="Lists the client hardware inventory."
|
||||
MSG_HELP_ogListLogicalPartitions="Lists disk logic partitions."
|
||||
MSG_HELP_ogListPartitions="Lists disk partitions table."
|
||||
MSG_HELP_ogListPrimaryPartitions="Lists disk primary partitions"
|
||||
MSG_HELP_ogListRegistryKeys="Lists sub-keys names included on a Windows registry key."
|
||||
MSG_HELP_ogListRegistryValues="Lists value names included on a Windows registry key."
|
||||
MSG_HELP_ogListSoftware="Lists OS installed programs inventory."
|
||||
MSG_HELP_ogLock="Blocks partition for exclusive use operation."
|
||||
MSG_HELP_ogLockDisk="Blocks disk for exclusive use operation."
|
||||
MSG_HELP_ogLockImage="Blocks image for exclusive use operation."
|
||||
MSG_HELP_ogLockPartition=$MSG_HELP_ogLock
|
||||
MSG_HELP_ogMakeChecksumFile="Stores file checksum."
|
||||
MSG_HELP_ogMakeDir="Makes OpenGnsys directory."
|
||||
MSG_HELP_ogMakeGroupDir="Makes group (lab) directory on repository."
|
||||
MSG_HELP_ogMcastReceiverFile=""
|
||||
MSG_HELP_ogMcastReceiverPartition=""
|
||||
MSG_HELP_ogMcastRequest=""
|
||||
MSG_HELP_ogMcastSendFile=""
|
||||
MSG_HELP_ogMcastSendPartition=""
|
||||
MSG_HELP_ogMcastSyntax=""
|
||||
MSG_HELP_ogMountCache="Mounts cache file system."
|
||||
MSG_HELP_ogMountCdrom="Mounts default optical drive."
|
||||
MSG_HELP_ogMountFs=$MSG_HELP_ogMount
|
||||
MSG_HELP_ogMountImage="Mounts synchronizable image"
|
||||
MSG_HELP_ogMount="Mounts file system and returns mount point."
|
||||
MSG_HELP_ogNvramActiveEntry="Sets active a bootloader (NVRAM) entry."
|
||||
MSG_HELP_ogNvramAddEntry="Creates new entry in bootloader (NVRAM)."
|
||||
MSG_HELP_ogNvramDeleteEntry="Deletes a bootloader (NVRAM) entry."
|
||||
MSG_HELP_ogNvramGetCurrent="Displays the bootloader (NVRAM) entry that was started by the computer."
|
||||
MSG_HELP_ogNvramGetNext="Displays the bootloader (NVRAM) entry for the boot next."
|
||||
MSG_HELP_ogNvramGetOrder="Displays the bootloader (NVRAM) entries order."
|
||||
MSG_HELP_ogNvramGetTimeout="Displays the bootloader (NVRAM) timeout."
|
||||
MSG_HELP_ogNvramInactiveEntry="Sets inactive bootloader (NVRAM) entry."
|
||||
MSG_HELP_ogNvramList="Lists bootloader (NVRAM) entries, by staring actives ones."
|
||||
MSG_HELP_ogNvramPxeFirstEntry="Set the network as the NVRAM first boot."
|
||||
MSG_HELP_ogNvramSetNext="Set the bootloader (NVRAM) entry for the boot next."
|
||||
MSG_HELP_ogNvramSetOrder="Sets the bootloader (NVRAM) entries order."
|
||||
MSG_HELP_ogNvramSetTimeout="Sets the bootloader (NVRAM) timeout."
|
||||
MSG_HELP_ogRaiseError="Displays and registers error messages and returns code."
|
||||
MSG_HELP_ogReduceFs="Reduces file system size to minimum."
|
||||
MSG_HELP_ogReduceImage="Reduces image size."
|
||||
MSG_HELP_ogRefindDeleteEntry="Deletes the menu entry of a partition in rEFInd."
|
||||
MSG_HELP_ogRefindDefaultEntry="Configures default menu entry in rEFInd.""
|
||||
MSG_HELP_ogRefindOgliveDefaultEntry="Configures ogLive menu entry as default menu entry in rEFInd."
|
||||
MSG_HELP_ogRefindSetTheme="Configures rEFInd's theme."
|
||||
MSG_HELP_ogRefindSetTimeOut="Defines the time that rEFInd shows the menu."
|
||||
MSG_HELP_ogRefindSetResolution="Defines the resolucion of rEFInd's theme."
|
||||
MSG_HELP_ogRefindInstall="Installs and configures rEFInd boot loader in ESP."
|
||||
MSG_HELP_ogRestoreAclImage="Restores Windows ACL (Inf. must be on /tmp)."
|
||||
MSG_HELP_ogRestoreBootLoaderImage=""
|
||||
MSG_HELP_ogRestoreDiskImage="Restores disk image."
|
||||
MSG_HELP_ogRestoreEfiBootLoader="Copy the boot loader from the system partition to the EFI partition."
|
||||
MSG_HELP_ogRestoreImage="Restore OS image."
|
||||
MSG_HELP_ogRestoreInfoImage="Restores system information: ACL and symbolic links"
|
||||
MSG_HELP_ogRestoreMbrImage="Restores boot sector image (MBR)."
|
||||
MSG_HELP_ogRestoreUuidPartitions="Restores UUID of partitions and partition table."
|
||||
MSG_HELP_ogSaveImageInfo="Creates the image information file."
|
||||
MSG_HELP_ogSetLinuxName=""
|
||||
MSG_HELP_ogSetPartitionActive="Sets active partition number of disk."
|
||||
MSG_HELP_ogSetPartitionId="Changes partition ID using mnemonic."
|
||||
MSG_HELP_ogSetPartitionSize="Sets partition size."
|
||||
MSG_HELP_ogSetPartitionType="Changes partition type ID."
|
||||
MSG_HELP_ogSetRegistryValue="Assigns data to a Windows registry values."
|
||||
MSG_HELP_ogSetWindowsName="Assigns client name to Windows registry."
|
||||
MSG_HELP_ogSetWinlogonUser="Assigns Windows default user name to Windows input manager."
|
||||
MSG_HELP_ogSyncCreate="Synchronizes partition data to image"
|
||||
MSG_HELP_ogSyncRestore="Synchronize image data to partition"
|
||||
MSG_HELP_ogTorrentStart=""
|
||||
MSG_HELP_ogTypeToId="Returns the ID of partition type mnemonic."
|
||||
MSG_HELP_ogUcastReceiverPartition=""
|
||||
MSG_HELP_ogUcastSendFile=""
|
||||
MSG_HELP_ogUcastSendPartition=""
|
||||
MSG_HELP_ogUcastSyntax=""
|
||||
MSG_HELP_ogUnhidePartition="Unhides Windows partition."
|
||||
MSG_HELP_ogUninstallLinuxClient="Uninstalls old OpenGnSys agent from Linux OS."
|
||||
MSG_HELP_ogUninstallWindowsClient="Uninstalls oldOpenGnSys agent from Windows OS."
|
||||
MSG_HELP_ogUnlock="Unlocks partition after exclusive use operation."
|
||||
MSG_HELP_ogUnlockDisk="Unlocks disk after exclusive use operation."
|
||||
MSG_HELP_ogUnlockImage="Unlocks image after exclusive use operation."
|
||||
MSG_HELP_ogUnlockPartition=$MSG_HELP_ogUnlock
|
||||
MSG_HELP_ogUnmountAll="Unmounts all file systems."
|
||||
MSG_HELP_ogUnmountCache="Unmounts cache file system."
|
||||
MSG_HELP_ogUnmountFs=$MSG_HELP_ogUnmount
|
||||
MSG_HELP_ogUnmountImage="Unmounts image"
|
||||
MSG_HELP_ogUnmount="Unmounts file system."
|
||||
MSG_HELP_ogUnsetDirtyBit=
|
||||
MSG_HELP_ogUpdateCacheIsNecesary="Checks if necessary file update in local cache."
|
||||
MSG_HELP_ogUpdatePartitionTable="Updates disk partition table info "
|
||||
MSG_HELP_ogUuidChange="Replaces the filesystem UUID"
|
||||
MSG_HELP_ogWaitSyncImage=""
|
||||
MSG_HELP_ogWindowsBootParameters=""
|
||||
MSG_HELP_ogWindowsRegisterPartition=""
|
||||
|
||||
# Scripts
|
||||
MSG_HELP_configureOs="Post-configure system boot"
|
||||
MSG_HELP_createBaseImage="Create partition basic image"
|
||||
MSG_HELP_createDiffImage="Create partition differential image from basic image"
|
||||
MSG_HELP_installOfflineMode="Prepare client for off-line mode."
|
||||
MSG_HELP_partclone2sync="Turn part-clone image into synchronizable image."
|
||||
MSG_HELP_restoreBaseImage="Restore basic image into partition"
|
||||
MSG_HELP_restoreDiffImage="Restore differential image into partition"
|
||||
MSG_HELP_updateCache="Update cache"
|
||||
|
||||
# INTERFACE functions messages.
|
||||
MSG_INTERFACE_START="[START Interface] Run command: "
|
||||
MSG_INTERFACE_END="[END Interface] Command finished with this code: "
|
||||
|
||||
# SCRIPTS messages.
|
||||
MSG_SCRIPTS_START=" START scripts: "
|
||||
MSG_SCRIPTS_END=" END scripts: "
|
||||
MSG_SCRIPTS_TASK_END="End of task"
|
||||
|
||||
MSG_SCRIPTS_TASK_SLEEP="Waiting to start"
|
||||
MSG_SCRIPTS_TASK_START="Starting"
|
||||
MSG_SCRIPTS_TASK_ERR="Error"
|
||||
|
||||
# createImage script
|
||||
MSG_SCRIPTS_FILE_RENAME="Rename previous image-file: "
|
||||
MSG_SCRIPTS_CREATE_SIZE="Check required and available storing space(KB): "
|
||||
|
||||
# updateCache script
|
||||
MSG_SCRIPTS_UPDATECACHE_DOUPDATE="Check if it is necessary to update image file"
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZECACHE="Check if Cache size is bigger than image file size."
|
||||
# Script updateCache: for dir synchronized images .
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZEDIR="Calculate image size."
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZEIMG="Check if repository image file size is bigger than Cache size."
|
||||
MSG_SCRIPTS_UPDATECACHE_IFNOTCACHEDO="Check free Cache and apply engine.cfg"
|
||||
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKMCASTSESSION="Checking Multicast Session McastServer:DataPort"
|
||||
|
||||
# interface temporarily replaces restore script
|
||||
MSG_SCRIPTS_CHECK_ENGINE="Analyze process to carry out according to engine.cfg"
|
||||
MSG_SCRIPTS_MULTICAST_PRECHECK_PORT="Check main and auxiliary Multicast port."
|
||||
MSG_SCRIPTS_MULTICAST_CHECK_PORT="Check session and data ports"
|
||||
MSG_SCRIPTS_MULTICAST_REQUEST_PORT="Request Multicast port opening: "
|
||||
MSG_SCRIPTS_OS_CONFIGURE="Start restored system setting"
|
||||
|
||||
# TIME MESSAGES
|
||||
MSG_SCRIPTS_TIME_TOTAL="Total process time"
|
||||
MSG_SCRIPTS_TIME_PARTIAL="Partial sub-process time"
|
||||
|
||||
# HTTPLOG
|
||||
MSG_HTTPLOG_NOUSE="PLEASE DO NOT TURN OFF THIS COMPUTER"
|
||||
|
||||
# Messages for synchronized images (complementary to errors)
|
||||
MSG_SYNC_RESIZE="Resize image to necessary size"
|
||||
MSG_SYNC_RESTORE="Get files list and download image"
|
||||
MSG_SYNC_DELETE="Differential: Delete old files"
|
||||
MSG_SYNC_SLEEP="Wait for mounting/reducing image"
|
||||
# Messages for synchronized images (complementary to errors)
|
||||
MSG_SYNC_DIFFERENTFS="Destination file system does not match image"
|
||||
MSG_SYNC_EXTENSION="Image extension must be img or diff"
|
||||
MSG_SYNC_NOCHECK="Image mounted by another process. Cannot verify it"
|
||||
|
||||
MSG_RESTORE="Restore image on "
|
||||
|
|
@ -0,0 +1 @@
|
|||
lang.es_ES.conf
|
|
@ -0,0 +1,385 @@
|
|||
# Fichero de idioma: español.
|
||||
#@version 1.1.1
|
||||
#@author
|
||||
|
||||
|
||||
# Mensajes de error.
|
||||
MSG_ERR_GENERIC="Error imprevisto no definido"
|
||||
MSG_ERR_FORMAT="Formato de ejecución incorrecto"
|
||||
MSG_ERR_OUTOFLIMIT="Valor fuera de rango o no válido"
|
||||
MSG_ERR_NOTFOUND="Fichero o dispositivo no encontrado"
|
||||
MSG_ERR_PARTITION="Partición errónea o desconocida"
|
||||
MSG_ERR_LOCKED="Recurso bloqueado por operación de uso exclusivo"
|
||||
MSG_ERR_CACHE="Error en partición de caché local"
|
||||
MSG_ERR_NOGPT="El disco indicado no contiene una partición GPT"
|
||||
MSG_ERR_REPO="Error al montar el repositorio de imágenes"
|
||||
MSG_ERR_NOMSDOS="El disco indicado no contiene una partición MSDOS"
|
||||
MSG_ERR_FILESYS="Sistema de archivos desconocido o no se puede montar"
|
||||
MSG_ERR_NOTOS="Sistema operativo no detectado o no se puede iniciar"
|
||||
MSG_ERR_IMAGE="No se puede crear o restaurar una image de sistema"
|
||||
MSG_ERR_IMAGEFILE="Archivo de imagen corrupto o de otra versión de partclone"
|
||||
MSG_ERR_NOTEXEC="Programa o función no ejecutable"
|
||||
MSG_ERR_NOTWRITE="No hay acceso de escritura"
|
||||
MSG_ERR_NOTCACHE="No existe partición caché en el cliente"
|
||||
MSG_ERR_NOTUEFI="La interfaz UEFI no está activa"
|
||||
MSG_ERR_NOTBIOS="La interfaz BIOS Legacy no está activa"
|
||||
MSG_ERR_CACHESIZE="El espacio de la caché local o remota no es suficiente"
|
||||
MSG_ERR_REDUCEFS="Error al reducir el sistema de archivos"
|
||||
MSG_ERR_EXTENDFS="Error al expandir el sistema de archivos"
|
||||
MSG_ERR_IMGSIZEPARTITION="Error al restaurar: Partición mas pequeña que la imagen"
|
||||
MSG_ERR_UPDATECACHE="Error al realizar el comando updateCache"
|
||||
MSG_ERR_UCASTSYNTAXT="Error en la generación de sintaxis de transferenica Unicast"
|
||||
MSG_ERR_UCASTSENDPARTITION="Error en envío Unicast de una partición"
|
||||
MSG_ERR_UCASTSENDFILE="Error en envío Unicast de un fichero"
|
||||
MSG_ERR_UCASTRECEIVERPARTITION="Error en la recepción Unicast de una partición"
|
||||
MSG_ERR_UCASTRECEIVERFILE="Error en la recepción Unicast de un fichero"
|
||||
MSG_ERR_MCASTSYNTAXT="Error en la generación de sintaxis de transferenica Multicast"
|
||||
MSG_ERR_MCASTSENDFILE="Error en envío Multicast de un fichero"
|
||||
MSG_ERR_MCASTRECEIVERFILE="Error en la recepción Multicast de un fichero"
|
||||
MSG_ERR_MCASTSENDPARTITION="Error en envío Multicast de una partición"
|
||||
MSG_ERR_MCASTRECEIVERPARTITION="Error en la recepción Multicast de un fichero"
|
||||
MSG_ERR_PROTOCOLJOINMASTER="Error en la conexión de una sesión Unicast|Multicast con el Master"
|
||||
MSG_ERR_DONTFORMAT="Error al formatear"
|
||||
MSG_ERR_DONTMOUNT_IMAGE="Error al montar/reducir la imagen"
|
||||
MSG_ERR_DONTUNMOUNT_IMAGE="Error al desmontar la imagen"
|
||||
MSG_ERR_DONTSYNC_IMAGE="Imagen no sincronizable"
|
||||
MSG_ERR_NOTDIFFERENT="No se detectan diferencias entre la imagen básica y la partición"
|
||||
MSG_ERR_SYNCHRONIZING="Error al sincronizar, puede afectar la creacion|restauracion de la imagen"
|
||||
|
||||
# Mensajes de avisos.
|
||||
MSG_DONTMOUNT="Sistema de archivos no montado"
|
||||
MSG_DONTUSE="NO USAR"
|
||||
MSG_DONTUNMOUNT="El sistema de archivos no se puede desmontar o no está montado"
|
||||
MSG_MOUNT="Sistema de archivos montado"
|
||||
MSG_MOUNTREADONLY="Sistema de archivos montado solo de lectura"
|
||||
MSG_OBSOLETE="EN DESUSO"
|
||||
|
||||
# Mensajes complementarios para las ayudas.
|
||||
MSG_64BIT="64 bits"
|
||||
MSG_DISK="disco"
|
||||
MSG_ERROR="Error"
|
||||
MSG_EXAMPLE="Ejemplo"
|
||||
MSG_FORMAT="Formato"
|
||||
MSG_FUNCTION="Función"
|
||||
MSG_HARDWAREINVENTORY="Inventario de hardware de la máquina"
|
||||
MSG_IMAGE="imagen"
|
||||
MSG_INSTALLED="instalado"
|
||||
MSG_NOCACHE="sin caché local"
|
||||
MSG_NOEXTENDED="sin partición extendida"
|
||||
MSG_PARTITION="partición"
|
||||
MSG_PROTOCOL="protocolo"
|
||||
MSG_RESERVEDVALUE="Valor reservado"
|
||||
MSG_SEE="Ver"
|
||||
MSG_UNKNOWN="Desconocido"
|
||||
MSG_WARNING="Aviso"
|
||||
|
||||
# Mensajes del proceso de arranque.
|
||||
MSG_DETECTLVMRAID="Detectar metadispositivos LVM y RAID."
|
||||
MSG_ERRBOOTMODE="$MSG_ERROR: Modo de arranque desconocido."
|
||||
MSG_LAUNCHCLIENT="Ejecutar cliente."
|
||||
MSG_LOADAPI="Cargar funciones del motor de clonación."
|
||||
MSG_LOADMODULES="Cargar módulos del kernel."
|
||||
MSG_MAKELINKS="Crear enlaces simbólicos."
|
||||
MSG_MOUNTREPO="Montar repositorio por %s en modo %s."
|
||||
MSG_OFFLINEMODE="Modo de arranque sin conexión."
|
||||
MSG_OTHERSERVICES="Iniciar servicios complementarios del cliente."
|
||||
MSG_POWEROFFCONF="Definir parámetros de ahorro de energía."
|
||||
|
||||
# Mensajes del menú por defecto.
|
||||
MSG_BOOT="Iniciar"
|
||||
MSG_DUPLEX="Dúplex"
|
||||
MSG_HOSTNAME="Equipo"
|
||||
MSG_IPADDR="Dirección IP"
|
||||
MSG_MACADDR="Dirección MAC"
|
||||
MSG_MENUTITLE="Menú de opciones"
|
||||
MSG_POWEROFF="Apagar el equipo"
|
||||
MSG_SPEED="Velocidad"
|
||||
|
||||
# Mensajes de descripción breve de las funciones de la API.
|
||||
MSG_HELP_ogAclFilter="Extrae las acl de los ficheros de la diferencial"
|
||||
MSG_HELP_ogAddCmd="Añade comandos al fichero creado por la función ogInstalMiniSetup."
|
||||
MSG_HELP_ogAddRegistryKey="Añade una nueva clave al registro de Windows."
|
||||
MSG_HELP_ogAddRegistryValue="Añade un nuevo valor al registro de Windows."
|
||||
MSG_HELP_ogAddToLaunchDaemon=""
|
||||
MSG_HELP_ogBoot="Arranca un sistema operativo instalado."
|
||||
MSG_HELP_ogBootLoaderDeleteEntry="$MSG_DONTUSE."
|
||||
MSG_HELP_ogBootLoaderHidePartitions="$MSG_DONTUSE."
|
||||
MSG_HELP_ogBootMbrGeneric=""
|
||||
MSG_HELP_ogBootMbrXP=""
|
||||
MSG_HELP_ogBurgDefaultEntry="Configura la entrada por defecto de Burg."
|
||||
MSG_HELP_ogBurgDeleteEntry="Borra en el Burg del MBR las entradas para el inicio en una particion."
|
||||
MSG_HELP_ogBurgHidePartitions="Configura el Burg del MBR para que oculte las particiones de windows que no se esten iniciando. Permite definir una partición que no se ocultará (ej: para datos)."
|
||||
MSG_HELP_ogBurgInstallMbr="Instala el gestor de arranque BURG en el MBR del primer disco duro"
|
||||
MSG_HELP_ogBurgOgliveDefaultEntry="Configura la entrada de ogLive como la entrada por defecto de Burg."
|
||||
MSG_HELP_ogCalculateChecksum="Calcula la suma de comprobación (checksum) de un fichero."
|
||||
MSG_HELP_ogCalculateFullChecksum="Calcula la suma de comprobación completa de un fichero."
|
||||
MSG_HELP_ogChangeRepo="Cambia el repositorio para el recurso remoto images."
|
||||
MSG_HELP_ogCheckFs="Comprueba la consistencia de un sistema de archivos."
|
||||
MSG_HELP_ogCheckIpAddress=""
|
||||
MSG_HELP_ogCheckProgram=""
|
||||
MSG_HELP_ogCheckStringInGroup=""
|
||||
MSG_HELP_ogCheckStringInReg=""
|
||||
MSG_HELP_ogCheckSyncImage="Muestra el contenido de la imagen para comprobarla."
|
||||
MSG_HELP_ogCleanLinuxDevices=""
|
||||
MSG_HELP_ogCleanOs="Elimina los archivos que no son necesarios en el sistema operativo."
|
||||
MSG_HELP_ogCompareChecksumFiles="Compara si coinciden las sumas de comprobación almacenadas de 2 ficheros."
|
||||
MSG_HELP_ogConfigureFstab=""
|
||||
MSG_HELP_ogConfigureOgagent="Configura el nuevo agente OGAgent para sistemas operativos."
|
||||
MSG_HELP_ogCopyFile="Copia un fichero a otro almacenamiento."
|
||||
MSG_HELP_ogCreateBootLoaderImage=""
|
||||
MSG_HELP_ogCreateCache="Reserva espacio para la partición de caché al final del disco."
|
||||
MSG_HELP_ogCreateDiskImage="Genera una imagen exacta de un disco completo."
|
||||
MSG_HELP_ogCreateFileImage="Crea/redimensiona el archivo de la imagen sincronizada"
|
||||
MSG_HELP_ogCreateGptPartitions=""
|
||||
MSG_HELP_ogCreateImage="Genera una imagen exacta de un sistema operativo instalado localmente."
|
||||
MSG_HELP_ogCreateImageSyntax=""
|
||||
MSG_HELP_ogCreateInfoImage="Crea información del contenido de la imagen"
|
||||
MSG_HELP_ogCreateMbrImage="Genera una imagen del sector de arranque (MBR)."
|
||||
MSG_HELP_ogCreatePartitions="Define la estructura de particiones de un disco."
|
||||
MSG_HELP_ogCreatePartitionTable="Genera una tabla de particiones en caso de que no sea valida."
|
||||
MSG_HELP_ogCreateTorrent=""
|
||||
MSG_HELP_ogCopyEfiBootLoader="Copia el cargador de arranque desde la partición EFI a la de sistema."
|
||||
MSG_HELP_ogDeleteCache="Elimina la partición de caché local."
|
||||
MSG_HELP_ogDeleteFile="Borra un fichero de un espacio de almacenamiento."
|
||||
MSG_HELP_ogDeletePartitionTable="Elimina la tabla de particiones del disco"
|
||||
MSG_HELP_ogDeleteRegistryKey="Borra una clave vacía del registro de Windows."
|
||||
MSG_HELP_ogDeleteRegistryValue="Borra un valor del registro de Windows."
|
||||
MSG_HELP_ogDeleteTree="Borra un árbol de directorios de un espacio de almacenamiento."
|
||||
MSG_HELP_ogDevToDisk="Devuelve el nº de orden de disco o de partición correspondiente al camino del fichero de dispositivo."
|
||||
MSG_HELP_ogDiskToDev="Devuelve el camino del fichero de dispositivo correspondiente al nº de orden de disco o de partición."
|
||||
MSG_HELP_ogDomainScript=""
|
||||
MSG_HELP_ogEcho="Muestra un mensaje en pantalla y permite registrarlo en fichero de log"
|
||||
MSG_HELP_ogExecAndLog="Ejecuta un comando y registra su salida en fichero de log"
|
||||
MSG_HELP_ogExtendFs="Extiende el tamaño de un sistema de archivo al máximo de su partición."
|
||||
MSG_HELP_ogFindCache="Indica la partición reservada para caché local."
|
||||
MSG_HELP_ogFixBootSector=""
|
||||
MSG_HELP_ogFormatCache="Formatea (inicia) el sistema de caché local."
|
||||
MSG_HELP_ogFormat="Formatea o reformatea un sistema de archivos."
|
||||
MSG_HELP_ogFormatFs=$MSG_HELP_ogFormat
|
||||
MSG_HELP_ogGetArch="Devuelve el tipo de arquitectura del cliente."
|
||||
MSG_HELP_ogGetCacheSize="Devuelve el tamaño de la partición de caché local."
|
||||
MSG_HELP_ogGetCacheSpace="Devuelve el espacio máximo disponible que puede ser reservado para la partición de caché local."
|
||||
MSG_HELP_ogGetCaller="Devuelve el programa o función que llama al actual"
|
||||
MSG_HELP_ogGetDiskSize="Devuelve el tamaño del disco."
|
||||
MSG_HELP_ogGetDiskType="Devuelve el mnemónico de tipo de disco."
|
||||
MSG_HELP_ogGetFreeSize=""
|
||||
MSG_HELP_ogGetFsSize="Devuelve el tamaño de un sistema de archivos."
|
||||
MSG_HELP_ogGetFsType="Devuelve el mnemónico de tipo de sistema de archivos."
|
||||
MSG_HELP_ogGetGroupDir="Devuelve el camino del directorio por defecto para el grupo del cliente."
|
||||
MSG_HELP_ogGetGroupName="Devuelve el nombre del grupo al que pertenece el cliente."
|
||||
MSG_HELP_ogGetHivePath="Devuelve el camino completo del fichero de una sección del registro de Windows."
|
||||
MSG_HELP_ogGetHostname="Devuelve el nombre de la máquina local."
|
||||
MSG_HELP_ogGetImageCompressor="Devuelve la herramienta de compresión de la imagen."
|
||||
MSG_HELP_ogGetImageInfo="Muestra información sobre la imagen monolitica: clonacion:compresor:sistemaarchivos:tamañoKB."
|
||||
MSG_HELP_ogGetImageProgram="Devuelve el programa usado para crear la imagen."
|
||||
MSG_HELP_ogGetImageSize="Devuelve el tamaño de una imagen de sistema."
|
||||
MSG_HELP_ogGetImageType="Devuelve el sistema de ficheros de la imagen."
|
||||
MSG_HELP_ogGetIpAddress="Devuelve la dirección IP del cliente."
|
||||
MSG_HELP_ogGetLastSector="Devuelve el último sector usable del disco o de una partición."
|
||||
MSG_HELP_ogGetMacAddress="Devuelve la dirección Ethernet del cliente."
|
||||
MSG_HELP_ogGetMountImageDir="Devuelve el directorio de montaje de una imagen."
|
||||
MSG_HELP_ogGetMountPoint="Devuelve el directorio donde está montado un sistema de archivos local."
|
||||
MSG_HELP_ogGetNetInterface=""
|
||||
MSG_HELP_ogGetOsType="Devuelve el tipo de un sistema operativo instalado."
|
||||
MSG_HELP_ogGetOsUuid="Devuelve el UUID de un sistema operativo"
|
||||
MSG_HELP_ogGetOsVersion="Devuelve el tipo y la versión de un sistema operativo instalado."
|
||||
MSG_HELP_ogGetParentPath="Devuelve el camino completo del directorio padre de un fichero de sistema OpenGnsys."
|
||||
MSG_HELP_ogGetPartitionActive="Indica cual es la partición marcada como activa en un disco."
|
||||
MSG_HELP_ogGetPartitionId="Devuelve el identificador de tipo de una partición."
|
||||
MSG_HELP_ogGetPartitionSize="Devuelve el tamaño de una partición."
|
||||
MSG_HELP_ogGetPartitionsNumber="Devuelve el número de particiones de un disco"
|
||||
MSG_HELP_ogGetPartitionTableType="Devuelve el tipo de tabla de particiones del disco"
|
||||
MSG_HELP_ogGetPartitionType="Devuelve el mnemónico de tipo de una partición."
|
||||
MSG_HELP_ogGetPath="Devuelve el camino completo de un fichero de sistema OpenGnsys."
|
||||
MSG_HELP_ogGetRegistryValue="Devuelve el dato de un valor del registro de Windows."
|
||||
MSG_HELP_ogGetRepoIp="Devuelve la dirección IP del repositorio de datos."
|
||||
MSG_HELP_ogGetSerialNumber="Devuelve el número de serie del equipo"
|
||||
MSG_HELP_ogGetServerIp="Devuelve la dirección IP del servidor principal."
|
||||
MSG_HELP_ogGetSizeParameters="Devuelve el tamaño de los datos de un sistema de ficheros, el espacio necesario para la imagen y si cabe en el repositorio elegido."
|
||||
MSG_HELP_ogGetWindowsName="Devuelve el nombre del cliente guardado en el registro de Windows."
|
||||
MSG_HELP_ogGrubAddOgLive="Incluye en el grub del MBR una entrada llamando al cliente de opengnsys."
|
||||
MSG_HELP_ogGrubDefaultEntry="Configura la entrada por defecto de GRUB."
|
||||
MSG_HELP_ogGrubDeleteEntry="Borra en el grub del MBR las entradas para el inicio en una particion."
|
||||
MSG_HELP_ogGrubHidePartitions="Configura el grub del MBR para que oculte las particiones de windows que no se esten iniciando. Permite definir una partición que no se ocultará (ej: para datos)."
|
||||
MSG_HELP_ogGrubInstallMbr="Instala el gestor de arranque GRUB en el MBR del primer disco duro"
|
||||
MSG_HELP_ogGrubInstallPartition="Instala el gestor de arranque GRUB en el BootSector"
|
||||
MSG_HELP_ogGrubOgliveDefaultEntry="Configura la entrada de ogLive como la entrada por defecto de GRUB."
|
||||
MSG_HELP_ogGrubSecurity="Configura usuario y clave para modificar las entradas del menu del Grub."
|
||||
MSG_HELP_ogGrubUefiConf="Genera el fichero grub.cfg de la partición EFI."
|
||||
MSG_HELP_ogHelp="Muestra mensajes de ayudas para las funciones."
|
||||
MSG_HELP_ogHidePartition="Oculta una partición de Windows."
|
||||
MSG_HELP_ogIdToType="Devuelve el mnemónico asociado al identificador de tipo de partición."
|
||||
MSG_HELP_ogInstallFirstBoot="Crea un archivo que se ejecutará en el primer arranque de Windows."
|
||||
MSG_HELP_ogInstallLaunchDaemon="Instala un archivo que se ejecutará en el arranque de macOS."
|
||||
MSG_HELP_ogInstallLinuxClient="$MSG_OBSOLETE."
|
||||
MSG_HELP_ogInstallMiniSetup="Instala un archivo que se ejecutará en el arranque de Windows."
|
||||
MSG_HELP_ogInstallRunonce="Crea archivo que se ejecutará en el inicio de un usuario administrador de Windows."
|
||||
MSG_HELP_ogInstallWindowsClient="$MSG_OBSOLETE."
|
||||
MSG_HELP_ogIsFormated="Comprueba si un sistema de archivos está formateado."
|
||||
MSG_HELP_ogIsImageLocked="Comprueba si una imagen está bloqueada por una operación de uso exclusivo."
|
||||
MSG_HELP_ogIsLocked="Comprueba si una partición o su disco están bloqueados por una operación de uso exclusivo."
|
||||
MSG_HELP_ogIsDiskLocked="Comprueba si un disco está bloqueado por una operación de uso exclusivo."
|
||||
MSG_HELP_ogIsMounted="Comprueba si un sistema de archivos está montado."
|
||||
MSG_HELP_ogIsNewerFile="Comprueba si un fichero es más nuevo (se ha modificado después) que otro."
|
||||
MSG_HELP_ogIsPartitionLocked=$MSG_HELP_ogIsLocked
|
||||
MSG_HELP_ogIsRepoLocked=""
|
||||
MSG_HELP_ogIsSyncImage="Comprueba si la imagen es sincronizable."
|
||||
MSG_HELP_ogIsVirtualMachine="Comprueba si el cliente es una máquina virtual"
|
||||
MSG_HELP_ogIsWritable="Comprueba si un sistema de archivos está montado con permiso de escritura."
|
||||
MSG_HELP_ogLinuxBootParameters="Devuelve los parámetros de arranque de un sistema operativo Linux instalado."
|
||||
MSG_HELP_ogListHardwareInfo="Lista el inventario de dispositivos del cliente."
|
||||
MSG_HELP_ogListLogicalPartitions="Lista las particiones lógicas de un disco"
|
||||
MSG_HELP_ogListPartitions="Lista la estructura de particiones de un disco."
|
||||
MSG_HELP_ogListPrimaryPartitions="Lista las particiones primarias de un disco"
|
||||
MSG_HELP_ogListRegistryKeys="Lista los nombres de las subclaves incluidas en una clave del registro de Windows."
|
||||
MSG_HELP_ogListRegistryValues="Lista los nombres de los valores incluidos en una clave del registro de Windows."
|
||||
MSG_HELP_ogListSoftware="Lista el inventario de programas instalados en un sistema operativo."
|
||||
MSG_HELP_ogLock="Bloquea una partición para operación de uso exclusivo."
|
||||
MSG_HELP_ogLockDisk="Bloquea un disco para operación de uso exclusivo."
|
||||
MSG_HELP_ogLockImage="Bloquea una imagen para operación de uso exclusivo."
|
||||
MSG_HELP_ogLockPartition=$MSG_HELP_ogLock
|
||||
MSG_HELP_ogMakeChecksumFile="Almacena la suma de comprobación de un fichero."
|
||||
MSG_HELP_ogMakeDir="Crea un directorio para OpenGnsys."
|
||||
MSG_HELP_ogMakeGroupDir="Crea el directorio de grupo (aula) en un repositorio."
|
||||
MSG_HELP_ogMcastReceiverFile=""
|
||||
MSG_HELP_ogMcastReceiverPartition=""
|
||||
MSG_HELP_ogMcastRequest=""
|
||||
MSG_HELP_ogMcastSendFile=""
|
||||
MSG_HELP_ogMcastSendPartition=""
|
||||
MSG_HELP_ogMcastSyntax=""
|
||||
MSG_HELP_ogMountCache="Monta el sistema de archivos dedicado a caché local."
|
||||
MSG_HELP_ogMountCdrom="Monta dispositivo óptico por defecto."
|
||||
MSG_HELP_ogMountFs=$MSG_HELP_ogMount
|
||||
MSG_HELP_ogMountImage="Monta una imagen sincronizable"
|
||||
MSG_HELP_ogMount="Monta un sistema de archivos y devuelve el punto de montaje."
|
||||
MSG_HELP_ogNvramActiveEntry="Configura a activa entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramAddEntry="Crea nueva entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramDeleteEntry="Borra entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramGetCurrent="Muestra la entrada del gestor de arranque (NVRAM) que ha iniciado el equipo."
|
||||
MSG_HELP_ogNvramGetNext="Muestra la entrada del gestor de arranque (NVRAM) que se utilizará en el próximo arranque."
|
||||
MSG_HELP_ogNvramGetOrder="Muestra el orden de las entradas del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramGetTimeout="Muestra el tiempo de espera del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramInactiveEntry="Configura a inactiva entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramList="Lista las entradas del gestor de arranque (NVRAN) marcando con un asterisco las activas"
|
||||
MSG_HELP_ogNvramPxeFirstEntry="Configura la tarjeta de red como primer arranque en la NVRAM."
|
||||
MSG_HELP_ogNvramSetNext="Configura el próximo arranque con la entrada del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramSetOrder="Configura el orden de las entradas del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogNvramSetTimeout="Configura el tiempo de espera del gestor de arranque (NVRAM)."
|
||||
MSG_HELP_ogRaiseError="Muestra y registra mensajes de error y devuelve el código correspondiente."
|
||||
MSG_HELP_ogReduceFs="Reduce el tamaño del sistema de archivos al mínimo ocupado por sus datos."
|
||||
MSG_HELP_ogReduceImage="Reduce el tamaño de la imagen"
|
||||
MSG_HELP_ogRefindDeleteEntry="Borra en rEFInd las entradas para el inicio en una particion."
|
||||
MSG_HELP_ogRefindDefaultEntry="Configura la entrada por defecto de rEFInd."
|
||||
MSG_HELP_ogRefindOgliveDefaultEntry="Configura la entrada de ogLive como la entrada por defecto de rEFInd."
|
||||
MSG_HELP_ogRefindSetTheme="Asigna un tema al rEFInd."
|
||||
MSG_HELP_ogRefindSetTimeOut="Define el tiempo (segundos) que se muestran las opciones de inicio de rEFInd."
|
||||
MSG_HELP_ogRefindSetResolution="Define la resolución que usuará el thema del gestor de arranque rEFInd."
|
||||
MSG_HELP_ogRefindInstall="Instala y configura el gestor rEFInd en la particion EFI"
|
||||
MSG_HELP_ogRestoreAclImage="Restaura las ACL de Windows (La informacion debe estar copiada en /tmp)."
|
||||
MSG_HELP_ogRestoreBootLoaderImage=""
|
||||
MSG_HELP_ogRestoreDiskImage="Restaura una imagen de un disco completo."
|
||||
MSG_HELP_ogRestoreEfiBootLoader="Copia el cargador de arranque de la partición de sistema a la partición EFI."
|
||||
MSG_HELP_ogRestoreImage="Restaura una imagen de sistema operativo."
|
||||
MSG_HELP_ogRestoreInfoImage="Restablece información del sistema: ACL y enlaces simbolicos"
|
||||
MSG_HELP_ogRestoreMbrImage="Restaura una imagen del sector de arranque (MBR)."
|
||||
MSG_HELP_ogRestoreUuidPartitions="Restaura los uuid de las particiones y la tabla de particiones."
|
||||
MSG_HELP_ogSaveImageInfo="Crea un fichero con la información de la imagen."
|
||||
MSG_HELP_ogSetLinuxName=""
|
||||
MSG_HELP_ogSetPartitionActive="Establece el número de partición activa de un disco."
|
||||
MSG_HELP_ogSetPartitionId="Modifica el tipo de una partición física usando el mnemónico del tipo."
|
||||
MSG_HELP_ogSetPartitionSize="Establece el tamaño de una partición."
|
||||
MSG_HELP_ogSetPartitionType="Modifica el identificador de tipo de una partición física."
|
||||
MSG_HELP_ogSetRegistryValue="Asigna un dato a un valor del registro de Windows."
|
||||
MSG_HELP_ogSetWindowsName="Asigna el nombre del cliente en el registro de Windows."
|
||||
MSG_HELP_ogSetWinlogonUser="Asigna el nombre de usuario por defecto para el gestor de entrada de Windows."
|
||||
MSG_HELP_ogSyncCreate="Sincroniza los datos de la partición a la imagen"
|
||||
MSG_HELP_ogSyncRestore="Sincroniza los datos de la imagen a la partición"
|
||||
MSG_HELP_ogTorrentStart=""
|
||||
MSG_HELP_ogTypeToId="Devuelve el identificador asociado al mnemónico de tipo de partición."
|
||||
MSG_HELP_ogUcastReceiverPartition=""
|
||||
MSG_HELP_ogUcastSendFile=""
|
||||
MSG_HELP_ogUcastSendPartition=""
|
||||
MSG_HELP_ogUcastSyntax=""
|
||||
MSG_HELP_ogUnhidePartition="Hace visible una partición de Windows."
|
||||
MSG_HELP_ogUninstallLinuxClient="Desinstala el antiguo cliente OpenGnSys en un sistema operativo Linux."
|
||||
MSG_HELP_ogUninstallWindowsClient="Desinstala el antiguo cliente OpenGnSys en un sistema operativo Windows."
|
||||
MSG_HELP_ogUnlock="Desbloquea una partición tras finalizar una operación de uso exclusivo."
|
||||
MSG_HELP_ogUnlockDisk="Desbloquea un disco tras finalizar una operación de uso exclusivo."
|
||||
MSG_HELP_ogUnlockImage="Desbloquea una imagen tras finalizar una operación de uso exclusivo."
|
||||
MSG_HELP_ogUnlockPartition=$MSG_HELP_ogUnlock
|
||||
MSG_HELP_ogUnmountAll="Desmonta todos los sistemas de archivos."
|
||||
MSG_HELP_ogUnmountCache="Desmonta el sistema de archivos de caché local."
|
||||
MSG_HELP_ogUnmount="Desmonta un sistema de archivos."
|
||||
MSG_HELP_ogUnmountFs=$MSG_HELP_ogUnmount
|
||||
MSG_HELP_ogUnmountImage="Desmonta la imagen."
|
||||
MSG_HELP_ogUnsetDirtyBit=""
|
||||
MSG_HELP_ogUpdateCacheIsNecesary="Comprueba si es necesario actualizar una archivo en la cache local."
|
||||
MSG_HELP_ogUpdatePartitionTable="Actualiza información de la tabla de particiones del disco."
|
||||
MSG_HELP_ogUuidChange="Reemplaza el UUID de un sistema de ficheros."
|
||||
MSG_HELP_ogWaitSyncImage=""
|
||||
MSG_HELP_ogWindowsBootParameters=""
|
||||
MSG_HELP_ogWindowsRegisterPartition=""
|
||||
|
||||
# Scripts
|
||||
MSG_HELP_configureOs="Post-configura de arranque del sistema"
|
||||
MSG_HELP_createBaseImage="Genera imagen básica de la partición"
|
||||
MSG_HELP_createDiffImage="Genera imagen diferencial de la partición respecto a la imagen básica"
|
||||
MSG_HELP_installOfflineMode="Prepara el equipo cliente para el modo offline."
|
||||
MSG_HELP_partclone2sync="Convierte imagen de partclone en imagen sincronizable."
|
||||
MSG_HELP_restoreBaseImage="Restaura una imagen básica en una partición"
|
||||
MSG_HELP_restoreDiffImage="Restaura una imagen diferencial en una partición"
|
||||
MSG_HELP_updateCache="Realiza la actualización de la caché"
|
||||
|
||||
# Mensajes de descripción breve de la interfaz.
|
||||
MSG_INTERFACE_START="[START Interface] Ejecutar comando: "
|
||||
MSG_INTERFACE_END="[END Interface] Comando terminado con este código: "
|
||||
|
||||
# Mensajes de scripts.
|
||||
MSG_SCRIPTS_START=" INICIO scripts: "
|
||||
MSG_SCRIPTS_END=" FIN scripts: "
|
||||
MSG_SCRIPTS_TASK_END="Fin de la tarea"
|
||||
|
||||
MSG_SCRIPTS_TASK_SLEEP="Esperando para iniciar"
|
||||
MSG_SCRIPTS_TASK_START="Iniciando"
|
||||
MSG_SCRIPTS_TASK_ERR="Error"
|
||||
|
||||
# Script createImage.
|
||||
MSG_SCRIPTS_FILE_RENAME=" Renombrar fichero-imagen previo: "
|
||||
MSG_SCRIPTS_CREATE_SIZE=" Calcular espacio (KB) requerido para almacenarlo y el disponible: "
|
||||
|
||||
# Script updateCache.
|
||||
MSG_SCRIPTS_UPDATECACHE_DOUPDATE="Comprobar si es necesario actualizar el fichero imagen "
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZECACHE="Comprobar que el tamaño de la caché es mayor que el fichero a descargar."
|
||||
# Script updateCache: para las imágenes sincronizadas tipo dir.
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZEDIR="Calcular el tamaño de la imagen."
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKSIZEIMG="Comprobar si la imagen del repositorio es mayor que la de la caché."
|
||||
MSG_SCRIPTS_UPDATECACHE_IFNOTCACHEDO="Comprobar el espacio libre de la caché y actuar según engine.cfg"
|
||||
|
||||
MSG_SCRIPTS_UPDATECACHE_CHECKMCASTSESSION="Comprobando sesión Multicast: ServidorMcast:PuertoDatos"
|
||||
|
||||
# interface sustituye temporalmente al scritp restore
|
||||
MSG_SCRIPTS_CHECK_ENGINE="Analizar proceso a realizar según engine.cfg"
|
||||
MSG_SCRIPTS_MULTICAST_PRECHECK_PORT="Determinar puerto principal y auxiliar Multicast."
|
||||
MSG_SCRIPTS_MULTICAST_CHECK_PORT="Comprobar puertos de sesión y datos"
|
||||
MSG_SCRIPTS_MULTICAST_REQUEST_PORT="Solicitar la apertura: "
|
||||
MSG_SCRIPTS_OS_CONFIGURE="Iniciar la configuración del sistema restaurado"
|
||||
|
||||
# TIME MESSAGES
|
||||
MSG_SCRIPTS_TIME_TOTAL="tiempo total del proceso"
|
||||
MSG_SCRIPTS_TIME_PARTIAL="tiempo parcial del subproceso"
|
||||
|
||||
# HTTPLOG
|
||||
MSG_HTTPLOG_NOUSE="No apague este ordenador por favor"
|
||||
|
||||
# Mensajes sincronizadas
|
||||
MSG_SYNC_RESIZE="Redimensiona la imagen al tamaño necesario"
|
||||
MSG_SYNC_RESTORE="Trae el listado ficheros y baja la imagen"
|
||||
MSG_SYNC_DELETE="Diferencial: Borra archivos antiguos"
|
||||
MSG_SYNC_SLEEP="Espera que se monte/reduzca la imagen"
|
||||
# Mensajes sincronizadas complementarios a errores
|
||||
MSG_SYNC_DIFFERENTFS="El sistema de ficheros de destino no coincide con el de la imagen"
|
||||
MSG_SYNC_EXTENSION="Las extensiones de la imagenes deben ser img o diff"
|
||||
MSG_SYNC_NOCHECK="La imagen esta montada por otro proceso, no podemos comprobarla"
|
||||
|
||||
MSG_RESTORE="Restaura la imagen en"
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Cargar entorno de OpenGnsys
|
||||
set -a
|
||||
source /opt/opengnsys/etc/preinit/loadenviron.sh
|
||||
|
||||
# Scripts de inicio.
|
||||
for f in fileslinks loadmodules metadevs mountrepo poweroff otherservices; do
|
||||
$OGETC/preinit/$f.sh
|
||||
done
|
||||
unset f
|
||||
|
||||
if [ -f $OGETC/init/$IPV4ADDR.sh ]; then
|
||||
$OGETC/init/$OG_IP.sh
|
||||
|
||||
elif [ -f $OGETC/init/$OGGROUP.sh ]; then
|
||||
$OGETC/init/$OGGROUP.sh
|
||||
|
||||
elif [ -f $OGETC/init/default.sh ]; then
|
||||
$OGETC/init/default.sh
|
||||
|
||||
else
|
||||
echo "No se ha encontrado script de inicio"
|
||||
halt
|
||||
fi
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file fileslinks.sh
|
||||
#@brief Script de inicio para copiar ficheros y deinir enlaces simbólicos.
|
||||
#@warning License: GNU GPLv3+
|
||||
#@version 0.9
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-10-10
|
||||
#@version 1.0.5 - Enlace para librería libmac (obsoleto en versión 1.1.1).
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2012-06-28
|
||||
#@version 1.1.2 - Autenticación con clave pública para SSH
|
||||
#@author Irina Gómez, ETSII Universidad de Sevilla
|
||||
#@date 2019-09-25
|
||||
#*/
|
||||
|
||||
|
||||
# Si está configurado OpenGnsys ...
|
||||
if [ -n "$OPENGNSYS" ]; then
|
||||
echo "${MSG_MAKELINKS:-.}"
|
||||
|
||||
# Shell BASH por defecto (para usar "runtest")
|
||||
ln -fs /bin/bash /bin/sh 2>/dev/null
|
||||
|
||||
# Crear directorio de bloqueos
|
||||
mkdir -p /var/lock 2>/dev/null || mkdir -p /run/lock
|
||||
|
||||
# Crear ficheros temporales.
|
||||
touch $OGLOGCOMMAND $OGLOGCOMMAND.tmp $OGLOGSESSION /tmp/menu.tmp
|
||||
chmod 777 $OGLOGCOMMAND $OGLOGCOMMAND.tmp $OGLOGSESSION /tmp/menu.tmp
|
||||
|
||||
# Enlaces para Qt Embeded.
|
||||
QTDIR="/usr/local"
|
||||
mkdir -p $QTDIR/{etc,lib,plugins}
|
||||
for i in $OGLIB/qtlib/* $OGLIB/fonts; do
|
||||
[ -f $QTDIR/lib/$i ] || ln -fs $i $QTDIR/lib 2>/dev/null
|
||||
done
|
||||
for i in $OGLIB/qtplugins/*; do
|
||||
[ -f $QTDIR/plugins/$i ] || ln -fs $i $QTDIR/plugins 2>/dev/null
|
||||
done
|
||||
for i in $OGETC/*.qmap; do
|
||||
[ -f $QTDIR/etc/$i ] || ln -fs $i $QTDIR/etc 2>/dev/null
|
||||
done
|
||||
|
||||
# Autenticación con clave pública para SSH
|
||||
[ -f /scripts/ssl/authorized_keys ] && cp /scripts/ssl/* /root/.ssh
|
||||
|
||||
else
|
||||
# FIXME Error: entorno de OpenGnsys no configurado.
|
||||
echo "Error: OpenGnsys environment is not configured." # FIXME: definir mensaje.
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file loadenviron.sh
|
||||
#@brief Script de carga de la API de funciones de OpenGnsys.
|
||||
#@warning License: GNU GPLv3+
|
||||
#@version 0.9
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-10-10
|
||||
#@version 1.0.3 - Limpiar código y configuración modo off-line
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2012-01-12
|
||||
#@version 1.0.5 - Compatibilidad para usar proxy y servidor DNS.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2014-04-23
|
||||
#*/
|
||||
|
||||
# Idioma por defecto.
|
||||
export LANG="${LANG:-es_ES}"
|
||||
locale-gen $LANG
|
||||
|
||||
# Directorios del proyecto OpenGnsys.
|
||||
export OPENGNSYS="${OPENGNSYS:-/opt/opengnsys}"
|
||||
if [ -d $OPENGNSYS ]; then
|
||||
export OGBIN=$OPENGNSYS/bin
|
||||
export OGETC=$OPENGNSYS/etc
|
||||
export OGLIB=$OPENGNSYS/lib
|
||||
export OGAPI=$OGLIB/engine/bin
|
||||
export OGSCRIPTS=$OPENGNSYS/scripts
|
||||
export OGIMG=$OPENGNSYS/images
|
||||
export OGCAC=$OPENGNSYS/cache
|
||||
export OGLOG=$OPENGNSYS/log
|
||||
|
||||
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/opt/oglive/rootfs/opt/drbl/sbin
|
||||
|
||||
export PATH=$OGSCRIPTS:$PATH:$OGAPI:$OGBIN
|
||||
|
||||
# Exportar parámetros del kernel.
|
||||
for i in $(cat /proc/cmdline); do
|
||||
echo $i | grep -q "=" && export $i
|
||||
done
|
||||
|
||||
# Cargar fichero de idioma.
|
||||
LANGFILE=$OGETC/lang.${LANG%@*}.conf
|
||||
if [ -f $LANGFILE ]; then
|
||||
source $LANGFILE
|
||||
for i in $(awk -F= '{if (NF==2) print $1}' $LANGFILE); do
|
||||
export $i
|
||||
done
|
||||
fi
|
||||
# Mensaje de carga del entorno.
|
||||
echo "${MSG_LOADAPI:-.}"
|
||||
|
||||
# Cargar mapa de teclado.
|
||||
loadkeys ${LANG%_*} >/dev/null
|
||||
|
||||
# Cargar API de funciones.
|
||||
for i in $OGAPI/*.lib; do
|
||||
source $i
|
||||
done
|
||||
|
||||
for i in $(typeset -F | cut -f3 -d" "); do
|
||||
export -f $i
|
||||
done
|
||||
|
||||
# Cargar configuración del engine.
|
||||
[ -f ${OGETC}/engine.cfg ] && source ${OGETC}/engine.cfg
|
||||
export OGLOGCOMMAND=${OGLOGCOMMAND:-/tmp/command.log}
|
||||
export OGLOGSESSION=${OGLOGSESSION:-/tmp/session.log}
|
||||
|
||||
# Cargar las APIs según engine.
|
||||
if [ -n "$ogengine" ]; then
|
||||
for i in $OGAPI/*.$ogengine; do
|
||||
[ -f $i ] && source $i
|
||||
done
|
||||
fi
|
||||
|
||||
# Configuración de la red (modo offline).
|
||||
eval $(grep "^DEVICECFG=" /tmp/initrd.cfg 2>/dev/null)
|
||||
if [ -n "$DEVICECFG" ]; then
|
||||
export DEVICECFG
|
||||
[ -f $DEVICECFG ] && source $DEVICECFG
|
||||
fi
|
||||
|
||||
# FIXME Pruebas para grupos de ordenadores
|
||||
export OGGROUP="$group"
|
||||
|
||||
ROOTREPO=${ROOTREPO:-"$OGSERVERIMAGES"}
|
||||
|
||||
# Fichero de registros.
|
||||
export OGLOGFILE="$OGLOG/$(ogGetIpAddress).log"
|
||||
fi
|
||||
|
||||
# Compatibilidad para usar proxy en clientes ogLive.
|
||||
[ -z "$http_proxy" -a -n "$ogproxy" ] && export http_proxy="$ogproxy"
|
||||
|
||||
# Compatibilidad para usar servidor DNS en clientes ogLive.
|
||||
if [ ! -f /run/resolvconf/resolv.conf -a -n "$ogdns" ]; then
|
||||
mkdir -p /run/resolvconf
|
||||
echo "nameserver $ogdns" > /run/resolvconf/resolv.conf
|
||||
fi
|
||||
|
||||
# Declaración de códigos de error.
|
||||
export OG_ERR_FORMAT=1 # Formato de ejecución incorrecto.
|
||||
export OG_ERR_NOTFOUND=2 # Fichero o dispositivo no encontrado.
|
||||
export OG_ERR_PARTITION=3 # Error en partición de disco.
|
||||
export OG_ERR_LOCKED=4 # Partición o fichero bloqueado.
|
||||
export OG_ERR_IMAGE=5 # Error al crear o restaurar una imagen.
|
||||
export OG_ERR_NOTOS=6 # Sin sistema operativo.
|
||||
export OG_ERR_NOTEXEC=7 # Programa o función no ejecutable.
|
||||
# Códigos 8-13 reservados por ogAdmClient.h
|
||||
export OG_ERR_NOTWRITE=14 # No hay acceso de escritura
|
||||
export OG_ERR_NOTCACHE=15 # No hay particion cache en cliente
|
||||
export OG_ERR_CACHESIZE=16 # No hay espacio en la cache para almacenar fichero-imagen
|
||||
export OG_ERR_REDUCEFS=17 # Error al reducir sistema archivos
|
||||
export OG_ERR_EXTENDFS=18 # Error al expandir el sistema de archivos
|
||||
export OG_ERR_OUTOFLIMIT=19 # Valor fuera de rango o no válido.
|
||||
export OG_ERR_FILESYS=20 # Sistema de archivos desconocido o no se puede montar
|
||||
export OG_ERR_CACHE=21 # Error en partición de caché local
|
||||
export OG_ERR_NOGPT=22 # El disco indicado no contiene una particion GPT
|
||||
export OG_ERR_REPO=23 # Error al montar el repositorio de imagenes
|
||||
export OG_ERR_NOMSDOS=24 # El disco indicado no contienen una particion MSDOS
|
||||
|
||||
export OG_ERR_IMGSIZEPARTITION=30 # Error al restaurar partición más pequeña que la imagen
|
||||
export OG_ERR_UPDATECACHE=31 # Error al realizar el comando updateCache
|
||||
export OG_ERR_DONTFORMAT=32 # Error al formatear
|
||||
export OG_ERR_IMAGEFILE=33 # Archivo de imagen corrupto o de otra versión de $IMGPROG
|
||||
export OG_ERR_GENERIC=40 # Error imprevisto no definido
|
||||
export OG_ERR_UCASTSYNTAXT=50 # Error en la generación de sintaxis de transferenica UNICAST
|
||||
export OG_ERR_UCASTSENDPARTITION=51 # Error en envío UNICAST de partición
|
||||
export OG_ERR_UCASTSENDFILE=52 # Error en envío UNICAST de un fichero
|
||||
export OG_ERR_UCASTRECEIVERPARTITION=53 # Error en la recepcion UNICAST de una particion
|
||||
export OG_ERR_UCASTRECEIVERFILE=54 # Error en la recepcion UNICAST de un fichero
|
||||
export OG_ERR_MCASTSYNTAXT=55 # Error en la generacion de sintaxis de transferenica Multicast.
|
||||
export OG_ERR_MCASTSENDFILE=56 # Error en envio MULTICAST de un fichero
|
||||
export OG_ERR_MCASTRECEIVERFILE=57 # Error en la recepcion MULTICAST de un fichero
|
||||
export OG_ERR_MCASTSENDPARTITION=58 # Error en envio MULTICAST de una particion
|
||||
export OG_ERR_MCASTRECEIVERPARTITION=59 # Error en la recepcion MULTICAST de una particion
|
||||
export OG_ERR_PROTOCOLJOINMASTER=60 # Error en la conexion de una sesion UNICAST|MULTICAST con el MASTER
|
||||
|
||||
export OG_ERR_DONTMOUNT_IMAGE=70 # Error al montar una imagen sincronizada.
|
||||
export OG_ERR_DONTSYNC_IMAGE=71 # Imagen no sincronizable (es monolitica)
|
||||
export OG_ERR_DONTUNMOUNT_IMAGE=72 # Error al desmontar la imagen
|
||||
export OG_ERR_NOTDIFFERENT=73 # No se detectan diferencias entre la imagen basica y la particion.
|
||||
export OG_ERR_SYNCHRONIZING=74 # Error al sincronizar, puede afectar la creacion/restauracion de la imagen
|
||||
|
||||
export OG_ERR_NOTUEFI=80 # La interfaz UEFI no está activa
|
||||
export OG_ERR_NOTBIOS=81 # La interfaz BIOS legacy no está activa
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file loadmodules.sh
|
||||
#@brief Script de inicio para cargar módulos complementarios del kernel.
|
||||
#@version 1.0
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-01-26
|
||||
#@version 1.0.5 - Cargar módulos específicos para el cliente.
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2013-11-11
|
||||
#*/
|
||||
|
||||
|
||||
echo "${MSG_LOADMODULES:-.}"
|
||||
|
||||
# Módulo del ratón.
|
||||
modprobe psmouse 2>/dev/null
|
||||
|
||||
# Cargar módulos específicos del kernel del cliente.
|
||||
for m in $OGLIB/modules/$(uname -r)/*.ko; do
|
||||
[ -r $m ] && insmod $m &>/dev/null
|
||||
done
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file metadevs.sh
|
||||
#@brief Script de inicio para detectar metadispositivos LVM y RAID.
|
||||
#@note Desglose del script "loadenviron.sh".
|
||||
#@warning License: GNU GPLv3+
|
||||
#@version 0.9
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-10-10
|
||||
#@version 0.9.4
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2010-04-19
|
||||
#*/
|
||||
|
||||
|
||||
# Si está configurado OpenGnsys ...
|
||||
if [ -n "$OPENGNSYS" ]; then
|
||||
echo "$MSG_DETECTLVMRAID"
|
||||
# Detectar metadispositivos LVM.
|
||||
vgchange -ay &>/dev/null
|
||||
# Detectar metadispositivos RAID.
|
||||
dmraid -ay &>/dev/null
|
||||
else
|
||||
# FIXME Error: entorno de OpenGnsys no configurado.
|
||||
echo "Error: OpenGnsys environment is not configured." # FIXME: definir mensaje.
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file mountrepo.sh
|
||||
#@brief Script para montar el repositorio de datos remoto.
|
||||
#@warning License: GNU GPLv3+
|
||||
#@version 1.0
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-03-17
|
||||
#*/
|
||||
|
||||
OGIMG=${OGIMG:-/opt/opengnsys/images}
|
||||
ROOTREPO=${ROOTREPO:-"$ROOTSERVER"}
|
||||
|
||||
# TODO Revisar proceso de arranque para no montar 2 veces el repositorio.
|
||||
if [ "$ogactiveadmin" == "true" ]; then
|
||||
export boot=admin # ATENCIÓN: siempre en modo "admin".
|
||||
umount $OGIMG 2>/dev/null
|
||||
|
||||
protocol=${ogprotocol:-"smb"}
|
||||
[ "$ogunit" != "" ] && OGUNIT="/$ogunit"
|
||||
printf "$MSG_MOUNTREPO\n" "$protocol" "$boot"
|
||||
case "$ogprotocol" in
|
||||
nfs) mount.nfs ${ROOTREPO}:$OGIMG$OGUNIT $OGIMG -o rw,nolock ;;
|
||||
smb) PASS=$(grep "^[ ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 | \
|
||||
sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/')
|
||||
PASS=${PASS:-"og"}
|
||||
mount.cifs //${ROOTREPO}/ogimages$OGUNIT $OGIMG -o rw,serverino,acl,username=opengnsys,password=$PASS
|
||||
;;
|
||||
local) # TODO: hacer funcion dentro de este script que monte smb
|
||||
# Comprobamos que estatus sea online.
|
||||
if [ "$ogstatus" == "offline" -o "$SERVER" == "" ]; then
|
||||
# Si estatus es offline buscamos un dispositivo con etiqueta repo
|
||||
# y si no existe montamos la cache como repo (si existe).
|
||||
TYPE=$(blkid | grep REPO | awk -F"TYPE=" '{print $2}' | tr -d \")
|
||||
if [ "$TYPE" == "" ]; then
|
||||
[ -d $OGCAC/$OGIMG ] && mount --bind $OGCAC/$OGIMG $OGIMG
|
||||
else
|
||||
mount -t $TYPE LABEL=REPO $OGIMG &>/dev/null
|
||||
fi
|
||||
else
|
||||
# Comprobamos que existe un servicio de samba.
|
||||
smbclient -L $SERVER -N &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
PASS=$(grep "^[ ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 | \
|
||||
sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/')
|
||||
PASS=${PASS:-"og"}
|
||||
mount.cifs //${ROOTREPO}/ogimages $OGIMG -o rw,serverino,acl,username=opengnsys,password=$PASS
|
||||
fi
|
||||
# TODO: buscar condicion para NFS
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file otherservices.sh
|
||||
#@brief Script de inicio para cargar otros servicios complementarios.
|
||||
#@version 1.0.3
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2012-01-12
|
||||
#*/
|
||||
|
||||
|
||||
# Lanzar servicios complementarios del cliente.
|
||||
echo "${MSG_OTHERSERVICES:-.}"
|
||||
|
||||
# Iniciar rsyslog, si es necesario.
|
||||
[ -S /dev/log ] || service rsyslog start
|
||||
|
||||
# Adpatar la clave de "root" para acceso SSH.
|
||||
PASS=$(grep "^[ ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 | \
|
||||
sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/')
|
||||
PASS=${PASS:-"og"}
|
||||
echo -ne "$PASS\n$PASS\n" | passwd root 2>/dev/null
|
||||
# Cargar el entorno OpenGnsys en conexión SSH.
|
||||
cp -a $OPENGNSYS/etc/preinit/loadenviron.sh /etc/profile.d/
|
||||
# Arrancar SSH.
|
||||
/etc/init.d/ssh start &>/dev/null
|
||||
|
||||
# Desactivado apagado de monitor.
|
||||
#setterm -blank 0 -powersave off -powerdown 0 < /dev/console > /dev/console 2>&1
|
||||
|
||||
# Activado WOL en la interfaz usada en arranque PXE.
|
||||
ethtool -s $DEVICE wol g 2>/dev/null
|
||||
|
||||
# TODO Localizar correctamente el script de arranque.
|
||||
[ -f /opt/opengnsys/scripts/runhttplog.sh ] && /opt/opengnsys/scripts/runhttplog.sh 2>/dev/null
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
#/**
|
||||
#@file poweroff.sh
|
||||
#@brief Script de inicio para cargar el proceso comprobación de clientes inactivos.
|
||||
#@note Arranca y configura el proceso "cron".
|
||||
#@warning License: GNU GPLv3+
|
||||
#@version 1.0.2
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2011-10-25
|
||||
#*/
|
||||
|
||||
|
||||
# Si está configurado OpenGnsys ...
|
||||
if [ -n "$OPENGNSYS" ]; then
|
||||
echo "${MSG_POWEROFFCONF:-.}"
|
||||
|
||||
# Sincronización horaria con servidor NTP.
|
||||
[ -n "$ogntp" -a "$status" != "offline" ] && ntpdate $ogntp
|
||||
|
||||
# Crear fichero de configuración por defecto (30 min. de espera).
|
||||
POWEROFFCONF=/etc/poweroff.conf
|
||||
cat << FIN > $POWEROFFCONF
|
||||
POWEROFFSLEEP=30
|
||||
POWEROFFTIME=
|
||||
FIN
|
||||
# Incluir zona horaria en el fichero de configuración.
|
||||
awk 'BEGIN {RS=" "} /^TZ=/ {print}' /proc/cmdline >> $POWEROFFCONF
|
||||
|
||||
# Lanzar el proceso "cron".
|
||||
cron -l
|
||||
|
||||
# Definir la "crontab" lanzando el proceso de comprobación cada minuto.
|
||||
echo "* * * * * [ -x $OGBIN/poweroffconf ] && $OGBIN/poweroffconf" | crontab -
|
||||
|
||||
else
|
||||
# FIXME Error: entorno de OpenGnsys no configurado.
|
||||
echo "Error: OpenGnsys environment is not configured." # FIXME: definir mensaje.
|
||||
exit 1
|
||||
fi
|
||||
|
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 73 KiB |
|
@ -0,0 +1,79 @@
|
|||
include "theme"
|
||||
|
||||
screen {
|
||||
background = "$$/background.png"
|
||||
|
||||
panel {
|
||||
halign = center
|
||||
attach_vcenter = 0
|
||||
height = 19
|
||||
# Flip so the cursor defaults to the main menu
|
||||
direction = bottom_to_top
|
||||
|
||||
### Main Menu ###
|
||||
panel {
|
||||
height = 15
|
||||
max_width = 120
|
||||
margin_top = 1
|
||||
class = container-body
|
||||
# No need for a min width and centering panel because extended width > min width
|
||||
|
||||
direction = left_to_right
|
||||
anchor = 1
|
||||
id = __menu__
|
||||
}
|
||||
|
||||
panel {
|
||||
height = 4
|
||||
width = 100%
|
||||
class = container-title
|
||||
|
||||
direction = left_to_right
|
||||
|
||||
image {
|
||||
image = "$$/images/txt-select.png"
|
||||
attach_top = 0
|
||||
attach_left = 0
|
||||
}
|
||||
|
||||
### Tools Menu ###
|
||||
image {
|
||||
attach_right = 2
|
||||
image = "$$/images/button-tools.png:$$/images/button-tools-hover.png"
|
||||
command = "menu_popup tools_menu"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### Progress Bar ###
|
||||
panel {
|
||||
halign = center
|
||||
attach_vcenter = 20
|
||||
width = 80
|
||||
class = progressbar-background
|
||||
id = __timeout__
|
||||
|
||||
progressbar { }
|
||||
}
|
||||
}
|
||||
|
||||
template_menuitem {
|
||||
panel {
|
||||
width = 40
|
||||
height = 12
|
||||
|
||||
parameters = "class=image.class:title=panel.text.text"
|
||||
|
||||
image {
|
||||
attach_vcenter = 0
|
||||
attach_hcenter = 0
|
||||
}
|
||||
|
||||
panel {
|
||||
attach_vcenter = 0
|
||||
attach_hcenter = 0
|
||||
class = text-line
|
||||
text { font = "Helvetica Regular 22" }
|
||||
}
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,21 @@
|
|||
+class
|
||||
{
|
||||
-opengnsys { image = "$$/normal_opengnsys.png:$$/hover_opengnsys.png" }
|
||||
-windows10 { image = "$$/normal_windows10.png:$$/hover_windows10.png" }
|
||||
-windows7 { image = "$$/normal_windows7.png:$$/hover_windows7.png" }
|
||||
-windows { image = "$$/normal_windows.png:$$/hover_windows.png" }
|
||||
-elementary { image = "$$/normal_elementary.png:$$/hover_elementary.png" }
|
||||
-elementaryos { image = "$$/normal_elementary.png:$$/hover_elementary.png" }
|
||||
-recovery { image = "$$/normal_recovery.png:$$/hover_recovery.png" }
|
||||
-shutdown { image = "$$/normal_shutdown.png:$$/hover_shutdown.png" }
|
||||
-restart { image = "$$/normal_restart.png:$$/hover_restart.png" }
|
||||
-linux { image = "$$/normal_linux.png:$$/hover_linux.png" }
|
||||
-ubuntu { image = "$$/normal_ubuntu.png:$$/hover_ubuntu.png" }
|
||||
-debian { image = "$$/normal_debian.png:$$/hover_debian.png" }
|
||||
-suse { image = "$$/normal_opensuse.png:$$/hover_opensuse.png" }
|
||||
-freebsd { image = "$$/normal_freebsd.png:$$/hover_freebsd.png" }
|
||||
-macosx { image = "$$/normal_osx.png:$$/hover_osx.png" }
|
||||
-haiku { image = "$$/normal_haiku.png:$$/hover_haiku.png" }
|
||||
-image { image = "$$/normal_os.png:$$/hover_os.png" }
|
||||
-os { image = "$$/normal_os.png:$$/hover_os.png" }
|
||||
}
|
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 109 B |
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 525 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 725 B |
After Width: | Height: | Size: 562 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 154 B |
After Width: | Height: | Size: 154 B |
After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 148 B |