natanprog

tarMainInstall.sh

Oct 27th, 2025
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.67 KB | Source Code | 0 0
  1. #!/bin/sh
  2. #
  3. #  This library is part of the FirebirdSQL project
  4. #
  5. #  This library is free software; you can redistribute it and/or
  6. #  modify it under the terms of the GNU Lesser General Public
  7. #  License as published by the Free Software Foundation; either
  8. #  version 2.1 of the License, or (at your option) any later version.
  9. #  You may obtain a copy of the Licence at
  10. #  http://www.gnu.org/licences/lgpl.html
  11. #  
  12. #  As a special exception this file can also be included in modules
  13. #  with other source code as long as that source code has been
  14. #  released under an Open Source Initiative certificed licence.  
  15. #  More information about OSI certification can be found at:
  16. #  http://www.opensource.org
  17. #  
  18. #  This module is distributed in the hope that it will be useful,
  19. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. #  GNU Lesser General Public Licence for more details.
  22. #  
  23. #  This module was created by members of the firebird development
  24. #  team.  All individual contributions remain the Copyright (C) of
  25. #  those individuals and all rights are reserved.  Contributors to
  26. #  this file are either listed below or can be obtained from a CVS
  27. #  history command.
  28. #
  29. #   Created by:  Mark O'Donohue <[email protected]>
  30. #
  31. #   Contributor(s):
  32. #  
  33. #
  34. #   $Id: tarMainInstall.sh.in,v 1.1 2003/06/06 14:04:39 alexpeshkoff Exp $
  35. #
  36.  
  37. #  Install script for FirebirdSQL database engine
  38. #  http://www.firebirdsql.org
  39.  
  40. # This is the new file !!!
  41.  
  42.  
  43. #------------------------------------------------------------------------
  44. # Prompt for response, store result in Answer
  45.  
  46. Answer=""
  47.  
  48. AskQuestion() {
  49.     Test=$1
  50.     DefaultAns=$2
  51.     echo -n "${1}"
  52.     Answer="$DefaultAns"
  53.     read Answer
  54. }
  55.  
  56. #------------------------------------------------------------------------
  57. # Prompt for yes or no answer - returns non-zero for no
  58.  
  59. AskYNQuestion() {
  60.     while echo -n "${*} (y/n): "
  61.     do
  62.         read answer rest
  63.         case $answer in
  64.         [yY]*)
  65.             return 0
  66.             ;;
  67.         [nN]*)
  68.             return 1
  69.             ;;
  70.         *)
  71.             echo "Please answer y or n"
  72.             ;;
  73.         esac
  74.     done
  75. }
  76.  
  77.  
  78. #------------------------------------------------------------------------
  79. # Run process and check status
  80.  
  81.  
  82. runAndCheckExit() {
  83.     Cmd=$*
  84.  
  85. #    echo $Cmd
  86.     $Cmd
  87.  
  88.     ExitCode=$?
  89.  
  90.     if [ $ExitCode -ne 0 ]
  91.       then
  92.         echo "Install aborted: The command $Cmd "
  93.         echo "                 failed with error code $ExitCode"
  94.         exit
  95.     fi
  96. }
  97.  
  98. #------------------------------------------------------------------------
  99. # Check for a previous install
  100.  
  101.  
  102. checkInstallUser() {
  103.  
  104.     if [ "`whoami`" != "root" ];
  105.       then
  106.         echo ""
  107.         echo "--- Warning ----------------------------------------------"
  108.         echo ""
  109.         echo "    You need to be 'root' user to install"
  110.         echo ""
  111.         exit
  112.     fi
  113. }
  114.  
  115.  
  116.  
  117. #== Main Program ==========================================================
  118.  
  119.  
  120. InteractiveInstall=1
  121. export InteractiveInstall
  122.  
  123.  
  124. checkInstallUser
  125.  
  126. BuildVersion=1.5.6.5026
  127. PackageVersion=0
  128. CpuType=i686
  129.  
  130. Version="$BuildVersion-$PackageVersion.$CpuType"
  131.  
  132.  
  133. cat <<EOF
  134.  
  135. Firebird super $Version Installation
  136.  
  137. EOF
  138.  
  139.  
  140.  
  141. AskQuestion "Press Enter to start installation or ^C to abort"
  142.  
  143.  
  144. # Here we are installing from a install tar.gz file
  145.  
  146. if [ -e scripts ]
  147.   then
  148.     echo "Extracting install data"
  149.     runAndCheckExit "./scripts/preinstall.sh"
  150.     runAndCheckExit "./scripts/tarinstall.sh"
  151.     runAndCheckExit "./scripts/postinstall.sh"
  152.  
  153. fi
  154.  
  155. echo "Install completed"
  156.  
  157.  
Advertisement
Add Comment
Please, Sign In to add comment