]> git.sur5r.net Git - bacula/rescue/commitdiff
Add new usb rescue key code
authorKern Sibbald <kern@sibbald.com>
Mon, 28 Jun 2010 08:47:37 +0000 (10:47 +0200)
committerKern Sibbald <kern@sibbald.com>
Mon, 28 Jun 2010 08:47:37 +0000 (10:47 +0200)
56 files changed:
rescue/linux/usb/COPYING [new file with mode: 0644]
rescue/linux/usb/LICENSE [new file with mode: 0644]
rescue/linux/usb/README.restore [new file with mode: 0644]
rescue/linux/usb/README.save [new file with mode: 0644]
rescue/linux/usb/README.usb [new file with mode: 0644]
rescue/linux/usb/TODO [new file with mode: 0644]
rescue/linux/usb/config [new file with mode: 0644]
rescue/linux/usb/config2 [new file with mode: 0644]
rescue/linux/usb/copy_bacula-rescue_to_key [new file with mode: 0755]
rescue/linux/usb/get_files.sh [new file with mode: 0755]
rescue/linux/usb/how_to_create_a_new_usb_key.txt [new file with mode: 0644]
rescue/linux/usb/original-partitioning.txt [new file with mode: 0644]
rescue/linux/usb/partition_usb_key [new file with mode: 0755]
rescue/linux/usb/src/bin/README [new file with mode: 0644]
rescue/linux/usb/src/bin/Xdialog [new file with mode: 0755]
rescue/linux/usb/src/bin/dialog [new file with mode: 0755]
rescue/linux/usb/src/scripts/ans [new file with mode: 0644]
rescue/linux/usb/src/scripts/bcon [new file with mode: 0644]
rescue/linux/usb/src/scripts/chrootscript [new file with mode: 0755]
rescue/linux/usb/src/scripts/client [new file with mode: 0644]
rescue/linux/usb/src/scripts/dial [new file with mode: 0644]
rescue/linux/usb/src/scripts/dialognetworkorig [new file with mode: 0644]
rescue/linux/usb/src/scripts/findraidevice/findraid_new [new file with mode: 0755]
rescue/linux/usb/src/scripts/formatallscript [new file with mode: 0755]
rescue/linux/usb/src/scripts/fullrestorescript [new file with mode: 0755]
rescue/linux/usb/src/scripts/get_serial [new file with mode: 0755]
rescue/linux/usb/src/scripts/getdiskinfo [new file with mode: 0755]
rescue/linux/usb/src/scripts/mntinfo [new file with mode: 0644]
rescue/linux/usb/src/scripts/new_baklient_conf [new file with mode: 0755]
rescue/linux/usb/src/scripts/partitionscript [new file with mode: 0755]
rescue/linux/usb/src/scripts/release_raids [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/all_raids_there [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/change_names_new [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/check_lvm [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/checkdiffnew2 [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/checkraid [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/choosedisk [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/clientdir [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/dial [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/diskorpart [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/do_lvm [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/full_disk [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/get_serial_restore [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/lvm [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/main [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/newsize [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/part [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/raid [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/raid_check_ifdev [new file with mode: 0644]
rescue/linux/usb/src/scripts/restore/restoredebut [new file with mode: 0755]
rescue/linux/usb/src/scripts/restore/warning [new file with mode: 0755]
rescue/linux/usb/src/scripts/start_network [new file with mode: 0755]
rescue/linux/usb/src/scripts/unmount-all [new file with mode: 0644]
rescue/linux/usb/src/scripts/x_or_shell [new file with mode: 0755]
rescue/linux/usb/src/start_bacula_rescue [new file with mode: 0755]
rescue/linux/usb/src/start_rescue [new file with mode: 0755]

diff --git a/rescue/linux/usb/COPYING b/rescue/linux/usb/COPYING
new file mode 100644 (file)
index 0000000..5ebdb6b
--- /dev/null
@@ -0,0 +1,5 @@
+
+Copyright (C) 2009-2010 Bacula Systems SA
+
+Please see the file LICENSE concerning the terms of the license,
+copying and such.
diff --git a/rescue/linux/usb/LICENSE b/rescue/linux/usb/LICENSE
new file mode 100644 (file)
index 0000000..6de3ff8
--- /dev/null
@@ -0,0 +1,529 @@
+
+Trademark:
+The name Bacula is a registered trademark of Kern Sibbald.
+
+===================================
+
+License:
+For the most part, Bacula is licensed under the GPL version 2. This
+code is listed under Copyright Bacula Systems SA
+What follows is the addition(s) to the GPL version 2 license, that
+applies to code that is copyrighted by Bacula Systems SA
+Europe e.V.
+
+Linking: 
+As a special exception to the GPLv2, the Bacula Systems SA gives
+permission to link the code of its release of Bacula with the OpenSSL
+project's "OpenSSL" library (or with modified versions of it that use
+the same license as the "OpenSSL" library), and distribute the linked
+executables.  You must obey the GNU General Public License in all
+respects for all of the code used other than "OpenSSL".
+
+As a special exception to the GPLv2, the Bacula Systems SA gives
+permission to link the code of its release of the Bacula Win32 File
+daemon with the Microsoft supplied Volume Shadow Copy (VSS) libraries
+and distribute the linked executables.  You must obey the GNU General
+Public License in all respects for all of the code used other than for
+the Microsoft VSS code, where you must obey their license terms.
+
+The Bacula Systems SA gives permission for plugins with GPLv2 compatible
+licenses to be loaded and distributed with the Bacula executables as
+long as the combined work is distributed under the terms listed in the 
+Bacula LICENSE file.  A full list of GPLv2 compatible licenses can be
+found at: http://www.fsf.org/licensing/licenses/.  If you wish to load
+or distribute plugins with different licensing terms please contact
+the Bacula Systems SA at: license@baculasystems.com
+             
+===================================
+
+
+What follows is information from the authors of the code:
+
+License:
+To the best of our knowledge, all code used in Bacula, which is 
+copyrighted by a third party, has licenses that are compatible
+with the OpenSSL license, and so given the exception that we have 
+made to the GPLv2 above, Bacula can be freely linked and distributed
+with the OpenSSL libraries.
+
+Intellectual Property rights:
+Recipient understands that although each Contributor to Bacula grants
+the licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity.
+Each Contributor disclaims any liability to Recipient for claims
+brought by any other entity based on infringement of intellectual
+property rights or otherwise.  As a condition to exercising the rights
+and licenses granted hereunder, each Recipient hereby assumes sole
+responsibility to secure any other intellectual property rights
+needed, if any.  For example, if a third party patent license is
+required to allow Recipient to distribute the Program, it is
+Recipient's responsibility to acquire that license before distributing
+the Program.
+
+Copyrights:
+Each Contributor to Bacula represents that to its knowledge it has
+sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.
+
+Code falling under the above conditions will be marked as follows:
+
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2000-2009 Bacula Systems SA
+
+   The main author of Bacula is Kern Sibbald, with contributions from many
+   others, a complete list can be found in the file AUTHORS. This program
+   is Free Software; you can modify it under the terms of version two of
+   the GNU General Public License as published by the Free Software
+   Foundation plus additions that are listed in the file LICENSE.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of Kern Sibbald.
+   The licensor of Bacula is the Bacula Systems SA
+   Rue Galilee 5, 1400 Yverdon-les-Bains, Switzerland.
+
+
+Windows:
+Certain source code used to build the Windows version of the
+Bacula File daemon is copyrighted and or trademarked by Microsoft
+and may contain Microsoft intellectual property (examples:
+Microsoft VC++, the source to the VSS libraries, the Microsoft C
+runtime libraries).  As such we cannot and do not distribute that
+software.  We are permitted however to distribute Bacula with the
+necessary Microsoft libraries in binary form.
+
+You may obtain the parts that we cannot distribute as follows.  The
+Microsoft compiler available for purchase, and Microsoft provides a free
+version of the compiler.  The source code and libraries are available for
+download from Microsoft public Web servers.  We have documented in the
+src/win32 directory the URLs from which we obtained the library source, and
+how we build the Windows File daemon and many users have succeeded in doing
+so themselves.  Our intention is to respect as closely as possible Open
+Source practices while maintaining full respect for proprietary and
+copyrighted code.
+
+GPLv2 or later license:
+ src/tools/bsmtp.c
+    Copyright (C) 1997 Ralf S. Engelschall, All Rights Reserved.
+  (note, bsmtp.c does not use OpenSSL, nor is it used with the code
+   of any other part of Bacula)
+
+3 clause BSD License notice for inclusion with the binary:              
+ src/lib/fnmatch.c
+   * Copyright (c) 1989, 1993, 1994
+   *      The Regents of the University of California.  All rights reserved.
+ src/lib/fnmatch.h
+   * Copyright (c) 1992, 1993
+   *      The Regents of the University of California.  All rights reserved.
+
+Permissive licenses:
+ src/lib/var.c/h
+   **  OSSP var - Variable Expansion
+   **  Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com>
+   **  Copyright (c) 2001-2002 The OSSP Project (http://www.ossp.org/)
+   **  Copyright (c) 2001-2002 Cable & Wireless Deutschland (http://www.cw.com/de/)
+
+ src/lib/bsnprintf.c
+   * Copyright Patrick Powell 1995
+
+ src/bregex.c/h
+   * Copyright (c) 1991 Tatu Ylonen, Espoo, Finland
+
+ src/lib/sha1.c/h
+   Copyright (C) The Internet Society (2001).  All Rights Reserved.
+
+ src/win32/compat/getopt.c
+   "... licensed under IBM copyrights to use the IBM-provided source code 
+   in any way he or she deems fit ..."
+
+ src/win32/compat/sys/mtio.h (LGPL)
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   
+
+Bacula can be enabled with data encryption and/or communications
+encryption. If this is the case, you will be including OpenSSL code that
+that contains cryptographic software written by Eric Young
+(eay@cryptsoft.com) and also software written by Tim Hudson
+(tjh@cryptsoft.com).
+
+There are parts of Bacula that are licensed under the LGPL so
+that those files may be used in proprietary code to interface with
+Bacula.
+
+Finally there are parts of Bacula that are in the public domain.
+             
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=====================================
+
+
+The entire GPL is reproduced below, in the manuals distributed with the
+Bacula documentation and can also be found online on the GNU web site
+as well as at www.bacula.org. You may also obtain a copy of the
+GPL (or LGPL) by writing to: Free Software Foundation, Inc., 
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+
+============== Text of GPL version 2 license ========
+
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+\f
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <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 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
+===========================================
diff --git a/rescue/linux/usb/README.restore b/rescue/linux/usb/README.restore
new file mode 100644 (file)
index 0000000..87d9320
--- /dev/null
@@ -0,0 +1,95 @@
+
+Copyright (C) 2009-2010 Bacula Systems SA
+
+Please see the file LICENSE concerning the terms of the license,
+copying and such.
+
+
+
+
+THIS ASSUMES THAT YOU ALLREADY CREATED YOUR USB KEY  (README.usb)
+
+AND SAVED YOUR DATA TO IT (README.save)
+
+
+---------------------------RESTORING A BROKEN MACHINE--------------------------------
+
+-- THE ADDRESS OF THE FILE DAEMON AND STORAGE DAEMON MUST BE 
+             THE IP ADDRESS AND NOT THE HOSTNAME IN THE BACULA-DIR.CONF
+             OF THE MACHINE CONTAINING THE DIRECTOR
+
+
+-boot on the usb stick   (if your computer's bios doesn't support usb booting, use the provided boot-cd)
+                         (available at http://bacula.org/downloads/cd-boot-liveusb2.iso )
+                         (the boot cd works with vmware but not virtualbox)
+
+-open a terminal as root
+
+-execute the start_bacula_rescue script ( in /home/ubuntu/start_bacula_rescue)
+
+-choose restore
+
+
+-it will prompt you for the client you want to restore
+
+-it will show you all the availaible disk devices (followed by previously
+  /dev/XXX) ( this is to ensure the drives didn't swap names)
+
+-choose the disks you want to restore 
+
+     (e.g /dev/sda will repartition /dev/sda, reformat ALL partitions
+     (that were mounted at the time of backup and the call the bacula
+      client to repopulate the data)
+        
+     ( /dev/sda1 would only reformat /dev/sda1 and then call the bacula
+       client to repopulate the data)
+
+-if you didn't provide a bconsole.conf file at the time of backup it will
+ again prompt you for one (if you don't provide it you will have to run
+ the restore job on another machine)
+
+-bconsole will launch
+
+-------------------------------------------------------------------------------------
+---------------BE CAREFULL, IF YOU DIDN'T CHOOSE YOUR ROOT DISK (e.g. /dev/sda1) 
+YOU MUST ONLY RESTORE THE MOUNT POINT OF YOUR CHOOSEN VOLUMES, 
+OTHERWISE YOU WOULD FILL UP THE USB KEY------------------------------
+
+(e.g. I restore the drive sdb5 which was mounted on /mnt/data , I must only restore /mnt/data
+   with bacula)
+
+----------------------------------------------------------------------------------------
+
+-so restore your files with bconsole (or bat, bweb on another machine) 
+
+-when you are all done, press ok
+
+-the script will now look for a /boot/grub directory on the
+ restored disks and try to execute grub-install
+
+  (if you have lilo or some other boot loader you will have to restore them
+   manually)
+
+---et voilà-----------YOU JUST RECOVERED YOUR MACHINE
+
+---------------------------------------------------------------------------------------------
+
+
+--------------------------RUNNING SCRIPTS MANUALLY---------------------------------------------
+
+- If you look into the clients/ directory you will find your
+  clients directories
+
+- If for some reason you want to execute a script manually YOU  MUST
+
+   cd /media/bs-rescue/bacula-rescue
+   rm -r scripts/working
+   cp -r clients/(clientname)/* scripts/working ###this is important only take the dirs that are inside
+                                                 #### the client directory (they are named
+                                                ######              scripts and diskinfo)
+   cd scripts/working/scripts
+
+   -- execute your scripts here
+
+
+-------------------------------------------------------------------------------------------------------
diff --git a/rescue/linux/usb/README.save b/rescue/linux/usb/README.save
new file mode 100644 (file)
index 0000000..d8e45ec
--- /dev/null
@@ -0,0 +1,93 @@
+
+Copyright (C) 2009-2010 Bacula Systems SA
+
+Please see the file LICENSE concerning the terms of the license,
+copying and such.
+
+This readme assumes that you have already created your USB key.
+if not, please see README.usb.
+
+
+This is the first release of the bacula bare metal recovery key,
+Please test it before you really use it.
+
+It's been tested so far on ubuntu 9.04
+
+--WARNING-- 
+
+   -- BY ITSELF THIS SCRIPT WILL DO YOU NO GOOD, YOU MUST HAVE BACULA
+      INSTALLED ON THE MACHINES YOU WANT TO BACK UP, 
+      AND BE SURE THAT YOUR BACKUP JOBS INCLUDE ALL MOUNTED DISKS
+
+
+   -- IN THIS CURRENT VERSION, THE FILE DAEMON IS A 3.0.3, IT SHOULD BE 
+      COMPATIBLE WITH ALL DIRECTORS (FROM 2.0.4 ON) BUT FURTHER TESTING IS NEEDED
+
+   -- THE FILE DAEMON DOESN'T SUPPORT SSL (NO ENCRYPTION)
+
+
+   -- THE SCRIPT HAS BEEN TESTED WITH LVM WITH ONLY ONE LVM VOLUME
+      IF YOU HAVE MORE THAN ONE LVM VOLUME, YOU MIGHT FIND A BUG
+
+   -- THE SCRIPT WILL SCAN FOR SOFT RAID VOLUMES, NOT HARDWARE RAIDS
+
+   -- THE ADDRESS OF THE FILE DAEMON AND STORAGE DAEMON MUST BE 
+       THE IP ADDRESS AND NOT THE HOSTNAME IN THE BACULA-DIR.CONF
+       OF THE MACHINE CONTAINING THE DIRECTOR
+--YOU HAVE BEEN WARNED, SO LET'S CONTINUE---
+
+
+--- How to use this key
+
+First you want to boot on your system and mount all drives that
+you want to be able to restore
+
+be sure to have DIALOG OR XDIALOG installed on your system
+
+BE CAREFUL, as of now, this key will pick up all drives, but will
+create empty scripts if drives are not mounted
+
+the supported filesystems are
+
+--ext2
+--ext3
+--fat
+--ntfs (needs some testing)
+--jfs
+--xfs
+--reiserfs
+
+
+---------------------SAVING YOUR COMPUTER'S HARDWARE CONFIG-----------------       
+
+-Mount all your drives, plug in the usb stick, navigate to the
+ bs-rescue partition (normally mounted on /media/bs-rescue or
+ /mnt/bs-rescue)
+
+-navigate to the bacula-rescue directory
+
+-With root permission, execute the start_rescue script
+
+-choose backup
+
+-by default the script will save your data in clients/$hostname
+ (it will prompt you to enter a different name if you wish)
+
+
+-You must have a bacula-fd.conf file somewhere, the script will
+ look for it in /etc/bacula and will prompt you to enter the path
+ if it is not found there
+
+-The script will prompt you for a bconsole.conf file, it is not
+ necessary , but if you don't provide it, you will have to
+ operate bacula from a different machine at the time of restore
+
+
+-- et voilà.....  you have backed up the structure of your
+   machine (not the data, bacula is used for that)
+
+
+---------------------------RESTORING A BROKEN MACHINE--------------------------------
+
+PLEASE SEE THE README.restore file
diff --git a/rescue/linux/usb/README.usb b/rescue/linux/usb/README.usb
new file mode 100644 (file)
index 0000000..f1a0c27
--- /dev/null
@@ -0,0 +1,139 @@
+
+Copyright (C) 2009-2010 Bacula Systems SA
+
+This directory is used to build a USB key containing a Xubuntu 9.04 LiveCD
+with persistent OS files and persistent /home files.
+
+You will need to run as root for most things ...
+
+Packages needed:
+apt-get install syslinux mbr parted wget
+
+Please make sure they are installed on your system before
+continuing.
+
+1. Start by editing the "config" file (DO NOT EDIT config2).  Be
+   sure to get your USB_DEV definition correct.  Note: you can
+   see what devices you have connected by running:
+
+      lsscsi
+
+   For example, I get:
+
+   $ lsscsi
+    [1:0:0:0]    cd/dvd  _NEC     DVD+RW ND-1100A  108B  /dev/scd0
+    [1:0:1:0]    cd/dvd  PHILIPS  DVD+-RW DVD8631  9D03  /dev/scd1
+    [9:0:0:0]    disk    Kingston DataTraveler 2.0 PMAP  /dev/sda
+
+   and in my case, the USB device is the Kingston DataTraveler on
+   device /dev/sda.
+
+   Alternatively you can do:
+
+       fdisk -l
+
+2. The scripts you need to partition the key and 
+   to write the boot image to it are all in this (usb) directory. 
+
+3. If you ever want to put the key back to its prior state, *before*
+   running the partition_usb_key, you might consider doing a:
+
+     sfdisk -d /dev/key-device >save_me  
+
+   where key-device is the key device name (e.g. sda).  The
+   output file can be fed back into sfdisk to recreate the original
+   with:
+
+     sfdisk /dev/key-device <save_me
+
+4. The next step is to get a copy of rescue.gz and rw.tar.gz,
+   which are the USB boot image and the read-write partition.
+
+   To do so execute  
+
+   ./get_files.sh script
+
+   from within this directory.
+
+
+   It will download the required files to the "files" subdirectory  
+   of this directory.  You need only do this command once.  Once
+   you are finished building any and all USB keys, you can conserve
+   disk space by deleting:
+
+     files/rw.tar.gz
+     files/rescue.gz
+
+5. If you have not already done so, edit the file "config" 
+  (never edit config2) and fill in the values that correspond 
+  to your setup.
+
+6. After editing the config file, run:
+
+   ./partition_usb_key
+
+   Note, this script will destroy *all* data on the key, and assumes
+   that you have a 4GB or bigger key.  
+
+
+   The partition_usb_key script creates three partitions:
+
+    1. xubuntu9  -- USB boot partition containing the OS
+    2. casper-rw -- A writable ext3 partition for saving OS changes
+    3. bacula-rescue -- The actual place of our rescue scripts
+                        and saved data
+
+
+6. Mount your USB key and copy the files to the key.
+   Do this with:
+
+   ./copy_bacula-rescue_to_key
+
+   This can take a good amount of time (5 mins) since it must format
+   the new partitions then copy the boot image.
+
+7. You should now have a USB stick that can be booted providing the
+   machine permits booting from the USB port -- this can be adjusted
+   by modifying the BIOS boot sequence.  On Dell machines, you can 
+   enter the BIOS setup by pressing F2 just after power on.  
+
+   Alternatively, most machines let you boot from an alternate device.
+   For example if you press F11 while a Sony Viao is powering up, it 
+   will boot from the USB port. 
+
+   On Dell machines during power on, if you press F12, you will be
+   able to select any boot device (one time only) other than the one
+   that is the default (normally the CDROM or HDD).
+
+   for older machines you can boot on a cd that will point to your usb key
+
+   you can find such a cd at
+   http://bacula.org/downloads/cd-boot-liveusb2.iso
+
+   burn the iso to cd, then boot on the cd and on the graphical
+   menu select usb (be sure to have no other usb devices than the key
+   attached at boot time)
+
+   wait for a while sometimes it doesn't pick up fast
+   but with a bit of patience it works
+
+
+
+===
+
+If you want to add additional OS tools to your USB stick, there
+are two ways:
+
+1. Remaster the iso boot image (a bit complicated) see README.technotes
+2. Simply use sudo apt-get install ... when booted into your USB stick. 
+   The changes will be written to the casper-rw partition (the
+   read/write OS partition).
+
+
+One slightly annoying thing about the USB key is that the casper-rw
+and the home-rw partitions must be ext3 (with journaling turned on),
+and journaling is not really the best way to run with USB keys that
+have a finite write lifetime.  Switching the partitions to ext2 seems
+to prevent them from being written correctly, which means a lot of
+things such as starting X do not work.
diff --git a/rescue/linux/usb/TODO b/rescue/linux/usb/TODO
new file mode 100644 (file)
index 0000000..25a4f2a
--- /dev/null
@@ -0,0 +1,34 @@
+
+
+TODO LIST
+
+-- add ext4 support
+
+-- add reiser4 support
+
+-- add an option to choose a name for the backup even though the hostname is not yet taken
+
+-- add an option at restore time to only execute bacula, no partition or format
+
+-- add an option to restore virtual machines like this:
+
+     1- create a script that would run before bacula that would
+            -- use qemu-img --info to get the disk size of virtual disks and print the info
+               to a file that would be backed up by bacula
+
+     2- at restore time, boot on the machine use the file daemon of the machine to recover the 
+       info file (if it has been deleted)
+        
+       --use qemu-img to create empty vmdk's
+       --boot on the usb key inside vmware to partition,reformat and restore the machine
+
+
+-- test with multiple lvm volumes
+
+-- add an option to clone the machine like this:
+
+   1- create your backup
+   2- boot on the usb key to differenciate drives (no sda sdf swapping)
+   3- make a directory for this clone info
+   4-boot on the usb key on another machine and restore it
+
diff --git a/rescue/linux/usb/config b/rescue/linux/usb/config
new file mode 100644 (file)
index 0000000..ee3c489
--- /dev/null
@@ -0,0 +1,29 @@
+#
+# You must define certain environment variables in this file
+#  so that the scripts know where to find things.
+#
+
+CWD=`pwd`
+
+# 
+
+
+#
+# The device name of your USB device (e.g. /dev/sda)
+#  You can find it by plugging it in then doing
+#
+#    fdisk -l
+#
+# If you are unsure remove the USB device and rerun the fdisk -l
+# If you get this wrong, your harddisk could be wiped out.
+# It is probably "sda" or "sdb" or "sdc" 
+#
+USB_DEV=/dev/sdc
+#
+# When your USB key is mounted, what is the mount directory?
+#
+MOUNT_POINT=/media
+
+
+
+
diff --git a/rescue/linux/usb/config2 b/rescue/linux/usb/config2
new file mode 100644 (file)
index 0000000..f1383dd
--- /dev/null
@@ -0,0 +1,14 @@
+#
+# Do not edit this file this file
+
+# Partition 1 (xubuntu) size
+#
+SIZE_PART1="+800M"
+
+#
+# Partition 2 (casper-rw) size
+#
+SIZE_PART2="+1000M"
+
+#
+# Partition 3 uses whatever is left on the USB key
diff --git a/rescue/linux/usb/copy_bacula-rescue_to_key b/rescue/linux/usb/copy_bacula-rescue_to_key
new file mode 100755 (executable)
index 0000000..4860b68
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# 
+. ./config
+cwd=$PWD
+
+if [ ! `whoami` = "root" ] ; then
+  echo ""
+  echo "You need to be root to run this shell script"
+  echo ""
+  exit 1
+fi
+usb=`blkid |grep bs-rescue|cut -d: -f1`
+USB_DEV=${usb%?}
+echo "Please make sure that only one casper-rw exists on the system"
+echo "if you have other disks labeled casper-rw, unplug them now"
+echo ""
+echo "and make sure your USB key is mounted"
+echo ""
+echo "This will install bacula-rescue on " ${USB_DEV}
+echo ""
+echo "Continue?? (y/n)"
+read a
+if [ ! "$a" = "y" ];then
+  exit 1
+fi
+
+
+if [  x{$USB_DEV} = x{} ];then
+  echo "You must mount your USB key before running this script"
+  exit 1
+fi
+
+
+
+
+dir=`df |grep ${USB_DEV}1 |awk '{print $NF}'`
+
+umount ${USB_DEV}1 >/dev/null 2>&1
+echo "We're about to erase the content of ${USB_DEV}1 , continue ? (y/n)"
+read a
+if [ ! "$a" = "y" ];then
+  exit 1
+fi
+echo "These are large files, so it will take some time ..."
+echo " "
+
+gunzip <files/rescue.gz | dd bs=1M of=${USB_DEV}1
+if [ $? != 0 ]; then
+  echo " "
+  echo "Copy of boot setup failed. USB key creation failed!!!"
+  echo " "
+  exit 1
+fi
+
+dir=`df |grep ${USB_DEV}2 |awk '{print $NF}'`
+
+if [ $dir = "/" ] ;then
+  echo "Oops we were about to scrap your system , was the USB key mounted ??, guess not...."
+  exit 1
+fi
+
+cd $dir
+echo "We're about to erase the content of $dir , continue ? (y/n)"
+read a
+  if [ ! "$a" = "y" ];then
+  exit 1
+fi
+
+tar -xvzf $cwd/files/rw.tar.gz 
+
+dir=`df |grep ${USB_DEV}3 |awk '{print $NF}'`
+if [ $dir = "/" ] ;then
+  echo "Oops we were about to scrap your system , was the USB key mounted ??, guess not...."
+  exit 1
+fi
+cd $cwd
+echo "We're about to erase the content of $dir , continue ? (y/n)"
+read a
+  if [ ! "$a" = "y" ];then
+  exit 1
+fi
+cp -r files/bacula-rescue $dir
+
+#rm -r /tmp/bs-rescue
+echo "syncing ..."
+sync
+sync
+echo ""
+echo ""
+echo ""
+echo ""
+echo "Enjoy !!"
diff --git a/rescue/linux/usb/get_files.sh b/rescue/linux/usb/get_files.sh
new file mode 100755 (executable)
index 0000000..8207478
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+wget http://bacula.org/downloads/rw.tar.gz
+wget http://bacula.org/downloads/rescue.gz
+
+mv rw.tar.gz files
+mv rescue.gz files
diff --git a/rescue/linux/usb/how_to_create_a_new_usb_key.txt b/rescue/linux/usb/how_to_create_a_new_usb_key.txt
new file mode 100644 (file)
index 0000000..1096976
--- /dev/null
@@ -0,0 +1,123 @@
+
+
+--------------HOW TO CREATE A NEW USB KEY (CHANGE DISTRIB)----------------
+
+mkdir /tmp/distrib
+mount -o loop distrib.iso /tmp/distrib
+umount /tmp/distrib
+
+mkdir /tmp/squash
+mount -o loop -t squashfs /tmp/distrib/casper/filesystem.squashfs /tmp/squash
+
+mkdir sqfs
+rsync -avx -P /tmp/squash/. sqfs/.
+
+chroot sqfs
+####################################carefull execute this in the chroot
+
+
+mount -t sysfs none /sys/
+mount -t proc none /proc/
+export HOME=/root
+
+nano /etc/apt/sources.list ###include universe multiverse
+
+cat >/etc/resolv.conf <<EOF
+search sibbald.com
+nameserver 192.168.68.254
+nameserver 208.67.222.222
+nameserver 208.67.220.220
+EOF
+
+apt-get update
+
+apt-get remove --purge `dpkg-query -W --showformat '${Package}\n' | grep language-pack | egrep -v '\-en'`
+
+apt-get remove --purge `dpkg-query -W --showformat '${Package}\n' | grep openoffice\.org-`
+
+apt-get remove --purge amarok dictionaries-common
+
+apt-get upgrade
+
+apt-get install lvm2 qemu mdadm mbr xfsprogs jfsutils hfsplus hfsutils\
+ gparted xdialog dialog reiserfsprogs reiser4progs ntfsprogs ntfs-3g e2fsprogs dosfstools
+
+apt-get install bind9-host dnsutils  linux-generic linux-headers-generic linux-image-generic   ssl-cert
+
+
+apt-get install sshfs gedit lsscsi m4 mtx nfs-common   nfs-kernel-server patch \
+  squashfs-tools strace sg3-utils screen scsiadd system-tools-backends   telnet dpkg \
+traceroute usbutils whois autofs busybox   chkrootkit clamav dmidecode unrar
+
+apt-get install flashplugin-nonfree aircrack-ng g++ nvidia-glx-180   gfxboot syslinux mtools
+
+apt-get install openssh-server subversion  gftp firefox sg3-utils
+
+apt-get remove linux-headers-2.6.28-11 linux-headers-2.6.28-11-generic \
+  linux-image-2.6.28-11-generic linux-restricted-modules-2.6.28-11-generic \
+  linux-restricted-modules-2.6.28-11-generic ###change kernel version 
+
+apt-get clean
+
+dpkg-query -W --showformat='${Package} ${Version}\n' >filesystem.manifest
+
+rm -rf /tmp/*
+rm -f /etc/hosts /etc/resolv.conf
+umount /proc/
+umount /sys/
+history -c
+exit
+
+
+###reboot if proc didn't unmount
+cp sqfs/boot/vmlinuz-blabla vmlinuz
+cp sqfs/boot/initrd-img-blabla  initrd-img (or gz)
+cp sqfs/filesystem.manifest .
+rm sqfs/filesystem.manifest 
+mksquashfs sqfs filesystem.squashfs
+  
+apt-get install isomaster ## if you don't have it
+
+--point it to your distrib.iso
+
+--extract /isolinux
+
+mv isolinux syslinux
+mv syslinux/isolinux.cfg syslinux/syslinux.cfg ## you can edit it to set a lower timeout (30)
+
+--edit syslinux/text.cfg so it looks like
+
+default live
+label live
+  menu label ^Bacula-rescue
+  kernel /casper/vmlinuz
+  append  noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/xubuntu.seed boot=casper initrd=/casper/initrd.img  quiet nosplash --
+
+
+--note that the important bit is
+
+ cdrom-detect/try-usb=true persistent
+
+ --and that the initrd have the good extension
+
+--and if your cd doesnt have casper but live change accordingly
+
+###
+
+--in isomaster delete the isolinux dir
+--put in your new syslinux dir
+
+--in isomaster delete everything in casper and replace with your own vmlinuz initrd filesystem.squashfs
+               and filesystem.manifest
+
+--save your work as bs-rescue-bla-bla.iso
+
+--change the copy_bacula_to usb_stick script so it points to your iso
+
+
+et voilà
+
+
+
+
+
diff --git a/rescue/linux/usb/original-partitioning.txt b/rescue/linux/usb/original-partitioning.txt
new file mode 100644 (file)
index 0000000..e99d6d0
--- /dev/null
@@ -0,0 +1,9 @@
+
+Disk /dev/sdc: 49600 cylinders, 5 heads, 32 sectors/track
+Units = cylinders of 81920 bytes, blocks of 1024 bytes, counting from 0
+
+   Device Boot Start     End   #cyls    #blocks   Id  System
+/dev/sdc1   *      0+   9766    9767-    781344    c  W95 FAT32 (LBA)
+/dev/sdc2       9767   21974   12208     976640   83  Linux
+/dev/sdc3      21975   49599   27625    2210000   83  Linux
+/dev/sdc4          0       -       0          0    0  Empty
diff --git a/rescue/linux/usb/partition_usb_key b/rescue/linux/usb/partition_usb_key
new file mode 100755 (executable)
index 0000000..5d9d32c
--- /dev/null
@@ -0,0 +1,100 @@
+#!/bin/sh
+#
+# Partition the USB stick -- the stick is assumed to be at least 3GB in size
+#
+# First delete all existing partitions
+#
+. ./config
+. ./config2
+
+# Check for tools needed
+for i in fdisk gunzip blkid install-mbr sfdisk partprobe syslinux ; do
+  if [ ! -e `which $i` ] ; then
+    echo " "
+    echo "$i does not seem to be installed; cannot continue."
+    echo " "
+    exit 1
+  fi
+done
+
+if [ ! `whoami` = "root" ] ; then
+  echo ""
+  echo "You need to be root to run this shell script"
+  echo ""
+  exit 1
+fi
+if [ "x$USB_DEV" = "x" ] ; then
+  if [ "x$1" = "x" ] ; then
+     echo "You must supply the USB device name on the command line or in USB_DEV"
+     exit 1
+  else
+     USB_DEV=$1
+  fi
+fi
+echo "This script will distroy everything on $USB_DEV"
+fdisk -l $USB_DEV
+echo " "
+echo "Answer yes to continue "
+read a
+if [ "$a" != "yes" ] ; then
+  echo "Device $USB_DEV unchanged"
+  exit 1
+fi
+sfdisk -l $USB_DEV >original-partitioning.txt
+install-mbr ${USB_DEV}
+
+fdisk $USB_DEV <<EOF
+d
+4
+d
+3
+d
+2
+d
+1
+n
+p
+1
+
+${SIZE_PART1}
+t
+c
+a
+1
+n
+p
+2
+
+${SIZE_PART2}
+n
+p
+3
+
+
+p
+w
+EOF
+partprobe >/dev/null 2>&1
+partprobe ${USB_DEV}1 >/dev/null 2>&1
+umount ${USB_DEV}1 >/dev/null 2>&1
+mkfs.vfat -F 32 -n xubuntu9 ${USB_DEV}1
+partprobe >/dev/null 2>&1
+umount ${USB_DEV}2 >/dev/null 2>&1
+mkfs.ext3 -j -b 4096 -L casper-rw ${USB_DEV}2
+# Do fs checking every 100 mounts or 360 days
+tune2fs -c 100 -i 360 ${USB_DEV}2
+partprobe >/dev/null 2>&1
+umount ${USB_DEV}3
+mkfs.ext3 -j -b 4096 -L bs-rescue ${USB_DEV}3
+tune2fs -c 100 -i 360 ${USB_DEV}3
+sync
+
+echo "New partitioning is:"
+fdisk -l ${USB_DEV}
+syslinux ${USB_DEV}1
+sync
+partprobe >/dev/null 2>&1
+
+echo "We're done, now it's a good time to unplug and replug your usb key"
+echo "Then make sure that /media/bs-rescue is mounted before"
+echo  "running the copy_bacula_to_usb_key script"
diff --git a/rescue/linux/usb/src/bin/README b/rescue/linux/usb/src/bin/README
new file mode 100644 (file)
index 0000000..c038f37
--- /dev/null
@@ -0,0 +1,3 @@
+Place your static binaries here:
+bacula-fd-static-2.4.4           bacula-fd-static-3.0.3-with-nss  dialog                           
+bacula-fd-static-3.0.3           bconsole.ermined                 Xdialog    
diff --git a/rescue/linux/usb/src/bin/Xdialog b/rescue/linux/usb/src/bin/Xdialog
new file mode 100755 (executable)
index 0000000..2cb3f83
Binary files /dev/null and b/rescue/linux/usb/src/bin/Xdialog differ
diff --git a/rescue/linux/usb/src/bin/dialog b/rescue/linux/usb/src/bin/dialog
new file mode 100755 (executable)
index 0000000..d734c71
Binary files /dev/null and b/rescue/linux/usb/src/bin/dialog differ
diff --git a/rescue/linux/usb/src/scripts/ans b/rescue/linux/usb/src/scripts/ans
new file mode 100644 (file)
index 0000000..480a8a3
--- /dev/null
@@ -0,0 +1,3 @@
+
+GLib-WARNING (recursed) **: getpwuid_r(): failed due to: No such user 0.
+1
diff --git a/rescue/linux/usb/src/scripts/bcon b/rescue/linux/usb/src/scripts/bcon
new file mode 100644 (file)
index 0000000..145178e
--- /dev/null
@@ -0,0 +1,2 @@
+show storage
+quit
diff --git a/rescue/linux/usb/src/scripts/chrootscript b/rescue/linux/usb/src/scripts/chrootscript
new file mode 100755 (executable)
index 0000000..00bc665
--- /dev/null
@@ -0,0 +1,307 @@
+#!/bin/sh
+#iface=`ifconfig |cut -d" " -f1|head -n1`
+
+swp=`blkid |grep swap|awk '{print $1}'|cut -d: -f1|head -n1`
+if [ ! $swp = "" ];then
+swapon $swp
+fi
+
+iface=`grep dev= working/scripts/start_network|cut -d= -f2`
+. ./unmount-all
+howmany=`ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo|wc -l`
+
+tmp=""
+echo "">tmp
+ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo |while read line; do
+#line=${line%?}
+
+echo `echo $line $line'\'`>>tmp
+
+tmp2=`cat tmp`
+#tmp2=${tmp2%?}
+echo $tmp2 >tmp
+done
+tmp=`cat tmp`
+
+if [ -f ../../../scripts/nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+$DIALOG --menu "Which ethernet adapter connects to the director ??:" 30 60 20 $tmp 2>ans 
+ifaceans=`cat ans`
+
+
+
+
+sed -i 's/'$iface'/'$ifaceans'/g' working/scripts/start_network
+. ./working/scripts/start_network
+. ./unmount-all
+if [ -f mount_drives ];then
+rm mount_drives
+fi
+
+if [ -d /media/bs-rescue/chroot ];then
+rm -r /media/bs-rescue/chroot
+fi
+mkdir /media/bs-rescue/chroot
+
+
+touch mount_drives
+cat disklist|while read line;do
+cat working/scripts/mount_drives|grep $line>>/dev/null 2>&1
+if [ $? = 0 ];then
+cat working/scripts/mount_drives|grep $line|while read LINE;do
+cat mount_drives|grep "$LINE"
+if [ ! $? = 0 ];then
+echo $LINE>>mount_drives
+fi
+done
+fi
+done
+
+cat lvdisks|while read line;do
+cat working/scripts/mount_drives|grep $line>>/dev/null 2>&1
+if [ $? = 0 ];then
+cat working/scripts/mount_drives|grep $line|while read LINE;do
+cat mount_drives|grep "$LINE"
+if [ ! $? = 0 ];then
+echo $LINE>>mount_drives
+fi
+done
+fi
+done
+
+chmod +x mount_drives
+. ./mount_drives
+if [ ! -d /media/bs-rescue/chroot/sys ];then
+mkdir /media/bs-rescue/chroot/sys
+fi
+if [ ! -d /media/bs-rescue/chroot/tmp ];then
+mkdir /media/bs-rescue/chroot/tmp
+chmod 777 /media/bs-rescue/chroot/tmp
+fi
+if [ ! -d /media/bs-rescue/chroot/dev ];then
+mkdir /media/bs-rescue/chroot/dev
+fi
+if [ -f /media/bs-rescue/chroot/bacula-fdstatic ];then
+rm /media/bs-rescue/chroot/bacula-fdstatic
+fi
+#cp bacula-fdstatic /media/bs-rescue/chroot
+#cp batermined /media/bs-rescue/chroot
+#cp working/diskinfo/bacula-fd.conf /media/bs-rescue/chroot #### doesn t work if you copy files
+#cp working/diskinfo/bat.conf /media/bs-rescue/chroot          before mounting disks
+if [ ! -d /media/bs-rescue/chroot/proc ];then
+mkdir /media/bs-rescue/chroot/proc
+fi
+mount -o bind /proc /media/bs-rescue/chroot/proc
+
+
+
+
+
+
+cp working/diskinfo/bacula-fd.conf /media/bs-rescue/chroot
+
+if [ ! -d /media/bs-rescue/chroot/etc ];then
+mkdir -p /media/bs-rescue/chroot/etc
+fi
+if [ ! -d /media/bs-rescue/chroot/lib ];then
+mkdir -p /media/bs-rescue/chroot/lib
+fi
+cp /lib/libnss_dns.so.2 /media/bs-rescue/chroot/lib
+cp /etc/nsswitch.conf /media/bs-rescue/chroot/etc
+cp /etc/resolv.conf /media/bs-rescue/chroot/etc
+cp ping.ermined /media/bs-rescue/chroot/ping
+
+if [ ! -d /media/bs-rescue/chroot/var/bacula/working ];then
+mkdir -p /media/bs-rescue/chroot/var/bacula/working
+fi
+if [ ! -d /media/bs-rescue/chroot/var/run/bacula ];then
+mkdir -p /media/bs-rescue/chroot/var/run/bacula
+fi
+
+if [  -d /etc/bacula ];then
+rm -r /etc/bacula
+fi
+mkdir /etc/bacula
+
+
+if [ -f  working/diskinfo/bconsole.conf ];then
+
+cp working/diskinfo/bconsole.conf /etc/bacula
+../bin/bconsole.ermined < bcon > bconsole_output
+       cat bconsole_output |grep Version|awk '{print $5}'|grep 3.0
+       if [ $? = 0 ];then
+       cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-3.0.3 /media/bs-rescue/chroot/bacula-fd-static
+       fi
+               cat bconsole_output |grep Version|awk '{print $5}'|grep 2.4
+               if [ $? = 0 ];then
+               cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-2.4.4 /media/bs-rescue/chroot/bacula-fd-static
+               fi
+else
+
+$DIALOG --backtitle "If you want to connect to the director from this machine, \n you must provide a bconsole.conf , where is it ? \n (otherwise you can restore this client from another bconsole bat or bweb \n on another machine ) " --title "(spacebar to select)" --aspect 12 --begin 4 3 --fselect / 30 60 2>tmp
+    if [ $? = 1 ];then
+    $DIALOG --title "!!!!!!" --msgbox "No bconsole.conf, you will have to access your director \n from another machine and restore the directories \n that correspond to the drives you just formated" 30 60
+$DIALOG --radiolist "Which director version do you use ?:" 10 40 3 \
+        1 "  2.4.x" off \
+        2 "  3.0.x" off 2>ans
+       if [ $? = 1 ];then
+       exit 1
+       fi
+   
+                       version=`cat ans`
+                       if [ $version = "1" ];then
+                       cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-2.4.4 /media/bs-rescue/chroot/bacula-fd-static
+                       fi
+                               if [ $version = "2" ];then
+                               cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-3.0.3 /media/bs-rescue/chroot/bacula-fd-static
+                               fi
+       rm ans
+   fi
+               if [ -f tmp ];then
+               bakonf=`cat tmp`
+               rm tmp
+               else
+               bakonf=""
+               fi
+
+echo $bakonf |grep bconsole.conf
+  if [ $? = 0 ];then
+
+  cp $bakonf /etc/bacula
+  else
+ $DIALOG --radiolist "Which director version do you use ?:" 10 40 3 \
+        1 "  2.4.x" off \
+        2 "  3.0.x" off 2>ans
+       if [ $? = 1 ];then
+       exit 1
+       fi
+    fi
+               version=`cat ans`
+               if [ $version = "1" ];then
+               cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-2.4.4 /media/bs-rescue/chroot/bacula-fd-static
+               fi
+                       if [ $version = "2" ];then
+                       cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-3.0.3 /media/bs-rescue/chroot/bacula-fd-static
+                       fi
+                       rm ans
+
+
+  fi
+chroot /media/bs-rescue/chroot /bacula-fd-static -c /bacula-fd.conf &
+df |grep /media/bs-rescue/chroot |grep -v /media/bs-rescue/chroot/ >/dev/null 2>&1
+if [ $? = 1 ];then
+df |grep /media/bs-rescue/chroot >tmp 
+place=`cat tmp|awk '{print $6}'|cut -c 24-1000`
+if [ -f tmp2 ];then
+rm tmp2
+touch tmp2
+fi
+       df |grep /media/bs-rescue/chroot >tmp 
+       place=""
+               cat tmp|while read line;do
+               b=`echo $line|awk '{print $6}'|cut -c 24-1000`
+                       if [ ! $b = "" ];then
+                       placet=`echo $b`
+                       
+                       else
+                       lv=`df |grep mapper`
+                       placet=`df $lv|grep media|awk '{print $5}'|cut -c 24-1000`
+                       
+                               
+                               
+       
+                       fi
+                                if [ -f tmp2 ];then
+                                 cat tmp2|grep $placet
+                                 if [ ! $? = 0 ];then
+                                 echo  $placet>>tmp2
+                                 fi
+                                else
+                               echo  $placet>>tmp2
+                               fi
+
+               done
+
+place=`cat tmp2`
+rm tmp2
+
+
+
+
+
+$DIALOG --title "!!! WARNING !!!" --msgbox "Be carefull you didn't choose your root disk, so you must ONLY restore \n files that are situated on  \$ $place \n otherwise you would fill up this usb key instead of your disks \n \n \n But you still want to point to / (where to ?? >>>  / )" 30 60
+fi
+$DIALOG --title "!!! WARNING !!!" --msgbox "Now you must restore your files pointing to / \n We are faking that your disks are mounted on the root ( / ) \n \n \n If you restore your files anywhere else it wont work" 30 60
+if [ -f /etc/bacula/bconsole.conf ];then
+ ../bin/bconsole.ermined
+fi
+$DIALOG --title "PROCESSING" --msgbox "Please press ok when your job is done" 30 60
+if [ -d /media/bs-rescue/chroot/boot/grub ];then
+$DIALOG --title "Install GRUB ?" --yesno "You seem to have GRUB installed on this disk, \n Do you want to run install-grub (grub 1) on this disk ? \n (we will back up the grub dir in grub.bak in case something goes wrong)" 30 60 
+if [ $? = 0 ];then
+grubdisk=`df |grep /media/bs-rescue/chroot |grep -v /media/bs-rescue/chroot/ |awk '{print $1}'`
+cp -r /media/bs-rescue/chroot/boot/grub /media/bs-rescue/chroot/boot/grub.bak
+grub-install --root-directory=/media/bs-rescue/chroot/boot/grub $grubdisk
+fi
+fi
+$DIALOG --title "THAT'S IT" --msgbox "That's it , we're all done \n \n \n Enjoy !!!" 30 60
+if [ -f added_disks ];then
+rm added_disks
+fi
+if [ -f alldisks ];then
+rm alldisks
+fi
+
+if [ -f ans ];then
+rm ans
+fi
+
+if [ -f badblocksnoprompt ];then
+rm badblocksnoprompt
+fi
+
+if [ -f noprompt ];then
+rm noprompt
+fi
+
+if [ -f clientmp ];then
+rm clientmp
+fi
+
+
+if [ -f dialogtest ];then
+rm dialogtest
+fi
+
+if [ -f disklist ];then
+rm disklist
+fi
+
+if [ -f fulldisks ];then
+rm fulldisks
+fi
+
+if [ -d working ];then
+rm -r working
+fi
+
+if [ -f mount_drives ];then
+rm mount_drives
+fi
+
+if [ -f tmp ];then
+rm tmp
+fi
+ pid=`ps -ax|grep ermine|grep -v grep|awk '{print $1}'`
+if [ ! $pid = "" ];then
+kill $pid
+fi
+lsof |grep /media/bs-rescue/chroot|awk '{print $2}'|while read line ;do
+if [ ! $line = "" ];then
+kill $line
+fi
+done
diff --git a/rescue/linux/usb/src/scripts/client b/rescue/linux/usb/src/scripts/client
new file mode 100644 (file)
index 0000000..5693e2b
--- /dev/null
@@ -0,0 +1 @@
+$DIALOG --radiolist "choose a client" 25 40 zzz \
diff --git a/rescue/linux/usb/src/scripts/dial b/rescue/linux/usb/src/scripts/dial
new file mode 100644 (file)
index 0000000..56e817f
--- /dev/null
@@ -0,0 +1 @@
+DIALOG --checklist "Please choose the disks you want to restore" 25 40 zzz \
diff --git a/rescue/linux/usb/src/scripts/dialognetworkorig b/rescue/linux/usb/src/scripts/dialognetworkorig
new file mode 100644 (file)
index 0000000..b7d603f
--- /dev/null
@@ -0,0 +1 @@
+DIAL --radiolist "you seem to have more than 1 network adapter \n which one connects to the director ?" 20 80 howmany \
diff --git a/rescue/linux/usb/src/scripts/findraidevice/findraid_new b/rescue/linux/usb/src/scripts/findraidevice/findraid_new
new file mode 100755 (executable)
index 0000000..df08ab3
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+if [ -f recreate_raid_arrays ];then
+rm recreate_raid_arrays
+fi
+
+if [ -f findraidtemp ];then
+rm findraidtemp
+fi
+devices=""
+
+cat /proc/mdstat |grep active|grep -v inactive>>/dev/null
+       if [ $? = 0 ];then
+       cat /proc/mdstat |grep active|grep -v inactive>>findraidtemp
+       cat findraidtemp |while read line ;do
+       words=`echo $line |wc -w`
+               for i in `seq 1 $words`;do
+               a=1
+               result=`echo $line|cut -d" " -f$i`
+               res=`echo $result|cut -c1`
+               resu=`echo $result|cut -c 1-4`
+               resfin=`echo $result|tail -c2`          
+                       if [ "$res" = "m" ];then
+                       device=$result
+                       
+                       fi
+                               if [ "$resu" = "raid" ];then
+                               level=`echo $result|tail -c2`   
+                               
+                               fi
+                                       if [ "$resfin" = "]" ];then
+                                        dev=`echo $result |cut -d"[" -f1`
+                                       dev=`echo "/dev/"$dev" "`
+                                       devices=$devices$dev
+                                       
+                                               
+                                               
+                                       fi
+                 done
+        numdev=`echo $devices|wc -w`
+        onedev=`echo $devices|cut -d" " -f1`
+        uuid=`blkid |grep $onedev|cut -d'"' -f2`
+         echo "mdadm --create /dev/"$device" --level="$level" --raid-devices="$numdev " " $devices "--uuid="$uuid >>recreate_raid_arrays
+        devices=""
+         done
+chmod +x recreate_raid_arrays
+
+       fi
+ if [ -f findraidtemp ];then
+rm findraidtemp
+fi
diff --git a/rescue/linux/usb/src/scripts/formatallscript b/rescue/linux/usb/src/scripts/formatallscript
new file mode 100755 (executable)
index 0000000..5ce1e68
--- /dev/null
@@ -0,0 +1,336 @@
+. ./unmount-all
+#
+#  Format all partitions on disk sda -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sda."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sda !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sda -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sda."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sda !!!!"
+echo "Formatting /dev/sda5 -- swap partition"
+mkswap -U dbe43254-f760-4685-93f0-99f81549b085 /dev/sda5
+echo "Formating /dev/sda1 -- ext3 partition"
+mkfs.ext3 -v -j $check -U bbd25d01-3f39-43f1-9266-ca272fcce5c1 /dev/sda1
+. ./unmount-all
+#
+#  Format all partitions on disk sdb -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdb."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdb !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdb -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdb."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdb !!!!"
+echo "Formating /dev/sdb1 -- vfat partition"
+mkfs.vfat $check -n sdb1fat -i 4AF1B654 /dev/sdb1
+. ./unmount-all
+#
+#  Format all partitions on disk sdc -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdc."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdc !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdc -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdc."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdc !!!!"
+echo "Formating /dev/sdc2 -- xfs partition"
+mkfs.xfs -f $check -L sdc2_xfs /dev/sdc2
+xfs_admin -U 2dbb53c3-8eaa-4558-9e1e-aa78fe5a3fe9 /dev/sdc2
+. ./unmount-all
+#
+#  Format all partitions on disk sdd -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdd."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdd !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdd -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdd."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdd !!!!"
+echo "Formating /dev/sdd1 -- reiser partition"
+mkreiserfs -u 029b460c-28d3-4aac-9740-41e7eb6b48dd /dev/sdd1
+. ./unmount-all
+#
+#  Format all partitions on disk sde -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sde."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sde !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sde -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sde."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sde !!!!"
+echo "Formating /dev/sde1 -- hfs partition"
+mkfs.hfs $check -v sde1_hfs /dev/sde1
+echo "Formating /dev/sde2 -- ntfs partition"
+mkfs.ntfs $check -L sde2_ntfs /dev/sde2
+. ./unmount-all
+#
+#  Format all partitions on disk sdf -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdf."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdf !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdf -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdf."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdf !!!!"
+. ./unmount-all
+#
+#  Format all partitions on disk sdg -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdg."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdg !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdg -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdg."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdg !!!!"
+. ./unmount-all
+#
+#  Format all partitions on disk sdh -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdh."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdh !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdh -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdh."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdh !!!!"
+. ./unmount-all
+#
+#  Format all partitions on disk sdi -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdi."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdi !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdi -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdi."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdi !!!!"
+. ./unmount-all
+#
+#  Format all partitions on disk sdj -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdj."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdj !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+# Format all partitions on disk /dev/sdj -- created by getdiskinfo
+echo "This script will format all partitions on disk /dev/sdj."
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdj !!!!"
+#!/bin/sh
+#
+#  Format all partitions on VG datavg -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all LVs on VG datavg."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK datavg !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+   check="-c"
+else
+   check=
+fi
+else
+check=
+fi
+echo "Formating /dev/mapper/datavg-datalv -- ext3 partition"
+mkfs.ext3 -v -j $check -U e2af2f6e-e1b2-4fe9-87d6-41f5d6edec94 /dev/mapper/datavg-datalv
+echo ""
diff --git a/rescue/linux/usb/src/scripts/fullrestorescript b/rescue/linux/usb/src/scripts/fullrestorescript
new file mode 100755 (executable)
index 0000000..10936e6
--- /dev/null
@@ -0,0 +1,103 @@
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdi of=/dev/sdi
+. ./unmount-all
+#!/bin/sh
+#
+#  Format all partitions on disk /dev/sdi -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk /dev/sdi."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK /dev/sdi !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+   check="-c"
+else
+   check=
+fi
+else
+   check=
+fi
+
+#
+#  Format all partitions on disk sdj1 -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdj1."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdj1 !!!!"
+echo ""
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+
+#
+#  Format all partitions on disk sdh1 -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdh1."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdh1 !!!!"
+echo ""
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+
+#
+#  Format all partitions on disk sdg1 -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk sdg1."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK sdg1 !!!!"
+echo ""
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x$a != xyes ] ; then
+   exit 1
+fi 
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
diff --git a/rescue/linux/usb/src/scripts/get_serial b/rescue/linux/usb/src/scripts/get_serial
new file mode 100755 (executable)
index 0000000..1a64ef5
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+#host=media/bs-rescue/bacula-rescue/clients/client1
+#owd=""
+usb=`blkid |grep bs-rescue|cut -d: -f1`
+usb=${usb%?}
+if [ -f $owd/$host/diskinfo/uuid.disks.with.no.uuid ];then
+rm $owd/$host/diskinfo/uuid.disks.with.no.uuid
+fi
+ blkid | awk '{ print $1 }'|grep -v loop|grep -v md|grep -v mapper|grep -v $usb|while read line;do
+line=${line%?}
+l=`echo $line |cut -d"/" -f3`
+echo "/dev/"$l > $owd/$host/diskinfo/uuid.$l
+#hdparm -i $line |grep Serial|cut -d, -f3 >>$owd/$host/diskinfo/hdparm.$l
+
+a=`blkid $line |wc -w|xargs expr`
+while [ $a -ne 0 ];do
+blkid $line |awk "{print \$$a}"|grep UUID >/dev/null 2>&1
+if [ $? = 0 ];then
+blkid $line |awk "{print \$$a}"|grep UUID>>$owd/$host/diskinfo/uuid.$l
+break
+fi
+if [ $a = 1 ];then
+echo $line >> $owd/$host/diskinfo/uuid.disks.with.no.uuid
+
+fi
+a=$(( a - 1))
+done
+
+done
+
+fdisk -l |grep /dev|grep -v $usb|grep :|cut -d: -f1|cut -d" " -f2|while read line;do
+l=`echo $line |cut -d"/" -f3`
+
+dd if=$line of=$owd/$host/diskinfo/mbr.$l bs=1 count=512 >/dev/null 2>&1
+done
diff --git a/rescue/linux/usb/src/scripts/getdiskinfo b/rescue/linux/usb/src/scripts/getdiskinfo
new file mode 100755 (executable)
index 0000000..3d6277a
--- /dev/null
@@ -0,0 +1,1011 @@
+#!/bin/sh
+#
+# Create bootstrap information files -- prelude to creating a
+#   Bacula Rescue data for USB key
+#
+#   Kern Sibbald, December MMII
+#      This source distributed under the GPLv2
+#
+#find out on which device is the usb key
+
+if [ -f ../../../scripts/nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+cd ..
+one=1
+etherdone=0
+none=" "
+usbdev=`blkid|grep bs-rescue|awk '{print $1}'|cut -d: -f1`
+usbdev=${usbdev%?}
+
+export LANG=C
+cwd=`pwd`
+owd=`pwd`
+
+
+os=`uname -s`
+if [ ! "x$1" = "x" ] ; then
+  host=clients/$1
+else
+  host=clients/`hostname`
+fi
+
+if [ -f scripts/differenthostname ]; then 
+host=clients/`cat scripts/differenthostname`
+rm scripts/differenthostname
+fi
+
+echo "Host specific data will be saved in the directory: ${host}"
+echo " "
+
+if [ -f $host.bak/scripts/mount_drives ] ;then
+rm -r $host.bak
+fi
+
+if [ -f $host/scripts/mount_drives ] ;then
+mv $host $host.bak
+fi
+
+mkdir -p $host
+di=${cwd}/$host/diskinfo
+scr=${cwd}/$host/scripts
+dirusb=/media/bs-rescue/bacula-rescue/$host
+case $os in
+ Linux)
+  ;;
+ FreeBSD | SunOS | IRIX)
+   echo ""
+   echo "This code is not yet adapted to this OS"     
+   exit 1
+   ;;
+ *)
+   echo ""
+   echo "Unknown operating system type: $os"     
+   exit 1
+   ;;
+esac
+if [ ! `whoami` = "root" ] ; then
+  echo ""
+  echo "You need to be root to run this script ..."
+  echo ""
+  exit 1
+fi
+
+#
+#  First collect information
+#
+rm -rf format.* partition.* $di create-* $scr
+echo "Begin collecting system info ..."
+mkdir -p $di
+cd $di
+mount -l >mount.bsi
+ fdisk -l|grep :|grep -v identifier|grep -v $usbdev|awk '{print $2}'|cut -d: -f1 >devtmp
+cat devtmp|while read line;do
+li=`echo $line|cut -d/ -f3`
+fdisk -l $line > fdisk.$li
+parted $line print > parted.$li
+done
+rm devtmp
+
+mount -l -t jfs >mount.jfs.bsi
+blkid |grep jfs >blkid.jfs.bsi
+mount -l -t vfat >mount.vfat.bsi
+blkid |grep vfat >blkid.vfat.bsi
+mount -l -t xfs >mount.xfs.bsi
+blkid |grep xfs >blkid.xfs.bsi
+mount -l -t hfs >mount.hfs.bsi
+blkid |grep hfs >blkid.hfs.bsi
+mount -l -t hfsplus >mount.hfsplus.bsi
+blkid |grep hfsplus >blkid.hfsplus.bsi
+mount -l -t fuseblk >mount.fuseblk.bsi
+mount -l -t ext2 >mount.ext2.bsi
+blkid |grep ext2 >blkid.ext2.bsi
+mount -l -t ext3 >mount.ext3.bsi
+blkid |grep ext3 >blkid.ext3.bsi
+mount -l -t ext4 >mount.ext4.bsi
+blkid |grep ext4 >blkid.ext4.bsi
+
+########################################## problem
+#blkid |grep ntfs >mount.ntfs.bsi
+
+blkid |grep ntfs >blkid.ntfs.bsi
+touch mount.ntfs.bsi
+cat mount.fuseblk.bsi |awk '{print $1}'|while read line; do
+blkid|grep $line|grep ntfs>/dev/null 2>&1
+if [ $? = 0 ];then
+a=`cat mount.fuseblk.bsi|grep $line|sed 's/fuseblk/ntfs/g'`
+echo $a >>mount.ntfs.bsi
+fi
+done
+
+###########################################3
+
+mount -l -t reiserfs >mount.reiser.bsi
+blkid |grep reiserfs >blkid.reiserfs.bsi
+cp /etc/fstab fstab.bsi
+cp /etc/mtab  mtab.bsi     
+df -Tl >df.bsi
+
+
+
+# Pickup all disks except USB_DEV
+sfdisk -s | grep -v ${usbdev}  >sfdisk.disks.bsi
+#sfdisk -s  >sfdisk.disks.bsi
+grep "^/dev/" sfdisk.disks.bsi | sed -n 's%\(^/dev/[A-Za-z]*\):.*$%\1%p' >disks.bsi
+for i in `cat disks.bsi`; do
+   j=`echo $i | cut -c6-`
+   sfdisk -l $i >sfdisk.$j.bsi 
+   sfdisk -d $i >sfdisk.make.$j.bsi
+done
+cat /proc/swaps > swaps.bsi
+route -n >route.bsi
+ifconfig >ifconfig.bsi
+
+# Gather LVM information
+# Only tested on LVM2
+dolvm=0
+if  which lvm > /dev/null 2>/dev/null ; then
+    echo "Gathering LVM information"
+    dolvm=1
+
+    lvm pvs --noheadings --nosuffix -o pv_name,vg_name | cat > lvm-pv.bsi
+    lvm vgs --noheadings --nosuffix -o vg_name,vg_extent_size --units=k | cat > lvm-vg.bsi
+    lvm lvs --noheadings --nosuffix -o lv_name,vg_name,lv_size --units=k | cat > lvm-lv.bsi
+fi
+
+echo "Done collecting info."
+
+#
+# Done collecting information
+#
+
+
+echo "Begin creating scripts ..."
+#
+# First create partitioning script(s)
+#
+mkdir -p $scr
+for i in `cat disks.bsi`; do
+  j=`echo $i | cut -c6-`
+  cat >$scr/partition.$j <<END_OF_DATA
+
+#!/bin/sh
+#
+#  Partition disk $i  -- created by getdiskinfo
+echo ""
+echo "This script will repartition disk $i."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK $i !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi 
+fi
+echo "Partitioning disk $i"
+# zap partition info
+dd if=/dev/zero of=$i bs=512 count=1
+# repartition
+sfdisk --force $i <$dirusb/diskinfo/sfdisk.make.$j.bsi | less
+echo ""
+echo "The previous partitioning was:"
+cat $dirusb/diskinfo/sfdisk.$j.bsi
+#
+echo ""
+echo "The new partitioning is:"
+sfdisk -l $i
+echo ""
+echo "If the disk is correctly partitioned, you should"
+echo "now run the \"format.$j\" script."
+echo ""
+partprobe >>/dev/null 2>&1
+END_OF_DATA
+
+
+chmod 755 $scr/partition.$j
+done
+echo "Done making partitioning scripts"
+
+if [ $dolvm -eq 1 ] ; then
+# 
+# LVM phase 1: create the Physical Volumess
+#
+    cat > $scr/create-pv <<EOF
+#!/bin/sh
+#
+# Create PVs for LVM -- created by getdiskinfo
+echo ""
+echo "This script will format all partitions listed in diskinfo/lvm-pv.bsi"
+echo ""
+echo "IT WILL DESTROY ALL DATA ON THESE PARTITIONS!!!!"
+echo ""
+EOF
+    for pv in `cat lvm-pv.bsi | awk '{print $1}'`; do
+        echo "echo \"    $pv\"" >> $scr/create-pv
+    done
+
+    cat >> $scr/create-pv <<EOF
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi 
+fi
+EOF
+    for pv in `cat lvm-pv.bsi | awk '{print $1}'`; do
+        echo "echo \"Creating PV on $pv\"" >> $scr/create-pv
+        echo "lvm pvcreate -ff -y -v $pv" >> $scr/create-pv
+    done
+    echo "echo \"Done.\"" >> $scr/create-pv
+    echo "echo \"If there were no errors, run create-vg to create the volume groups.\"" >> $scr/create-pv
+    chmod +x $scr/create-pv
+
+#
+# LVM phase 2: create Volume Groups
+#
+    cat > $scr/create-vg <<EOF
+#!/bin/sh
+echo ""
+echo "This script will create all volume groups listed in diskinfo/lvm-vg.bsi"
+echo "You must have sucesfully run create-pv to create the requesite PVs first"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi
+fi
+EOF
+    cat lvm-vg.bsi | awk '{print $1, $2}' | while read vg pesize ; do
+        echo "echo \"Creating VG $vg PE extent size $pesize kbytes"\" >> $scr/create-vg
+        pelist=""
+        for pv in `cat lvm-pv.bsi | awk "\\\$2 == \"$vg\" { print \\\$1 }"` ; do
+            pelist="$pelist $pv"
+        done
+        echo "lvm vgcreate $vg -v -s ${pesize}k $pelist" >> $scr/create-vg
+    done
+    echo "echo \"Done.\"" >> $scr/create-vg
+    echo "echo \"If there were no errors, run create-lv to create the logical volumes.\"" >> $scr/create-vg
+    chmod +x $scr/create-vg
+
+
+#
+# LVM phase 3: create Logical Volumes 
+#
+# One quick sidenote: this script creates LVs with a size based on the
+# physical extent count, rather than the size in bytes.  This is because
+# at the time of writing this script, lvdisplay erroneously prints out
+# the size in 512 byte sector count rather than 1024 byte blocks.
+# Using the extent count should allow this script to continue to work
+# even after the bug is fixed.
+
+    cat > $scr/create-lv <<EOF
+#!/bin/sh
+echo ""
+echo "This script will create all logical volumes listed in diskinfo/lvm-lv.bsi"
+echo "You must have sucesfully run create-vg to create the requesite VGs first"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi
+fi
+EOF
+    cat lvm-lv.bsi | awk '{print $1, $2, $3}' | while read lv vg lvsize ; do
+        # lv=`echo $lv | sed -e 's/.*\///'`
+        echo "echo \"Creating LV $lv\"" >> $scr/create-lv
+        echo "lvm lvcreate -L ${lvsize}k $vg -n $lv" >> $scr/create-lv
+    done
+    chmod +x $scr/create-lv
+fi
+
+#
+# Create formatting script(s)
+#
+echo "Begin making formatting script(s) ..."
+for i in `cat disks.bsi`; do
+  j=`echo $i | cut -c6-`
+  cat >$scr/format.$j <<END_OF_DATA
+#!/bin/sh
+#
+#  Format all partitions on disk $i -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk $i."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK $i !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x\$a = xyes ] ; then
+   check="-c"
+else
+   check=
+fi
+else
+   check=
+fi
+END_OF_DATA
+
+   # Find swap partitions in output from sfdisk
+   k=`grep "^$i.*82  Linux swap" sfdisk.$j.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+   fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done    
+   echo "echo \"Formatting $disk -- swap partition\"" >>$scr/format.$j
+      echo "mkswap $check -U $u $disk" >>$scr/format.$j
+      echo "echo \"\"" >>$scr/format.$j
+   done
+
+   # Find ext2 partitions in mount output
+   k=`grep "^$i" mount.ext2.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+    fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+   echo "echo \"Formating $disk -- ext2 partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.ext2.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ext2 -v \$check $disk" >>$scr/format.$j
+      else
+         echo "mkfs.ext2 -v \$check -L $label -U $u $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done
+   # Find ext3 partitions in mount output
+   k=`grep "^$i" mount.ext3.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+    fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+    echo "echo \"Formating $disk -- ext3 partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.ext3.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ext3 -v -j \$check -U $u $disk" >>$scr/format.$j
+      else
+         echo "mkfs.ext3 -v -j \$check -L $label -U $u $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done
+
+
+# Find ext4 partitions in mount output
+   k=`grep "^$i" mount.ext4.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+    fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+    echo "echo \"Formating $disk -- ext4 partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.ext4.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ext4 -v -j \$check -U $u $disk" >>$scr/format.$j
+      else
+         echo "mkfs.ext4 -v -j \$check -L $label -U $u $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done
+
+ # Find xfs partitions in mount output
+   k=`grep "^$i" mount.xfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+   
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done
+
+
+   
+     echo "echo \"Formating $disk -- xfs partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.xfs.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.xfs -f \$check  $disk" >>$scr/format.$j
+      else
+         echo "mkfs.xfs -f \$check -L $label  $disk" >>$scr/format.$j
+      fi
+       echo "xfs_admin -U $u $disk">>$scr/format.$j
+      echo "echo \"\"" >>$scr/format.$j
+   done 
+
+
+ # Find jfs partitions in mount output
+   k=`grep "^$i" mount.jfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+ fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+    
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done
+     echo "echo \"Formating $disk -- jfs partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.jfs.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.jfs -f \$check  $disk" >>$scr/format.$j
+      else
+         echo "mkfs.jfs -f \$check -L $label $disk" >>$scr/format.$j
+      fi
+        echo "jfs_tune -U $u $disk " >>$scr/format.$j
+      echo "echo \"\"" >>$scr/format.$j
+   done 
+ # Find vfat partitions in mount output
+   k=`grep "^$i" mount.vfat.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     u=`echo $u|sed 's/-//g'`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+      echo "echo \"Formating $disk -- vfat partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.vfat.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.vfat \$check -i $u $disk" >>$scr/format.$j
+      else
+         echo "mkfs.vfat \$check -n $label -i $u $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done
+ # Find reiserfs partitions in mount output
+   k=`grep "^$i" mount.reiser.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+      fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done
+     echo "echo \"Formating $disk -- reiser partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.reiser.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkreiserfs -u $u $disk" >>$scr/format.$j
+      else
+         echo "mkreiserfs -l $label -u $u $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done
+
+
+# Find hfs partitions in mount output
+
+   k=`grep "^$i" mount.hfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     echo "echo \"Formating $disk -- hfs partition\"" >>$scr/format.$j
+       label=`grep "^$disk" mount.hfs.bsi  |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.hfs \$check  $disk" >>$scr/format.$j
+      else
+         echo "mkfs.hfs \$check -v $label  $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done 
+
+
+# Find hfsplus partitions in mount output
+
+   k=`grep "^$i" mount.hfsplus.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     
+      echo "echo \"Formating $disk -- hfsplus partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.hfsplus.bsi  |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.hfsplus \$check  $disk" >>$scr/format.$j
+      else
+         echo "mkfs.hfsplus \$check -v $label  $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done
+
+
+# Find ntfs partitions in mount output
+   k=`grep "^$i" mount.ntfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     
+      echo "echo \"Formating $disk -- ntfs partition\"" >>$scr/format.$j
+      label=`grep "^$disk" mount.ntfs.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ntfs \$check  $disk" >>$scr/format.$j
+      else
+         echo "mkfs.ntfs \$check -L $label  $disk" >>$scr/format.$j
+      fi
+      echo "echo \"\"" >>$scr/format.$j
+   done
+   chmod 755 $scr/format.$j
+done
+#
+# Create LVM formatting scripts(s)
+#
+# Somebody more clever than I with bash scripting
+# could probably factor a lot of this code out.
+#
+if [ $dolvm -eq 1 ] ; then
+    echo "Begin making LVM formatting script(s) ..."
+    for i in `cat lvm-vg.bsi | awk '{print $1}'`; do
+        cat >$scr/format.$i <<END_OF_DATA
+#!/bin/sh
+#
+#  Format all partitions on VG $i -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all LVs on VG $i."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK $i !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x\$a = xyes ] ; then
+   check="-c"
+else
+   check=
+fi
+else
+check=
+fi
+END_OF_DATA
+
+   # Find swap partitions in output from sfdisk
+   
+    mapper="/dev/mapper/${i}"
+   k=`grep "^$mapper" swaps.bsi | awk '{print $1}'`
+   for disk in $k; do
+   fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+   echo "echo \"Formatting $disk -- swap partition\"" >>$scr/format.$i
+      echo "mkswap $check -U $u $disk" >>$scr/format.$i
+      echo "echo \"\"" >>$scr/format.$i
+   done
+
+   # Find ext2 partitions in mount output
+   k=`grep "^$mapper" mount.ext2.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+    fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+   echo "echo \"Formating $disk -- ext2 partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.ext2.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ext2 -v \$check $disk" >>$scr/format.$i
+      else
+         echo "mkfs.ext2 -v \$check -L $label -U $u $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done
+   # Find ext3 partitions in mount output
+   k=`grep "^$mapper" mount.ext3.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+    fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+    echo "echo \"Formating $disk -- ext3 partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.ext3.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ext3 -v -j \$check -U $u $disk" >>$scr/format.$i
+      else
+         echo "mkfs.ext3 -v -j \$check -L $label -U $u $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done
+
+
+# Find ext4 partitions in mount output
+   k=`grep "^$mapper" mount.ext4.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+    fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+    echo "echo \"Formating $disk -- ext4 partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.ext4.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ext4 -v -j \$check -U $u $disk" >>$scr/format.$i
+      else
+         echo "mkfs.ext4 -v -j \$check -L $label -U $u $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done
+
+ # Find xfs partitions in mount output
+   k=`grep "^$mapper" mount.xfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+   
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done
+
+
+   
+     echo "echo \"Formating $disk -- xfs partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.xfs.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.xfs -f \$check  $disk" >>$scr/format.$i
+      else
+         echo "mkfs.xfs -f \$check -L $label  $disk" >>$scr/format.$i
+      fi
+       echo "xfs_admin -U $u $disk">>$scr/format.$i
+      echo "echo \"\"" >>$scr/format.$i
+   done 
+
+
+ # Find jfs partitions in mount output
+   k=`grep "^$mapper" mount.jfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+ fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+    
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done
+     echo "echo \"Formating $disk -- jfs partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.jfs.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.jfs -f \$check  $disk" >>$scr/format.$i
+      else
+         echo "mkfs.jfs -f \$check -L $label $disk" >>$scr/format.$i
+      fi
+        echo "jfs_tune -U $u $disk " >>$scr/format.$i
+      echo "echo \"\"" >>$scr/format.$i
+   done 
+ # Find vfat partitions in mount output
+   k=`grep "^$mapper" mount.vfat.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     u=`echo $u|sed 's/-//g'`
+     fi
+     fields=$(( fields - 1 ))
+     done  
+      echo "echo \"Formating $disk -- vfat partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.vfat.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.vfat \$check -i $u $disk" >>$scr/format.$i
+      else
+         echo "mkfs.vfat \$check -n $label -i $u $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done
+ # Find reiserfs partitions in mount output
+   k=`grep "^$mapper" mount.reiser.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+      fields=`blkid |grep $disk|wc -w`
+     kid=`blkid |grep $disk`
+     while [ $fields -ne 0 ];do
+     echo $kid|awk "{print \$ $fields}"|grep UUID>/dev/null 2>&1
+     if [ $? = 0 ];then
+     u=`echo $kid|awk "{print \$ $fields}"|cut -d'"' -f2`
+     fi
+     fields=$(( fields - 1 ))
+     done
+     echo "echo \"Formating $disk -- reiser partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.reiser.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkreiserfs -u $u $disk" >>$scr/format.$i
+      else
+         echo "mkreiserfs -l $label -u $u $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done
+
+
+# Find hfs partitions in mount output
+
+   k=`grep "^$mapper" mount.hfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     echo "echo \"Formating $disk -- hfs partition\"" >>$scr/format.$i
+       label=`grep "^$disk" mount.hfs.bsi  |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.hfs \$check  $disk" >>$scr/format.$i
+      else
+         echo "mkfs.hfs \$check -v $label  $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done 
+
+
+# Find hfsplus partitions in mount output
+
+   k=`grep "^$mapper" mount.hfsplus.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     
+      echo "echo \"Formating $disk -- hfsplus partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.hfsplus.bsi  |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.hfsplus \$check  $disk" >>$scr/format.$i
+      else
+         echo "mkfs.hfsplus \$check -v $label  $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done
+
+
+# Find ntfs partitions in mount output
+   k=`grep "^$mapper" mount.ntfs.bsi | cut -d ' ' -f 1`
+   for disk in $k; do
+     
+      echo "echo \"Formating $disk -- ntfs partition\"" >>$scr/format.$i
+      label=`grep "^$disk" mount.ntfs.bsi |awk '{print $7}'|cut -d "]" -f1|cut -d "[" -f2`
+      if [ x$label = x ] ; then
+         echo "mkfs.ntfs \$check  $disk" >>$scr/format.$i
+      else
+         echo "mkfs.ntfs \$check -L $label  $disk" >>$scr/format.$i
+      fi
+      echo "echo \"\"" >>$scr/format.$i
+   done
+
+
+
+
+   chmod 755 $scr/format.$i
+   done
+fi
+
+cd $scr
+
+#
+# Create network start script
+#
+
+
+
+if [ -f ../../../scripts/nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+howmanyether=`ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo|wc -l`
+if [ $howmanyether -gt 1 ] ; then
+netline=0
+cp  ../../../scripts/dialognetworkorig  dialognetwork
+sed -i 's/howmany/'$howmanyether'/g' dialognetwork
+sed -i 's/DIAL/'$DIALOG'/g' dialognetwork
+ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo | while read LINE ; do
+confnet=$LINE
+netline=$(( netline + 1 ))
+if [ $netline -ne $howmanyether ];then
+echo $netline $LINE ' off  ' >> dialognetwork
+else 
+echo $netline $LINE ' off 2>ans ' >> dialognetwork
+fi
+done
+dial=`cat dialognetwork`
+
+echo $dial > dialognetwork
+chmod +x dialognetwork
+. ./dialognetwork
+       if [ $? = 1 ];then
+       exit 1
+       fi
+ans=`cat ans`
+rm ans
+rm dialognetwork
+ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo > net
+net=`cat net`
+netdevice=`echo $net |awk "{print \$ $ans}" `
+etherdone=1
+rm net
+
+fi
+
+
+if [ $etherdone = 0 ] ; then
+ ether=`ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo`
+
+else
+    ether=`echo $netdevice`
+fi
+
+ifconfig $ether 2>/dev/null >/dev/null
+if [ $? = 0 ] ; then
+  ip=`ifconfig $ether | grep inet | head -1 | sed -n 's/\ \+inet addr:\([0-9]\+\(\.[0-9]\+\)\{3\}\).*/\1/p'`
+  cat >start_network <<END_OF_DATA
+#!/bin/sh
+#
+#  Start network -- created by getdiskinfo
+#
+ip=$ip
+dev=$ether
+ifconfig lo up
+ifconfig \$dev up \$ip
+END_OF_DATA
+else
+   echo "Warning, no ethernet devices found."
+   echo "#!/bin/sh" >start_network
+fi
+
+ip=`route -n | grep UG | head -1 | awk '{print $2}'`
+dev=`route -n | grep UG | head -1 | awk '{print $8}'`
+cat >>start_network <<END_OF_DATA
+route add default gw $ip  $ether
+END_OF_DATA
+
+chmod 755 start_network
+
+
+
+cat >$scr/mount_drives <<END_OF_DATA
+#!/bin/sh
+#
+#  Mount disk drives  -- created by getdiskinfo
+#
+PATH=$PATH:/var/chroot/sbin:/var/chroot/bin
+END_OF_DATA
+TMP1=`mktemp gdi.1.XXXXXXXXXX`
+TMP2=`mktemp gdi.2.XXXXXXXXXX`
+if test x${TMP1} = x; then
+   TMP1="/tmp/1$$"
+   if test -f ${TMP1}; then
+      echo "Temp file security problem on: ${TMP1}"
+      exit 1
+   fi
+fi
+if test x${TMP2} = x; then
+   TMP2="/tmp/2$$"
+   if test -f ${TMP2}; then
+      echo "Temp file security problem on: ${TMP2}"
+      rm -f ${TMP1}
+      exit 1
+   fi
+fi
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.ext2.bsi >${TMP1}
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.ext3.bsi >>${TMP1}
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.reiser.bsi >>${TMP1}
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.hfs.bsi >>${TMP1}
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.xfs.bsi >>${TMP1}
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.jfs.bsi >>${TMP1}
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.fuseblk.bsi >>${TMP1}
+sed -n 's/\(^.*\)\ on\ \(.*\)\ type.*$/\1 \/media\/bs-rescue\/chroot\2/p' $di/mount.vfat.bsi >>${TMP1}
+
+# sort so that / is first
+sort -k 2 <${TMP1} >${TMP2}
+# output mkdir followed by its mount
+sed -n 's/\(^.*\)\ \(.*$\)/mkdir -p \2  #\1\
+mount \1 \2/p' ${TMP2} >>$scr/mount_drives
+
+# Now build unmount_drives
+cat >$scr/umount_drives <<END_OF_DATA
+#!/bin/sh
+#
+#  Unmount disk drives  -- created by getdiskinfo
+#
+END_OF_DATA
+sort -r -k 2 <${TMP1} >${TMP2}
+sed -n 's/\(^.*\)\ \(.*$\)/umount \2/p' ${TMP2} >>$scr/umount_drives
+echo "umount /mnt/cdrom 2>/dev/null >/dev/null" >>$scr/umount_drives
+echo "sync" >>$scr/umount_drives
+echo "sync" >>$scr/umount_drives
+
+rm -f ${TMP1} ${TMP2}
+
+chmod 755 $scr/mount_drives $scr/umount_drives
+
+#output result of blkid
+
+blkid | while read LINE ; do
+echo $LINE >> $cwd/$host/diskinfo/blkidinfo
+done
+
+#find raid devices
+
+.  $cwd/scripts/findraidevice/findraid_new
+
+if [ ! -f $cwd/$host/scripts/recreate_raid_arrays ];then
+echo "";echo "";echo "";echo "You do not seem to have any soft raid devices";echo "";echo "";echo ""
+fi
+
+. $cwd/scripts/new_baklient_conf
+. $cwd/scripts/get_serial
+rm $cwd/scripts/ans
+
+echo "Done building scripts."
+$DIALOG --title "That's it" --msgbox "We are done gathering info \n you can now restore your machine \n (in case it crashes) \n booting on this usb key \n \n \n P.S. If your computer's bios doesn't support booting off usb, \n insert the provided boot cd as well as this usb key and the magic will happen...." 600 600
diff --git a/rescue/linux/usb/src/scripts/mntinfo b/rescue/linux/usb/src/scripts/mntinfo
new file mode 100644 (file)
index 0000000..1d0eaf8
--- /dev/null
@@ -0,0 +1,9 @@
+Mounted disks are:                                                             Unmounted disks are:
+/dev/sda5                                                                              /dev/sda1
+/dev/sdb3                                                                              /dev/sda2
+/dev/sdc2                                                                              /dev/sda6
+/dev/sdc3                                                                              /dev/sdb1
+/dev/sdc1                                                                              /dev/sdb2
+/dev/sdd1                                                                              /dev/sdc5
+/dev/sdd3                                                                              /dev/sdc6
+/dev/sdd2                                                                              
diff --git a/rescue/linux/usb/src/scripts/new_baklient_conf b/rescue/linux/usb/src/scripts/new_baklient_conf
new file mode 100755 (executable)
index 0000000..13779da
--- /dev/null
@@ -0,0 +1,138 @@
+#!/bin/sh
+
+
+if [ -f /etc/bacula/bacula-fd.conf ];then
+cli="/etc/bacula/bacula-fd.conf"
+else
+cli="NOT"
+fi
+if [ $cli = "NOT" ];then
+if [ -f /opt/etc/bacula/bacula-fd.conf ];then
+cli="/opt/etc/bacula/bacula-fd.conf"
+else
+cli="NOT"
+fi
+fi
+
+if [ -f ../../../scripts/nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+if [  $cli = "NOT" ] ;then
+$DIALOG --title "lookin for bacula-fd.conf" --msgbox "oops, couldn't find a bacula-fd.conf \n I'm afraid you'll have to locate it yourself ..." 10 60
+  $DIALOG --backtitle "Where is bacula-fd.conf? " --title "(spacebar to select)" --aspect 12 --begin 4 3 --fselect / 30 60 2>tmp
+       if [ $? = 1 ];then
+        $DIALOG --title "No bacula-fd.conf" --msgbox "I AM AFRAID WE CAN'T DO ANYTHING WITHOUT A bacula-fd.conf \n \n \n THIS USB KEY WILL BE USELESS WITHOUT BACULA RUNNING ON THE CLIENT \n \n \n ABORTING !!!!!!!!!!!!!!!!!!" 600 600
+        echo "aborted!!!!!!!!!!!"
+        exit 1
+        fi
+
+  
+
+
+ bakonf=`cat tmp`
+echo $bakonf|grep bacula-fd.conf
+    if [ $? = 1 ];then
+    $DIALOG --title "No bacula-fd.conf" --msgbox "I AM AFRAID WE CAN'T DO ANYTHING WITHOUT A bacula-fd.conf \n \n \n THIS USB KEY WILL BE USELESS WITHOUT BACULA RUNNING ON THE CLIENT \n \n \n ABORTING !!!!!!!!!!!!!!!!!!" 600 600
+    echo "aborted!!!!!!!!!!!"
+    exit 1
+    fi
+    bakonf=`cat tmp`
+    rm tmp
+ cp $bakonf ../diskinfo/
+fi
+if [ ! $cli = "NOT" ] ;then
+$DIALOG --title "lookin for bacula-fd.conf" --yesno "we found a conf file in $cli, is that correct?" 10 60 
+
+
+if [ $? = 0 ];then
+  bakonf=$cli
+  else
+
+  $DIALOG --backtitle "Where is bacula-fd.conf? " --title "(spacebar to select)" --aspect 12 --begin 4 3 --fselect / 30 60 2>tmp
+    if [ $? = 1 ];then
+    $DIALOG --title "No bacula-fd.conf" --msgbox "I AM AFRAID WE CAN'T DO ANYTHING WITHOUT A bacula-fd.conf \n \n \n THIS USB KEY WILL BE USELESS WITHOUT BACULA RUNNING ON THE CLIENT \n \n \n ABORTING !!!!!!!!!!!!!!!!!!" 600 600
+    echo "aborted!!!!!!!!!!!"
+    exit 1
+    fi
+    bakonf=`cat tmp`
+    rm tmp
+
+
+   fi
+   echo $bakonf|grep bacula-fd.conf
+       if [ ! $? = 0 ];then
+        $DIALOG --title "No bacula-fd.conf" --msgbox "I AM AFRAID WE CAN'T DO ANYTHING WITHOUT A bacula-fd.conf \n \n \n THIS USB KEY WILL BE USELESS WITHOUT BACULA RUNNING ON THE CLIENT \n \n \n ABORTING !!!!!!!!!!!!!!!!!!" 600 600
+        echo "aborted!!!!!!!!!!!"
+        exit 1
+        fi
+   cp $bakonf ../diskinfo/
+
+
+fi
+if [ -f /etc/bacula/bconsole.conf ];then
+cli="/etc/bacula/bconsole.conf"
+else
+cli="NOT"
+fi
+if [ $cli = "NOT" ];then
+if [ -f /opt/etc/bacula/bconsole.conf ];then
+cli="/opt/etc/bacula/bconsole.conf"
+else
+cli="NOT"
+fi
+fi
+
+if [ $cli = "NOT" ] ;then
+$DIALOG --title "bconsole" --yesno "do you have bconsole installed on this machine ?" 10 60 
+  if [ $? = 0 ];then
+
+
+  $DIALOG --title "lookin for bconsole.conf" --msgbox "oops, couldn't find a bconsole.conf \n I'm afraid you'll have to locate it yourself ..." 10 60
+  $DIALOG --backtitle "Where is bconsole.conf? " --title "(spacebar to select)" --aspect 12 --begin 4 3 --fselect / 30 60 2>tmp
+    if [ $? = 1 ];then
+  $DIALOG --title "No bconsole.conf" --msgbox "O.K. We'll do without it \n but you will need to know your director's version \n when you restore" 10 60
+
+    else
+    bakonf=`cat tmp`
+    rm tmp
+
+
+  
+    cp $bakonf ../diskinfo/
+    fi
+  else
+  $DIALOG --title "No bconsole.conf" --msgbox "O.K. We'll do without it \n but you will need to know your director's version \n when you restore" 10 60
+  fi
+fi
+
+
+if [ ! $cli = "NOT" ] ;then
+$DIALOG --title "lookin for bconsole.conf" --yesno "we found a conf file in $cli, is that correct?" 10 60 
+  if [ $? = 0 ];then
+bakonf=$cli
+cp $bakonf ../diskinfo/
+  else
+
+  $DIALOG --backtitle "Where is bconsole.conf? " --title "(spacebar to select)" --aspect 12 --begin 4 3 --fselect / 30 60 2>tmp
+    if [ $? = 1 ];then
+    $DIALOG --title "No bconsole.conf" --msgbox "O.K. We'll do without it \n but you will need to know your director's version \n when you restore" 10 60
+
+    else
+    bakonf=`cat tmp`
+    rm tmp
+
+
+  echo $bakonf |grep bconsole.conf
+        if [ $? = 0 ];then 
+        cp $bakonf ../diskinfo/
+        else
+       $DIALOG --title "No bconsole.conf" --msgbox "That was no bconsole.conf, \n \n O.K. We'll do without it \n but you will need to know your director's version \n when you restore" 10 60
+       fi
+    fi
+
+  fi
+fi
diff --git a/rescue/linux/usb/src/scripts/partitionscript b/rescue/linux/usb/src/scripts/partitionscript
new file mode 100755 (executable)
index 0000000..f3efc97
--- /dev/null
@@ -0,0 +1,40 @@
+. ./unmount-all
+dd if=working/diskinfo/mbr.sda of=/dev/sda
+partprobe /dev/sda >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdb of=/dev/sdb
+partprobe /dev/sdb >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdc of=/dev/sdc
+partprobe /dev/sdc >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdd of=/dev/sdd
+partprobe /dev/sdd >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sde of=/dev/sde
+partprobe /dev/sde >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdf of=/dev/sdf
+partprobe /dev/sdf >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdg of=/dev/sdg
+partprobe /dev/sdg >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdh of=/dev/sdh
+partprobe /dev/sdh >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdi of=/dev/sdi
+partprobe /dev/sdi >/dev/null 2>&1
+. ./unmount-all
+. ./unmount-all
+dd if=working/diskinfo/mbr.sdj of=/dev/sdj
+partprobe /dev/sdj >/dev/null 2>&1
+. ./unmount-all
diff --git a/rescue/linux/usb/src/scripts/release_raids b/rescue/linux/usb/src/scripts/release_raids
new file mode 100755 (executable)
index 0000000..43fc91d
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+umount -a >/dev/null 2>&1
+lvscan >/dev/null 2>&1
+if [ $? = 0 ];then
+lvscan |awk '{print $2}'>tmp
+       cat tmp |cut -d"'" -f2|while read line;do
+               if [ ! $line = "" ];then
+               lvremove -f $line 
+               fi
+       done
+rm tmp
+fi
+sleep 5
+for i in `cat /proc/mdstat |grep md|awk '{print $1}'`;do
+mdadm --stop /dev/$i
+done
+swapoff -a
+umount -a >/dev/null 2>&1
diff --git a/rescue/linux/usb/src/scripts/restore/all_raids_there b/rescue/linux/usb/src/scripts/restore/all_raids_there
new file mode 100644 (file)
index 0000000..b6104bf
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+cat checkraidtemp|while read line;do
+                       field=`echo $line|wc -w`
+                       while [ $field -ne 0 ];do
+                       a=`echo $line|awk "{ print \$ $field }"`
+                       echo $a|grep /dev|grep -v md >/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               blkid $a |grep raid>/dev/null 2>&1
+                                       if [ ! $? = 0 ];then
+                                       dis=${a%?}
+                                       echo $dis>>disklist
+                                       fi
+                                       
+                               fi
+                       field=$(( field - 1 ))
+                       done
+done
diff --git a/rescue/linux/usb/src/scripts/restore/change_names_new b/rescue/linux/usb/src/scripts/restore/change_names_new
new file mode 100755 (executable)
index 0000000..e1b9105
--- /dev/null
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+sed -i '/^$/d' working/diffdir/newdisk
+cat working/diffdir/newdisk|while read line;do
+
+
+new=`echo $line |cut -d" " -f1|cut -d/ -f3`
+old=`echo $line|cut -d/ -f5`
+oldadded=`echo $old|tr "[a-z]" "[A-Z]"`
+newadded=`echo $new|tr "[a-z]" "[A-Z]"`
+
+       ls working/diskinfo/|while read file;do
+
+
+       #sed -i 's/$old/$newadded/g' working/diskinfo/$file
+         sed -i 's/'$old'/'$newadded'/g' working/diskinfo/$file
+
+       done
+               ls working/scripts/|while read file;do
+
+
+               sed -i 's/'$old'/'$newadded'/g' working/scripts/$file
+               done
+done
+               
+cat working/diffdir/newdisk|while read line;do
+
+
+new=`echo $line |cut -d" " -f1|cut -d/ -f3`
+old=`echo $line|cut -d/ -f5`
+oldadded=`echo $old|tr "[a-z]" "[A-Z]"`
+newadded=`echo $new|tr "[a-z]" "[A-Z]"`
+
+       ls working/diskinfo/|while read file;do
+
+
+       sed -i 's/'$newadded'/'$new'/g' working/diskinfo/$file
+       done
+               ls working/scripts/|while read file;do
+
+
+                       sed -i 's/'$newadded'/'$new'/g' working/scripts/$file
+                       done
+               
+
+
+
+
+
+               
+done
+
+cat working/diffdir/newdisk|while read line;do
+new=`echo $line |cut -d" " -f1|cut -d/ -f3`
+old=`echo $line|cut -d/ -f5`
+oldadded=`echo $old|tr "[a-z]" "[A-Z]"`
+newadded=`echo $new|tr "[a-z]" "[A-Z]"`
+       
+
+               ls working/diskinfo/|grep $old|while read filename;do
+               filename2=`echo $filename`
+               newname=`echo $filename2|sed -e 's/'$old'/'$newadded'/g'`
+               
+
+               mv working/diskinfo/$filename working/diskinfo/$newname
+               done
+
+       
+
+               ls working/scripts/|grep $old|while read filename;do
+               filename2=`echo $filename`
+               newname=`echo $filename2|sed -e 's/'$old'/'$newadded'/g'`
+               
+               mv working/scripts/$filename working/scripts/$newname
+               done
+
+done
+
+cat working/diffdir/newdisk|while read line;do
+new=`echo $line |cut -d" " -f1|cut -d/ -f3`
+old=`echo $line|cut -d/ -f5`
+oldadded=`echo $old|tr "[a-z]" "[A-Z]"`
+newadded=`echo $new|tr "[a-z]" "[A-Z]"`
+               ls working/diskinfo/|grep $newadded|while read filename;do
+               newname=`echo $filename|sed -e 's/'$newadded'/'$new'/g'`
+               
+               mv working/diskinfo/$filename working/diskinfo/$newname
+               done
+
+       
+               ls working/scripts/|grep $newadded|while read filename;do
+               newname=`echo $filename|sed -e 's/'$newadded'/'$new'/g'`
+               
+               mv working/scripts/$filename working/scripts/$newname
+
+               done
+               
+
+done
+
+
diff --git a/rescue/linux/usb/src/scripts/restore/check_lvm b/rescue/linux/usb/src/scripts/restore/check_lvm
new file mode 100755 (executable)
index 0000000..e535adc
--- /dev/null
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+if [ -f disklistmp ];then
+rm disklistmp
+fi
+if [ -f added_diskstmp ];then
+rm added_diskstmp
+fi
+touch added_diskstmp
+
+if [ -f working/scripts/create-vg ];then
+
+               cat disklist|while read line;do
+                       if [ ! $line = "" ];then
+                       echo $line >>disklistmp
+                       fi
+               done
+
+
+if [ -f raidisks ];then
+               cat raidisks|while read line;do
+                       if [ ! $line = "" ];then
+                       echo $line >>disklistmp
+                       fi
+               done
+fi
+
+cat disklistmp|while read line;do
+if [ ! $line = "" ];then
+grep $line working/scripts/create-vg>>/dev/null 2>&1
+
+       if [ $? = 0 ];then
+
+                       b=`grep $line working/scripts/create-vg`
+                       field=`echo $b|wc -w`
+                       while [ $field -ne 0 ];do
+                       a=`echo $b|awk "{ print \$ $field }"`
+                       echo $a|grep /dev >/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               grep $a disklist>>/dev/null 2>&1
+                                       if [ ! $? = 0 ];then
+                                       echo $a >>added_disks
+                                       
+                                       fi
+                               fi
+                       field=$(( field - 1 ))
+                       done
+       fi
+fi
+done
+
+                  cat added_disks|while read line;do
+                       if [ ! $line = "" ];then
+                       echo $line|grep md>/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               grep $line checkraidtemp>>/dev/null 2>&1
+                                       if [ ! $? = 0 ];then
+                                       a=`grep $line working/scripts/recreate_raid_arrays`
+                                       field=`echo $a|wc -w`
+                                               while [ $field -ne 0 ];do
+                                               b=`echo $a|awk "{ print \$ $field }"`
+                                               echo $b|grep /dev |grep -v md >/dev/null 2>&1
+                                                       if [ $? = 0 ];then
+                                                       grep $b disklist>>/dev/null 2>&1
+                                                               if [ ! $? = 0 ];then
+                                                               echo $b >>added_diskstmp
+                                       
+                                                               fi
+                                                       fi
+                                               field=$(( field - 1 ))
+                                               done
+                                       fi
+                               else
+
+                               cat disklist|grep $line>>/dev/null 2>&1
+                                 if [ ! $? = 0 ];then
+                                 echo $line >>disklist
+                                 fi
+                               fi
+
+
+
+                       fi
+               done
+
+if [ -f disklistmp ];then
+rm disklistmp
+fi
+touch disklistmp
+               cat disklist|while read line;do
+                       if [ ! $line = "" ];then
+                               grep $line disklistmp>>/dev/null 2>&1
+                               if [ ! $? = 0 ];then
+                               echo $line >>disklistmp
+                               fi
+                       fi
+               done
+
+               cat added_diskstmp|while read line;do
+                       if [ ! $line = "" ];then
+                               grep $line disklistmp>>/dev/null 2>&1
+                               if [ ! $? = 0 ];then
+                               echo $line >>disklistmp
+                               fi
+                       fi
+               done
+
+mv disklistmp disklist
+echo "">added_disks
+fi
+if [ -f disklistmp ];then
+rm disklistmp
+fi
+if [ -f added_diskstmp ];then
+rm added_diskstmp
+fi
+
+
+
diff --git a/rescue/linux/usb/src/scripts/restore/checkdiffnew2 b/rescue/linux/usb/src/scripts/restore/checkdiffnew2
new file mode 100755 (executable)
index 0000000..f4ba681
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+if [ -d difftmpdir ];then
+rm -r difftmpdir
+fi
+if [ -f newdiskorder ];then
+rm -r newdiskorder
+fi
+if [ -d working ];then
+rm -r working
+fi
+cp -r clients/$clientdir working
+
+mkdir -p difftmpdir
+usb=`blkid |grep home-rw|cut -d: -f1`
+usb=${usb%?}
+fdisk -l |grep /dev|grep -v $usb|grep -v /dev/md|grep :|cut -d: -f1|cut -d" " -f2|while read line;do
+l=`echo $line |cut -d"/" -f3`
+echo "/dev/"$l>difftmpdir/hdparm.$l
+hdparm -i $line |grep Serial|cut -d, -f3 >>difftmpdir/hdparm.$l
+done
+for i in `ls difftmpdir`;do
+diff difftmpdir/$i clients/$clientdir/diskinfo/$i >>/dev/null
+  if [ ! $? = 0 ];then
+oldserial=`grep Serial clients/$clientdir/diskinfo/$i`
+oldev=`grep /dev clients/$clientdir/diskinfo/$i`
+       for n in `ls difftmpdir`;do
+       grep $oldserial difftmpdir/$n>/dev/null
+               if [ $? = 0 ];then
+               newdev=`grep /dev difftmpdir/$n`
+               echo "device " $oldev "has become " $newdev
+               echo $newdev " previously " $oldev>>newdiskorder
+               fi
+
+       done
+  fi
+done
+
diff --git a/rescue/linux/usb/src/scripts/restore/checkraid b/rescue/linux/usb/src/scripts/restore/checkraid
new file mode 100755 (executable)
index 0000000..13cf451
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh 
+
+
+
+
+
+if [ -f working/scripts/recreate_raid_arrays ];then
+
+if [ ! -f lvmdisks ];then
+touch lvmdisks
+fi
+cat disklist|while read LINE;do
+disk=`echo $LINE`
+grep $disk working/scripts/recreate_raid_arrays |while read line;do
+     
+       
+       grep $disk checkraidtemp >>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $line>>checkraidtemp
+               field=`echo $line|wc -w`
+                       while [ $field -ne 0 ];do
+                       a=`echo $line|awk "{ print \$ $field }"`
+                       echo $a|grep /dev |grep -v md|grep -v $disk>/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               grep $a disklist
+                                       if [ ! $? = 0 ];then
+                                       echo $a >>added_disks
+                                       
+                                       fi
+                               fi
+                       field=$(( field - 1 ))
+                       done
+
+
+
+                       field=`echo $line|wc -w`
+                       while [ $field -ne 0 ];do
+                       a=`echo $line|awk "{ print \$ $field }"`
+                       echo $a|grep  md|grep -v mdadm >/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               grep $a lvmdisks
+                                       if [ ! $? = 0 ];then
+                                       echo $a >> raidisks
+                                       
+                                       fi
+                               fi
+                       field=$(( field - 1 ))
+                       done
+
+
+
+               fi
+        
+done
+done
+               cat disklist|while read line;do
+                       if [ ! $line = "" ];then
+                       echo $line >>disklistmp
+                       fi
+               done
+                               cat added_disks|while read line;do
+                                       if [ ! $line = "" ];then
+                                       echo $line>>disklistmp
+                                       fi
+                               done
+mv disklistmp disklist
+
+echo "" > added_disks
+fi
diff --git a/rescue/linux/usb/src/scripts/restore/choosedisk b/rescue/linux/usb/src/scripts/restore/choosedisk
new file mode 100755 (executable)
index 0000000..85e4176
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+usb=`blkid |grep bs-rescue|cut -d: -f1`
+usb=${usb%?}
+
+if [ -f nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+
+s="off \\"
+if [ -f disklist ];then
+rm disklist
+fi
+if [ -f alldisks ];then
+rm alldisks
+fi
+x=1
+
+cp dial dialogtest
+
+sed -i 's/DIALOG/'$DIALOG'/g' dialogtest
+fdisk -l|grep "/dev"|grep -v loop|grep -v md|grep -v mapper|grep -v $usb|while read line;do
+b=`echo $line |cut -d" " -f1|cut -c 1`
+
+if [ "$b" = "/" ];then
+f=1
+else
+f=2
+fi
+line=`echo $line |cut -d" " -f$f`
+l=${line%?}
+X=`echo $l |tail -c2`
+echo $X | egrep '^[0-9]+$' >/dev/null 2>&1
+       if [ "$?" -eq "0" ]; then
+       l=${l%?}
+       fi
+X=`echo $l |tail -c2`
+               if [ "$X" = ":" ];then
+               l=${l%?}
+               fi
+       cat working/diffdir/newdiskorder |grep $l|while read LINE;do
+       echo $LINE|cut -d" " -f1|grep $l>>/dev/null
+               if [ $? = 0 ];then
+               echo $LINE|cut -d" " -f 2-3>previous
+               break
+               fi
+
+                       
+               done
+touch previous
+previous=`cat previous`
+previous='"'$previous'"'
+rm previous
+
+                       if [ "$previous" = "" ];then
+                       previous="-"
+                       fi
+echo $line $previous $s >>dialogtest
+echo $x>tmp
+echo $line>>alldisks
+x=$(( x + 1 ))
+
+done
+y=`cat tmp`
+rm tmp
+sed -i s/zzz/$y/g dialogtest
+echo "2>ans">>dialogtest
+chmod +x dialogtest
+./dialogtest
+if [ ! $? = 0 ];then
+exit 1
+fi
+
+a=1
+sed -i 's@//@ /@g' ans
+sed -i 's@:@ @g' ans
+
+b=`cat ans|wc -w`
+
+for i in `seq 1 $b`;do
+answer=`cat ans |awk "{ print \$ $i }"`
+echo $answer"">>disklist
+done
+
+
diff --git a/rescue/linux/usb/src/scripts/restore/clientdir b/rescue/linux/usb/src/scripts/restore/clientdir
new file mode 100755 (executable)
index 0000000..322dd57
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+s="off \\"
+
+if [ -f ./nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+x=1
+if [ -f clientmp ];then
+rm clientmp
+fi
+
+cp client clientmp
+
+ls ../clients|while read line;do
+b=`echo $line |cut -d" " -f1|cut -c 1`
+
+if [ "$b" = "/" ];then
+f=1
+else
+f=2
+fi
+line=`echo $line |cut -d" " -f$f`
+echo $line "-" $s >>clientmp
+echo $x>tmp
+x=$(( x + 1 ))
+
+done
+y=`cat tmp`
+rm tmp
+sed -i s/zzz/$y/g clientmp
+echo "2>ans">>clientmp
+chmod +x clientmp
+
+. ./clientmp
+if [ ! $? = 0 ];then
+exit 1
+fi
+
+clientdir=`cat ans|cut -d'"' -f2`
+
+rm ans
+#echo $clientdir
+
+
diff --git a/rescue/linux/usb/src/scripts/restore/dial b/rescue/linux/usb/src/scripts/restore/dial
new file mode 100644 (file)
index 0000000..8f1a8bf
--- /dev/null
@@ -0,0 +1 @@
+./dialog --checklist "what" 25 40 zzz \
diff --git a/rescue/linux/usb/src/scripts/restore/diskorpart b/rescue/linux/usb/src/scripts/restore/diskorpart
new file mode 100644 (file)
index 0000000..7eec0f6
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+
+
+
+X=`echo $disk |tail -c2`
+
+echo $X | egrep '^[0-9]+$' >/dev/null 2>&1
+       if [ "$?" -eq "0" ]; then
+        echo $disk "partition"
+       partordisk=part
+       else
+       echo $disk "whole disk"
+       partordisk=disk
+       echo $disk>>fulldisks
+       fi
+               
diff --git a/rescue/linux/usb/src/scripts/restore/do_lvm b/rescue/linux/usb/src/scripts/restore/do_lvm
new file mode 100755 (executable)
index 0000000..da162d8
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+
+if [ -f working/scripts/create-pv ];then
+
+if [ -f create-pv ];then
+rm create-pv
+fi
+
+  if [ -f create-lv ];then
+  rm create-lv
+  fi
+
+    if [ -f create-vg ];then
+    rm create-vg
+    fi
+if [ -f lvdisks ];then
+rm lvdisks
+fi
+touch create-pv
+touch create-lv
+touch create-vg
+touch lvdisks
+
+  if [ -f disklistmp ];then
+  rm disklistmp
+  fi
+               cat disklist|while read line;do
+                       if [ ! $line = "" ];then
+                               grep $line disklistmp>>/dev/null 2>&1
+                               if [ ! $? = 0 ];then
+                               echo $line >>disklistmp
+                               fi
+                       fi
+               done
+
+               cat raidisks|while read line;do
+                       if [ ! $line = "" ];then
+                               grep $line disklistmp>>/dev/null 2>&1
+                               if [ ! $? = 0 ];then
+                               echo $line >>disklistmp
+                               fi
+                       fi
+               done
+mv disklistmp totaldisks
+
+cat totaldisks|while read line;do
+
+  cat working/scripts/create-pv |grep pvcreate|grep $line|while read LINE ;do
+       li=`echo $LINE`
+       cat create-pv|grep "$li">>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $LINE >> create-pv
+               fi
+  done
+        cat working/scripts/create-vg |grep vgcreate|grep $line|while read LINE ;do
+       li=`echo $LINE`
+       cat create-vg|grep "$li">>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $LINE >> create-vg
+               fi
+        done
+   
+done
+
+
+cat create-vg|awk '{print $3}'|while read line;do
+
+        cat working/scripts/create-lv |grep lvcreate|grep $line|while read LINE ;do
+       li=`echo $LINE`
+       cat create-lv|grep "$li">>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $LINE >> create-lv
+               fi
+       if [ -f working/scripts/format.$line ];then
+       cat working/scripts/format.$line >>formatallscript
+       fi
+       cat lvdisks|grep $line>/dev/null 2>&1
+       if [ ! $? = 0 ];then
+       echo $line >>lvdisks
+       fi
+        done
+
+
+done
+
+
+
+
+
+fi
diff --git a/rescue/linux/usb/src/scripts/restore/full_disk b/rescue/linux/usb/src/scripts/restore/full_disk
new file mode 100644 (file)
index 0000000..fbfef36
--- /dev/null
@@ -0,0 +1,112 @@
+#!/bin/sh
+                               
+if [ -f nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+                               
+MB=MB                          part=`echo $disk|cut -d"/" -f3`
+                               fdisk -l /dev/$part |grep bytes|grep -v Units|awk '{print $5}'>samesize
+                               cat working/diskinfo/fdisk.$part |grep bytes|grep -v Units|awk '{print $5}'>samesize2
+                               diff samesize samesize2 >/dev/null 2>&1
+                       if [ ! $? = 0 ] ;then
+                               nowdisk=`cat samesize`
+                               oldisk=`cat samesize2`
+                               $DIALOG --title "different disk" --msgbox "The size of the disk you are trying to restore \n and the one we have backed up differ for /dev/$part  \n \n The old disk size was  $oldisk  \n And the actual disk size is  $nowdisk \n \n We'll have to do things manually" 600 600
+                               oldiskparted=`cat working/diskinfo/parted.$part`
+                               howmanyparts=`cat working/diskinfo/parted.$part|wc -l`
+                               howmanyparts=$(( $howmanyparts - 7 ))
+                                       $DIALOG --title "different disk" --yesno "Do you want to do it manually \n ( we will launch gparted) (yes) \n Or only adjust the LAST partition size to fit the disk ? \n (We only shrink the las partition, it will not claim empty space on the drive) (no)" 600 600
+                                       if [ $? = 0 ];then
+                                         if [ $DIALOG = Xdialog ];then
+                                         echo $$oldiskparted
+                                         $DIALOG --title "different disk" --msgbox "the old partition sizes for this disk was \n \n $oldiskparted \n \n We will now launch gparted so you can adjust you disk partitions " 600 600
+                               gparted /dev/$part
+                                         else
+                               $DIALOG --title "different disk" --msgbox "the old partition sizes for this disk was \n \n $oldiskparted \n \n please use fdisk or cfdisk to repartition your drive \n \n and the re-run this script pointing to the partitions of the new disks  \n (like /dev/sda1 ) instead of the whole disk (/dev/sda)" 600 600
+                                         exit 1
+                                         fi
+                                       else
+
+                                       a=` sfdisk -n /dev/$part < working/diskinfo/sfdisk.make.$part.bsi 2>&1`
+                                       echo $a > tmp
+                                       grep exceed tmp >/dev/null 2>&1
+                                              if [ $? = 0 ];then
+                                              tr ' ' '\n' < tmp >tmp2
+                                              cat tmp2|awk /given/,/sfdisk/ >tmp3
+                                              currentsize=`cat tmp3|grep -m1 "("|cut -d"(" -f2 |cut -d")" -f1`
+                                              maxsize=`cat tmp3|grep -m2 "("|cut -d"(" -f2 |cut -d")" -f1|tail -n1`
+                                              sed -i "s/$currentsize/$maxsize/g" working/diskinfo/sfdisk.make.$part.bsi
+                                              nowarn=1
+                                                 while [ $nowarn = 1 ];do
+                                                 a=` sfdisk -n /dev/$part < working/diskinfo/sfdisk.make.$part.bsi 2>&1`
+                                                 echo $a > tmp
+                                                grep exceed tmp >/dev/null 2>&1
+                                                       if [ $? = 0 ];then
+                                                       tr ' ' '\n' < tmp >tmp2
+                                                       cat tmp2|awk /given/,/sfdisk/ >tmp3
+                                                       currentsize=`cat tmp3|grep -m1 "("|cut -d"(" -f2 |cut -d")" -f1`
+                                                       maxsize=`cat tmp3|grep -m2 "("|cut -d"(" -f2 |cut -d")" -f1|tail -n1`
+                                                       sed -i "s/$currentsize/$maxsize/g" working/diskinfo/sfdisk.make.$part.bsi
+                                                       else
+                                                       nowarn=0
+                                                       fi
+                                                 done
+                                               partprobe /dev/$part >/dev/null 2>&1
+                                               . ./unmount-all
+                                               sfdisk /dev/$part < working/diskinfo/sfdisk.make.$part.bsi
+                                               rm tmp
+                                               rm tmp2
+                                               rm tmp3
+                                               fi
+                                       fi
+               else                                            
+                               echo ". ./unmount-all">>partitionscript
+                               #cat working/scripts/partition.$part>>fullrestorescript
+                               #echo "partprobe >/dev/null 2>&1">>fullrestorescript
+                               #echo "umount /dev/"$part"* >/dev/null 2>&1">>fullrestorescript
+                               echo "dd if=working/diskinfo/mbr."$part" of=/dev/"$part>>partitionscript
+                               echo "partprobe /dev/"$part" >/dev/null 2>&1">>partitionscript
+                               echo ". ./unmount-all">>partitionscript
+                  fi
+
+                       if [ -f formatscript ]; then
+                       rm formatscript
+                       fi
+cat >formatscript <<END_OF_DATA
+. ./unmount-all
+#
+#  Format all partitions on disk $disk -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk $disk."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK $disk !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x\$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+END_OF_DATA
+
+formatscripto=`ls working/scripts |grep $disk|grep format`
+cat working/scripts/$formatscripto |grep $disk|while read line;do
+                       echo $line >>formatscript
+
+                       done
+               cat formatscript>>formatallscript
+               rm formatscript
diff --git a/rescue/linux/usb/src/scripts/restore/get_serial_restore b/rescue/linux/usb/src/scripts/restore/get_serial_restore
new file mode 100644 (file)
index 0000000..9b60440
--- /dev/null
@@ -0,0 +1,134 @@
+#!/bin/sh
+host=$clientdir
+owd=/media/bs-rescue/bacula-rescue/clients                                             
+usb=`blkid |grep bs-rescue|cut -d: -f1`
+usb=${usb%?}
+if [ -d working/diffdir ];then
+rm -r  working/diffdir
+fi
+
+########################## here we get disks infos
+mkdir -p working/diffdir
+ blkid | awk '{ print $1 }'|grep -v loop|grep -v md|grep -v mapper|grep -v $usb|while read line;do
+line=${line%?}
+l=`echo $line |cut -d"/" -f3`
+echo "/dev/"$l > working/diffdir/uuid.$l
+
+
+a=`blkid $line |wc -w|xargs expr`
+while [ $a -ne 0 ];do
+blkid $line |awk "{print \$$a}"|grep UUID >/dev/null 2>&1
+if [ $? = 0 ];then
+blkid $line |awk "{print \$$a}"|grep UUID>>working/diffdir/uuid.$l
+break
+fi
+if [ $a = 1 ];then
+echo $line >> working/diffdir/uuid.disks.with.no.uuid
+
+fi
+a=$(( a - 1))
+done
+
+done
+
+fdisk -l |grep /dev|grep -v $usb|grep :|cut -d: -f1|cut -d" " -f2|while read line;do
+l=`echo $line |cut -d"/" -f3`
+
+dd if=$line of=working/diffdir/mbr.$l bs=1 count=512 >/dev/null 2>&1
+done
+
+############################## here we start to diff with the backed up files
+cd working/diffdir
+for i in `ls `;do                ########## first by uuid
+diff $i $owd/$host/diskinfo/$i >/dev/null 2>&1
+if [ ! $? = 0 ];then
+echo $i>>changedisks
+#else
+#i=${i%?}
+#echo "/dev/"`echo $i|cut -d. -f2` " previously /dev/"`echo $i|cut -d. -f2`>>newdisk
+fi
+done
+
+echo "">newdisk
+
+if [ -f changedisks ];then
+cat changedisks|while read line;do
+lin=${line%?}
+li=`echo $lin |cut -d. -f2`
+check=`cat newdisk|awk '{print $1}'`
+echo $check|grep $li
+if [ ! $? = 0 ];then
+echo $line|grep uuid>/dev/null 2>&1
+  if [ $? = 0 ];then
+  i=`grep UUID $line`
+ i=`echo $i|cut -d'"' -f2`
+ i=`echo $i|cut -d'"' -f1`
+   find $owd/$host/diskinfo -type f -exec grep -l $i {} +>/dev/null 2>&1
+    if [ $? = 0 ];then
+       check=`cat newdisk|awk '{print $1}'`
+       
+       echo $check|grep $li
+         if [ ! $? = 0 ];then   
+    a=`find $owd/$host/diskinfo/uuid.* -type f -exec grep -l $i {} +`
+    a=`echo $a|cut -d/ -f8|cut -d. -f2`
+    a=${a%?}
+    
+    echo "/dev/"`echo $lin|cut -d. -f2`" previously /dev/"$a>>newdisk
+          fi
+    fi
+
+  fi
+            if [ ! -f newdisk ];then
+            echo "">newdisk
+            fi  
+#grep `echo $line|cut -d. -f2` `echo newdisk |awk '{print $1}'|cut -d/ -f3` > /dev/null 2>&1
+          a=`cat newdisk|awk '{print $1}'`
+       
+          echo $a|grep $li
+         if [ ! $? = 0 ];then   
+          ########### then by mbr
+
+       echo $line|grep mbr>/dev/null 2>&1
+       if [ $? = 0 ];then
+         for i in `ls $owd/$host/diskinfo|grep mbr`;do
+         diff $line $owd/$host/diskinfo/$i >/dev/null 2>&1
+                 if [ $? = 0 ];then
+                  a=`cat newdisk|awk '{print $1}'`
+                  c=`echo $lin|cut -d. -f2`
+                  echo $a|grep $c
+                      if [ ! $? = 0 ];then  
+                    echo "/dev/"`echo $line|cut -d. -f2` " previously /dev/"`echo $i|cut -d. -f2` >>newdisk
+                      fi
+                 fi
+        done
+       fi        
+
+     fi
+fi
+done
+fi
+
+fdisk -l |grep /dev|grep -v $usb |grep -v /dev/md|grep :|cut -d: -f1|cut -d" " -f2|while read line ;do
+b=1
+  cat newdisk |grep $line|while read i ;do
+  a=`echo $i|cut -d" " -f1`
+    if [ $a = $line ];then
+    cat newdisk |grep $a|awk '{print $1}'|grep $a
+       if [ ! $? = 0 ];then
+         echo $i >> newdiskorder
+         b=0
+        fi
+     fi
+  done
+if [ $b = 1 ];then
+ cat newdisk |grep $line|awk '{print $1}'|grep $line
+       if [ ! $? = 0 ];then
+echo $line "previously" $line>>newdiskorder
+        fi
+fi
+done
+cd ../../
+
+
+
+
diff --git a/rescue/linux/usb/src/scripts/restore/lvm b/rescue/linux/usb/src/scripts/restore/lvm
new file mode 100644 (file)
index 0000000..2de7006
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+
+
+
+
+
+
+
+echo "your disk  seems to be part of a lvm volume group"
+                       echo "we will try to recreate it"
+
+                       num=`grep /dev working/scripts/create-vg |wc -w`
+                       num=$(( num - 6 ))
+                       numdev=$num                     
+                       
+                       num=$(( num * 2 ))
+                       num=$(( num + 1 ))
+               
+                               for n in `seq 3 2 $num`;do
+                               lvdisk=`grep /dev working/scripts/create-vg |cut -d"/" -f$n`
+                               ifraid=`echo $lvdisk|cut -c 1-2`
+
+
+                                 if [ "$ifraid" = "md" ];then
+                                       blkid |grep $lvdisk 
+                                       if [ ! $? = 0 ];then
+
+                                         grep $lvdisk working/scripts/recreate_raid_arrays>checkraidtemp
+                                         disk=$lvdisk
+                                         . ./restore2/raid_check_ifdev
+                                          modprobe md
+                               
+                                         . ./restore2/raid
+                                         
+                                        fi
+
+                                  else
+                                      
+                                      fdisk -l |grep $lvdisk >/dev/null
+                                       if [ ! $? = 0 ];then
+                                       
+                                       disk=$lvdisk
+                                       . ./restore2/full_disk
+                                       
+                                       fi
+                                  fi
+                               done
+
+                                       name=`ls /dev/mapper/* |grep -v control`
+                                       if [ ! $name = "" ];then
+                                       lvm lvremove -f $name
+                                       fi
+                                       . working/scripts/create-pv
+                                       . working/scripts/create-vg
+                                       . working/scripts/create-lv
+                                       exe=`ls working/scripts/format.*|grep -v sd|grep -v hd`
+######## have to try with many lvm
+########## maybe it formats them all
+########### which could make damage
+                                       . $exe
+                                       new=`grep /dev $exe`
+                                       fields=`echo $new|wc -w`
+                                       while [ $fields -ne 0 ];do
+                                       echo $new |awk "{print \$ $fields}"|grep /dev>/dev/null 2>&1
+                                       if [ $? = 0 ];then
+                                       a=`echo $new |awk "{print \$ $fields}"|grep /dev`
+                                       grep $a disklist
+                                       if [ ! $? = 0 ];then
+                                       echo $a >> disklist
+                                       fi
+                                       fi
+                                       fields=$(( fields - 1))
+                                       done
+                                       
+      
diff --git a/rescue/linux/usb/src/scripts/restore/main b/rescue/linux/usb/src/scripts/restore/main
new file mode 100644 (file)
index 0000000..ee98419
--- /dev/null
@@ -0,0 +1,187 @@
+#!/bin/sh
+
+
+raidiskdone=""
+if [ -f noprompt ];then
+rm noprompt
+fi
+
+if [ -f badblocksnoprompt ];then
+rm badblocksnoprompt
+fi
+
+if [ -f partitionscript ];then
+rm partitionscript
+fi
+if [ -f formatallscript ];then
+rm formatallscript
+fi
+touch formatallscript
+
+if [ -f added_disks ];then
+rm added_disks
+fi
+touch added_disks
+  if [ -f checkraidtemp ];then
+  rm checkraidtemp
+  fi
+    touch checkraidtemp
+      if [ -f added_disks ];then
+      rm added_disks
+      fi
+touch added_disks
+if [ -f fulldisks ];then
+rm fulldisks
+fi
+if [ -f checkraidtemp ];then
+rm checkraidtemp
+fi
+if [ -f raidisks ];then
+rm raidisks
+fi
+touch raidisks
+touch checkraidtemp
+touch fulldisks
+
+  if [ -d working ];then
+  rm -r working
+  fi
+cp -r ../clients/$clientdir working
+
+if [ -f nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+chkdsk=""
+done=1
+notraid=1
+#partprobe >>/dev/null 2>&1
+#. ./restore2/checkdiffnew2
+. ./restore2/get_serial_restore
+. ./restore2/change_names_new
+. ./restore2/warning
+. ./restore2/choosedisk
+. ./unmount-all
+
+$DIALOG --title "AUTOMATIC ?" --yesno "do you want to automatically restore all disks ? \n (otherwise you will be prompted for each disk)" 30 60 
+
+  if [ $? = 0 ];then
+  echo "" > noprompt
+  fi
+$DIALOG --title "AUTOMATIC ?" --yesno "do you want to automatically disable \n the check for bad blocks on all disks ? \n (otherwise you will be prompted for each disk)" 30 60 
+
+if [ $? = 0 ];then
+echo "" > badblocksnoprompt
+fi
+
+####################################################check raid
+
+               . ./restore2/checkraid
+
+               
+               
+
+
+
+######################################## check lvm
+if [ -f working/scripts/create-vg ];then
+
+. ./restore2/check_lvm
+fi
+
+####################################################recheck raid
+
+
+               . ./restore2/checkraid
+
+#############################################check wether all raid disks have the right partition type
+
+. ./restore2/all_raids_there
+###########################################do all disks
+
+
+cat disklist|while read line;do
+       disk=`echo $line`
+       . ./restore2/diskorpart
+
+       disk=`echo $disk |cut -d"/" -f3`
+
+   if [ "$partordisk" = "disk" ];then
+  
+  
+   . ./restore2/full_disk
+
+       
+   
+   fi
+
+
+       if [ "$partordisk" = "part" ];then
+               di=${disk%?}
+               d=`echo $di |tail -c2`
+                       echo $d | egrep '^[0-9]+$' >/dev/null 2>&1
+                               if [ "$?" -eq "0" ]; then
+                               di=${di%?}
+                               fi
+               grep $di fulldisks>>/dev/null
+                                       if [ ! $? = 0 ];then
+
+                                       . ./restore2/part
+                                       fi
+       fi
+
+
+done
+
+
+if [ -f partitionscript ];then
+chmod +x partitionscript
+. ./partitionscript
+fi
+
+
+if [ -f checkraidtemp ];then
+chmod +x checkraidtemp
+ra=`cat checkraidtemp`
+if [ ! "$ra" = "" ];then
+. ./release_raids
+. ./restore2/raid
+fi
+rm checkraidtemp
+fi
+
+
+
+
+
+
+
+if [ -f working/scripts/create-vg ];then
+. ./restore2/do_lvm
+fi
+ra=`cat create-vg`
+if [ ! "$ra" = "" ];then
+chmod +x create-pv
+chmod +x create-vg
+chmod +x create-lv
+
+. ./create-pv
+sleep 5
+. ./create-vg
+sleep 5
+. ./create-lv
+fi
+$DIALOG --title "Format ?" --yesno "Now we will format the choosen disks, Do you want to do this ?? \n Normally you would answer yes here, \n Only answer No if you want to try to restore them with bacula without formatting them first \n (this could be usefull if you know what's broken on your system \n and you just want bacula to replace certain files) " 600 600 
+
+  if [ $? = 0 ];then
+chmod +x formatallscript
+
+. ./formatallscript
+fi
+# if [  -d clients/$clientdir.working.bak ];then
+#mv clients/$clientdir.working.bak clients/$clientdir 
+#fi
+. ./chrootscript
diff --git a/rescue/linux/usb/src/scripts/restore/newsize b/rescue/linux/usb/src/scripts/restore/newsize
new file mode 100644 (file)
index 0000000..b5e1780
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+if [ -f nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+set -x                         
+MB=MB
+                               part=`echo $disk|cut -d"/" -f3`
+                               fdisk -l /dev/$part |grep bytes|grep -v Units|awk '{print $5}'>samesize
+                               cat working/diskinfo/fdisk.$part |grep bytes|grep -v Units|awk '{print $5}'>samesize2
+                               diff samesize samesize2 >/dev/null 2>&1
+                       if [ ! $? = 0 ] ;then
+                               nowdisk=`cat samesize`
+                               oldisk=`cat samesize2`
+                               
+
+
+                               $DIALOG --title "different disk" --msgbox "The size of the disk you are trying to restore \n and the one we have backed up differ for /dev/$part  \n \n The old disk size was  $oldisk  \n And the actual disk size is  $nowdisk \n \n We'll have to do things manually" 60 60
+                               oldiskparted=`cat working/diskinfo/parted.$part`
+                               howmanyparts=`cat working/diskinfo/parted.$part|wc -l`
+                               howmanyparts=$(( $howmanyparts - 7 ))
+                                       $DIALOG --title "different disk" --yesno "Do you want to do it manually \n ( we will launch gparted) (yes) \n Or only adjust the LAST partition size to fit the disk ?  (no)" 60 60
+                                       if [ $? = 0 ];then
+                               if [ $DIALOG = Xdialog ];then
+                               echo $$oldiskparted
+                               $DIALOG --title "different disk" --msgbox "the old partition sizes for this disk was \n \n $oldiskparted \n \n We will now launch gparted so you can adjust you disk partitions " 60 60
+                               gparted /dev/$part
+                               else
+                               $DIALOG --title "different disk" --msgbox "the old partition sizes for this disk was \n \n $oldiskparted \n \n please use fdisk or cfdisk to repartition your drive \n \n and the re-run this script pointing to the partitions of the new disks  \n (like /dev/sda1 ) instead of the whole disk (/dev/sda)" 60 60
+                               exit 1
+                               fi
+                                       else
+
+                               a=` sfdisk -n /dev/$part < working/diskinfo/sfdisk.$part.make.bsi 2>&1`
+                               echo $a > tmp
+                               grep Warning tmp
+                               if [ $? = 0 ];then
+                               tr ' ' '\n' < tmp >tmp2
+                               cat tmp2|awk /given/,/sfdisk/ >tmp3
+                               currentsize=`cat tmp3|grep -m1 "("|cut -d"(" -f2 |cut -d")" -f1`
+                               maxsize=`cat tmp3|grep -m2 "("|cut -d"(" -f2 |cut -d")" -f1|tail -n1`
+                               sed -i "s/$currentsize/$maxsize/g" working/diskinfo/sfdisk.make.$part.bsi
+                               nowarn=1
+                               while [ $nowarn = 1 ];do
+                               a=` sfdisk -n /dev/$part < working/diskinfo/sfdisk.$part.make.bsi 2>&1`
+                               echo $a > tmp
+                               grep Warning tmp
+                               if [ $? = 0 ];then
+                               tr ' ' '\n' < tmp >tmp2
+                               cat tmp2|awk /given/,/sfdisk/ >tmp3
+                               currentsize=`cat tmp3|grep -m1 "("|cut -d"(" -f2 |cut -d")" -f1`
+                               maxsize=`cat tmp3|grep -m2 "("|cut -d"(" -f2 |cut -d")" -f1|tail -n1`
+                               sed -i "s/$currentsize/$maxsize/g" working/diskinfo/sfdisk.make.$part.bsi
+                               else
+                               nowarn=0
+                               fi
+
+                                               partprobe /dev/$part >/dev/null 2>&1
+                                               . ./unmount-all
+                                               sfdisk /dev/$part < working/diskinfo/sfdisk.$part.make.bsi
+                                               fi
diff --git a/rescue/linux/usb/src/scripts/restore/part b/rescue/linux/usb/src/scripts/restore/part
new file mode 100644 (file)
index 0000000..9d4397d
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+                       if [ -f formatscript ]; then
+                       rm formatscript
+                       fi
+cat >formatscript <<END_OF_DATA
+
+#
+#  Format all partitions on disk $disk -- created by getdiskinfo
+#
+echo ""
+echo "This script will format all partitions on disk $disk."
+echo ""
+echo "IT WILL DESTROY ALL DATA ON DISK $disk !!!!"
+echo ""
+if [ ! -f noprompt ];then
+echo -n "Are you sure you want to continue? yes/no: "
+read a
+if [ x\$a != xyes ] ; then
+   exit 1
+fi 
+fi
+if [ ! -f badblocksnoprompt ];then
+echo "Do you want to do a disk check for bad blocks?"
+echo -n "It is recommended, but takes time. yes/no: "
+read a
+if [ x\$a = xyes ] ; then
+  check="-c"
+else
+   check=
+fi
+fi
+END_OF_DATA
+
+
+       
+
+               dis=${disk%?}
+
+
+               formatscripto=`ls working/scripts |grep $dis|grep format`
+               
+                       cat working/scripts/$formatscripto |grep $disk|while read line;do
+                       echo $line >>formatscript
+
+                       done
+               grep mk formatscript>>/dev/null 2>&1
+               if [ $? = 0 ];then
+               cat formatscript>>formatallscript
+               fi
+               rm formatscript
diff --git a/rescue/linux/usb/src/scripts/restore/raid b/rescue/linux/usb/src/scripts/restore/raid
new file mode 100644 (file)
index 0000000..2313047
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+
+               echo "this disk seems to be a raid device, we will remount raid"
+
+                       
+
+                                       echo "do you want to execute this??"
+                                       echo ""
+                                       echo ""
+                                       cat checkraidtemp 
+                                       echo ""
+                                       echo ""
+                                       echo "y/n"
+                                       read a
+                                               if [ "$a" = "y" ];then
+                                               cat checkraidtemp |cut -d"/" -f3|cut -d" " -f1|while read line;do
+
+                                               mdonlinecheck=`echo $line`
+                                               mdadm --detail /dev/$mdonlinecheck |grep Active|cut -d":" -f2|cut -c 2-5>/dev/null
+                                                 if [ $? = 0 ];then
+                                                   raidonline=`mdadm --detail /dev/$mdonlinecheck |grep Active|cut -d":" -f2|cut -c 2-5`
+                                                     if [ ! "$raidonline" = "0" ];then
+                                                 echo "this raid array seems to be online, unmounting it"
+                                                 
+                                                       mdadm --stop /dev/$mdonlinecheck
+                                                       
+                                                     fi
+
+                                                 fi
+                                                  
+                                                 done
+
+
+                                               . ./checkraidtemp
+                                                  fi
+
+
+                                                 
+                                                
+                                               
+                                               
diff --git a/rescue/linux/usb/src/scripts/restore/raid_check_ifdev b/rescue/linux/usb/src/scripts/restore/raid_check_ifdev
new file mode 100644 (file)
index 0000000..12b7764
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh 
+
+
+               raids=`grep $disk checkraidtemp |cut -d "=" -f3|wc -w`
+               raids=$(( raids - 2 ))
+
+
+                       for i in `seq 1 $raids`;do
+                       s=$(( i + 1 ))
+                       raidisk=`grep $disk checkraidtemp|cut -d "=" -f3|cut -d" " -f$s`
+                       grep $raidisk disklist >>/dev/null
+                               
+                               if [ ! $? = 0 ];then
+                                       fdisk -l |grep $raidisk >>/dev/null
+                                       if [ ! $? = 0 ];then
+                                       diskbak=$disk
+                                       disk=${raidisk%?}
+
+
+                                               d=`echo $disk |tail -c2`
+                                               echo $d| egrep '^[0-9]+$' >/dev/null 2>&1
+                                               if [ "$?" -eq "0" ]; then
+                                               disk=${disk%?}
+                                               fi
+
+                                               d=`echo $disk |tail -c2`
+                                               echo $d | egrep '^[0-9]+$' >/dev/null 2>&1
+                                               if [ "$?" -eq "0" ]; then
+                                               disk=${disk%?}
+                                               fi
+
+                                               d=`echo $disk |tail -c2`
+                                               echo $d | egrep '^[0-9]+$' >/dev/null 2>&1
+                                               if [ "$?" -eq "0" ]; then
+                                               disk=${disk%?}
+                                               fi
+
+                                               . ./restore2/full_disk
+                                       disk=$diskbak
+                                       fi
+                               fi
+                               
+                       done
diff --git a/rescue/linux/usb/src/scripts/restore/restoredebut b/rescue/linux/usb/src/scripts/restore/restoredebut
new file mode 100755 (executable)
index 0000000..1bf859e
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+
+alldone=1
+raidone=1
+lvmother=1
+none=""
+z=0
+bar="/"
+one="1"
+two="2"
+three="3"
+cwd=`pwd`
+host=`hostname`
+a=1
+points=":"
+out=1
+yes="y"
+no="n"
+mdlvm=0
+md=md
+lvdiskgood=0
+otherdisk=1
+newdisk=""
+
+if [ -f nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+$DIALOG --title "Warning  !!!" --yesno "For this to work, the address of the storage daemon  in the director \n file bacula-dir.conf must be the actual ip (e.g 192.168.1.100) \n and not the hostname \n \n Continue ?" 30 60 
+
+  if [ ! $? = 0 ];then
+       exit 1
+  fi           
+
+
+                       if [ -f raidtemp ];then
+                       rm raidtemp
+                       fi
+
+ pid=`ps -ax|grep ermine|grep -v grep|awk '{print $1}'`
+if [ ! $pid = "" ];then
+kill $pid
+fi
+lsof |grep /media/bs-rescue/chroot|awk '{print $2}'|while read line ;do
+if [ ! $line = "" ];then
+kill $line
+fi
+done
+umount -a >/dev/null 2>&1                    
+. ./release_raids
+. ./restore2/clientdir
+. ./restore2/main
diff --git a/rescue/linux/usb/src/scripts/restore/warning b/rescue/linux/usb/src/scripts/restore/warning
new file mode 100755 (executable)
index 0000000..7bf0232
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+
+find working/scripts/format.* -type f -exec grep mk {} +|awk '{print $NF}' >wehave
+while read line; do echo -n "$line "; done <wehave >tmp
+
+wehave=`cat tmp`
+
+blkid |grep raid|awk '{print $1}'|cut -d: -f1|cut -d/ -f3 >are_raids
+while read line; do echo -n "$line "; done <are_raids >tmp
+are_raids=`cat tmp`
+rm are_raids
+lv=`cat wehave |grep -v sd|grep -v hd`
+if [ ! $lv = "" ];then
+field=`cat working/scripts/create-vg |grep vgcreate|wc -w`
+                       while [ $field -ne 0 ];do
+                       a=`cat working/scripts/create-vg |grep vgcreate|awk "{ print \$ $field }"`
+                       echo $a|grep /dev >/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               
+                                       echo $a >>lvdisks
+                                       
+                                       
+                               fi
+                       field=$(( field - 1 ))
+                       done
+while read line; do echo -n "$line "; done <lvdisks >tmp
+lvm=`cat tmp`
+lvm=`echo $lvm`
+rm lvdisks
+else
+lvm="NO LVM!!!"
+lv="NO LVM!!!"
+fi
+rm wehave
+rm tmp
+if [ -f ./nozen ]; then 
+DIALOG=dialog
+else
+DIALOG=Xdialog
+fi
+
+$DIALOG --msgbox "WARNING \n \n \n We only have gathered formatting info for : \n $wehave \n \n \n  $are_raids are raid devices \n \n \n And the lvm $lv is composed of $lvm \n \n \n If you choose a part of a raid or lvm , \n the other parts will be choosen automatically" 600 600
+
diff --git a/rescue/linux/usb/src/scripts/start_network b/rescue/linux/usb/src/scripts/start_network
new file mode 100755 (executable)
index 0000000..1d4665d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+#  Start network -- created by getdiskinfo
+#
+ip=10.77.88.125
+dev=eth1
+ifconfig lo up
+ifconfig $dev up $ip
+route add default gw 10.77.88.1 dev eth1
diff --git a/rescue/linux/usb/src/scripts/unmount-all b/rescue/linux/usb/src/scripts/unmount-all
new file mode 100644 (file)
index 0000000..ca8d7b3
--- /dev/null
@@ -0,0 +1 @@
+umount -a >/dev/null 2>&1
diff --git a/rescue/linux/usb/src/scripts/x_or_shell b/rescue/linux/usb/src/scripts/x_or_shell
new file mode 100755 (executable)
index 0000000..435fe30
--- /dev/null
@@ -0,0 +1,221 @@
+#!/bin/sh
+
+set -x
+z=0
+bar="/"
+one="1"
+two="2"
+three="3"
+cwd=`pwd`
+host=`hostname`
+goodanswer=1000
+doit=0
+
+if [ ! `whoami` = "root" ] ; then
+  echo ""
+  echo "You need to be root to run this script ..."
+  echo ""
+  exit 1
+fi
+
+
+
+if [ -f ./nozen ]; then 
+   rm ./nozen
+fi
+
+if [ -f ./differenthostname ]; then 
+   rm ./differenthostname
+fi
+
+Xdialog --title " Welcome" --msgbox "Welcome to the bacula usb rescue" 10 30|| { echo "";echo "";echo "";echo "";echo "you don't seem to have an X server running, defaulting to console mode" ; echo "nozen" >> nozen ; }
+
+echo ""
+echo ""
+echo ""
+
+if [ -f ./nozen ]; then 
+   DIALOG=dialog
+else
+   DIALOG=Xdialog
+fi
+
+if [ -f nozen ]; then
+   $DIALOG --title " Welcome" --msgbox "Welcome to the bacula usb rescue" 10 30
+fi
+   $DIALOG --radiolist "Do you want to:" 10 40 3 \
+        1 "Collect info for a client" off \
+        2 "Restore a client" off 2>ans
+        if [ $? = 1 ];then
+        exit 1
+        fi
+wannado=`cat ans|cut -d'"' -f2 |cut -d'"' -f1`
+     
+#usbdev=`mount -l |grep xubuntu9 |cut -d" " -f3`
+root=`df |grep rootfs|awk '{print $6}'`
+
+if [ x{$wannado} = x{$two} ] ; then
+   if [ ! x{$root} = "x{/}" ]; then
+        $DIALOG --msgbox "Please boot on  the usb key to restore a client" 30 80
+        exit 1
+   else
+        . ./restore/restoredebut
+        exit 0
+  fi
+fi
+
+if [ x{$wannado} = x{$one} ] ; then
+   if [ x{$root} = x{$bar} ]; then
+       $DIALOG --msgbox "Please boot on your system (not on the usb key) \n       to gather client info" 20 60
+       exit 0
+   fi
+if [ -f unmounted ];then
+rm unmounted
+fi
+
+mount -l |awk '{print $1}'|grep /dev/ >mounted
+blkid |awk '{print $1}'|grep -v /dev/md |while read line;do
+line=${line%?}
+grep $line mounted >/dev/null 2>&1
+
+if [ ! $? = 0 ];then
+echo $line >> unmounted
+fi
+done
+echo "Mounted disks are:                                                             Unmounted disks are:">mntinfo 
+       
+unmounted=`cat unmounted|wc -l`
+
+mounted=`cat mounted|wc -l`
+if [ $mounted -gt $unmounted ];then
+lines=$mounted
+else
+lines=$unmounted
+fi
+
+if [ $mounted -eq $unmounted ];then
+lines=$mounted
+fi
+
+
+for i in $(seq 1 $lines) ;do
+a=`cat  mounted| awk "NR==$i"`
+b=`cat  unmounted| awk "NR==$i"`
+long1=`echo $a|wc -c`
+long2=`echo $b|wc -c`
+if [ $long2 -lt 11 ];then
+if [ $long1 -lt 11 ];then
+echo "$a                                                                              $b">>mntinfo
+else
+echo "$a                                                      $b">>mntinfo
+fi
+else
+echo "$a                                                      $b">>mntinfo
+fi
+done
+mounted=`cat mntinfo`
+
+rm unmounted
+#rm mntinfo
+rm mounted
+
+
+        $DIALOG --title " Warning " --yesno "Only mounted disks will get picked up, \n Please mount all the disks you want to be able \n to restore before running this script \n \n \n $mounted \n \n  \n Note that raid devices will show up as unmounted \n \n Do you want to continue ?"  600 600
+        if [ $? = 1 ];then
+        exit 1
+        fi
+
+        while [ $goodanswer -gt 600 ]; do
+
+         if [ -f ../clients/$host/diskinfo/df.bsi ] ; then
+
+        
+        $DIALOG --radiolist "Please note that the informations are stored by hostname ,\n we seem to already have gattered information for that hostname. Do you want to :" 20 80 3 \
+        1 "continue , moving previous data to .bak (erasing old .bak if any) ?" off \
+        2 "choose a name for this backup (you will have to remember it for restoring) ? " off 2>ans 
+        if [ $? = 1 ];then
+        exit 1
+        fi
+        changename=`cat ans|cut -d'"' -f2 |cut -d'"' -f1`
+        
+        else
+
+        $DIALOG --radiolist "Please note that the informations are stored by hostname ,\n The hostname for this machine is $host \n  Do you want to :" 20 80 3 \
+        1 "Use the hostname as a reference for this client ?" off \
+        2 "choose a name for this backup (you will have to remember it for restoring) ? " off 2>ans 
+        if [ $? = 1 ];then
+        exit 1
+        fi
+        changename=`cat ans|cut -d'"' -f2 |cut -d'"' -f1`
+        fi
+        
+
+                if [ $changename = $one ] ;then
+
+                newhostname=$host
+                goodanswer=500
+                doit=1
+                fi
+
+
+
+
+                        if [ $changename = $two ] ;then
+
+
+        
+
+                        $DIALOG --inputbox "Please enter a name under which you want to save this client" 30 80 2>ans
+                                if [ $? = 1 ];then
+                                exit 1
+                                fi
+
+                        newhostname=`cat ans|cut -d'"' -f2 |cut -d'"' -f1`
+
+                                if [ -f ./differenthostname ]; then 
+                                rm ./differenthostname
+                                fi
+        
+                        echo $newhostname >> differenthostname
+                        goodanswer=500
+                         fi
+
+                                if [ $changename -ne $two ] ; then
+                                goodanswer=1000
+                                fi
+
+
+                                        if [ -f ../clients/$newhostname/diskinfo/df.bsi ] ; then
+                                                if [ ${doit} -gt 0 ] ; then
+                                                goodanswer=500
+
+                                                else
+
+                                                goodanswer=1000
+
+                                                fi
+
+
+                                                        if [ x{$wannado} = x{$two} ] ; then
+
+                                                                if [ ! x{$usbdev} = x{$bar} ]; then
+
+        
+
+                                                                $DIALOG --msgbox  "Please boot on  the usb key to restore a client" 30 30
+
+                                                                exit 0
+                                                                fi
+
+                                                        fi
+                                        else 
+                                          goodanswer=500
+                                        fi
+        done
+
+  fi
+
+
+./getdiskinfo
+
diff --git a/rescue/linux/usb/src/start_bacula_rescue b/rescue/linux/usb/src/start_bacula_rescue
new file mode 100755 (executable)
index 0000000..9942707
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+usb=`blkid|grep bs-rescue|cut -d: -f1`
+mount -l |grep $usb |grep /media/bs-rescue >/dev/null 2>&1
+if [ ! $? = 0 ];then
+umount $usb
+  if [ ! -d /media/bs-rescue ];then
+  mkdir /media/bs-rescue
+  fi
+mount $usb /media/bs-rescue
+fi
+cd /media/bs-rescue/bacula-rescue
+./start_rescue
diff --git a/rescue/linux/usb/src/start_rescue b/rescue/linux/usb/src/start_rescue
new file mode 100755 (executable)
index 0000000..bc99896
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# export PATH=$PATH:$PWD/bin
+
+which dialog >/dev/null 2>&1
+
+if [ ! $? = 0 ];then
+
+which Xdialog >/dev/null 2>&1
+  if [ ! $? = 0 ];then
+  echo ""
+    echo ""
+      echo ""
+      
+  echo "You need to install dialog or Xdialog for this to work"
+    echo ""
+      echo ""
+        echo ""
+  exit 1
+  fi
+fi
+
+
+cd scripts
+./x_or_shell