Advertisement
Guest User

Untitled

a guest
Dec 27th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Copyright 2018 Patrick Pedersen <ctx.xda@gmail.com>
  4.  
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8.  
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16.  
  17. # Custom IBM Notes 9.0.1 patcher and installer for Ubuntu 16.04+ systems
  18.  
  19. # Information on usage and execution is available in the README that comes with this file
  20. # This installation script comes WITHOUT any IBM software and must be installed by the user himself
  21.  
  22. # Package dependencies
  23. DEPENDENCIES=\
  24. ( \
  25. "gdebi" \
  26. "libjpeg62" \
  27. "libgconf2-4" \
  28. "libatk-adaptor:i386" \
  29. "libgail-common:i386" \
  30. "libbonobo2-0" "libbonoboui2-0" \
  31. "libgnomeui-0" "libgnome-desktop-*" "gnome-themes-extra:i386" \
  32. "gtk2-engines-pixbuf:i386" "ibus-gtk:i386" "libcanberra-gtk-module:i386" \
  33. )
  34.  
  35. function usage() {
  36. echo
  37. echo "Usage: Ubuntu-IBM-Notes-9.0.1.sh [-h | --help] package"
  38. echo
  39. echo "Options:"
  40. echo
  41. echo -e "-h --help\tDisplay usage (this)"
  42. echo -e "package\t\tPath to the IBM Notes Debian package"
  43. echo
  44. }
  45.  
  46. # Test args
  47.  
  48. if [ -z "$1" ]; then
  49. echo
  50. echo "No package specified!"
  51. usage
  52. exit -1
  53. fi
  54.  
  55. if [[ "$1" == "-h" || "$1" == "--help" ]]; then
  56. usage
  57. exit 1
  58. fi
  59.  
  60. if [ -z "$(dpkg-deb -I "$1" | grep -oP "Package: ibm-notes")" ]; then
  61. echo "The provided package does not appear to be a IBM notes installation package!"
  62. exit -1
  63. fi
  64.  
  65. # Check script is being executed with root rights
  66. if [ "$EUID" -ne 0 ]
  67. then echo "Please run as root"
  68. exit
  69. fi
  70.  
  71. echo "Installing necessary packages before installation"
  72.  
  73. set -f
  74. apt install "${DEPENDENCIES[@]}"
  75. set +f
  76.  
  77. echo "Getting necessary unsupported/unofficial dependencies"
  78.  
  79. tmp_install_directory="$(mktemp -d)"
  80.  
  81. if ! apt-get -qq install libgnome-desktop-2-17; then
  82. wget http://security.ubuntu.com/ubuntu/pool/universe/g/gnome-desktop/libgnome-desktop-2-17_2.32.1-2ubuntu1_amd64.deb -P "$tmp_install_directory"/
  83. gdebi "$tmp_install_directory"/libgnome-desktop-2-17_2.32.1-2ubuntu1_amd64.deb
  84.  
  85. if apt-get -qq install libgnome-desktop-2-17; then
  86. echo "libgnome-desktop-2-17 : successfully installed"
  87. else
  88. echo "libgnome-desktop-2-17 : installation unsuccessful"
  89. rm -rf "$tmp_install_directory"
  90. exit 1
  91. fi
  92. fi
  93.  
  94. if ! apt-get -qq install libxp6; then
  95. wget http://launchpadlibrarian.net/183708483/libxp6_1.0.2-2_amd64.deb -P "$tmp_install_directory"/
  96. gdebi "$tmp_install_directory"/libxp6_1.0.2-2_amd64.deb
  97.  
  98. if apt-get -qq install libxp6; then
  99. echo "libxp6 : successfully installed"
  100. else
  101. echo "libxp6 : installation unsuccessful"
  102. rm -rf "$tmp_install_directory"
  103. exit 1
  104. fi
  105. fi
  106.  
  107. echo "Patching the ibm-notes-9.0.1 package"
  108. echo "This may take a while depending on your hardware"
  109.  
  110. # Give user time to read echo
  111. sleep 5
  112.  
  113. dpkg -X $1 "$tmp_install_directory"/deb
  114. dpkg -e $1 "$tmp_install_directory"/deb/DEBIAN
  115. sed -i 's/ gdb,//g' "$tmp_install_directory"/deb/DEBIAN/control
  116. sed -i 's/libcupsys2/libcups2/g' "$tmp_install_directory"/deb/DEBIAN/control
  117. sed -i 's/ libgnome-desktop-2 | libgnome-desktop-2-7 | libgnome-desktop-2-11 | libgnome-desktop-2-17 | libgnome-desktop-3-2,//g' "$tmp_install_directory"/deb/DEBIAN/control
  118. sed -i 's/ libxp6,//g' "$tmp_install_directory"/deb/DEBIAN/control
  119. sed -i 's/libpng12-0/libpng16-16/g' "$tmp_install_directory"/deb/DEBIAN/control
  120.  
  121. dpkg -b "$tmp_install_directory"/deb $1
  122.  
  123. echo "Done patching"
  124.  
  125. rm -rf "$tmp_install_directory"
  126.  
  127. echo "Installing IBM notes 9.0.1"
  128.  
  129. # Give user time to read echo
  130. sleep 5
  131.  
  132. gdebi $1
  133.  
  134. cd ../
  135.  
  136. if [ -f /opt/ibm/notes/notes2 ]; then
  137. echo "Successfully installed IBM Notes 9.0.1"
  138. else
  139. echo "Failed to install IBM Notes 9.0.1!"
  140. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement