Provides automatic installation scripts for OpenRA with Tiberian Sun & Red Alert 2 + Dune 2 (Windows, Linux)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

452 lines
21 KiB

  1. #!/bin/bash
  2. # Allow interruption of the script at any time (Ctrl + C)
  3. trap "exit" INT
  4. #*********************************************************************************************************
  5. ## VARIABLES USED IN THE SCRIPT
  6. #
  7. # Package name & version
  8. PACKAGE_NAME=openra-bleed-tibsunra2
  9. PACKAGE_VERSION=1
  10. PACKAGE=$PACKAGE_NAME-$PACKAGE_VERSION
  11. # Get our Linux distribution
  12. DISTRO=$(cat /etc/os-release | sed -n '/PRETTY_NAME/p' | grep -o '".*"' | sed -e 's/"//g' -e s/'([^)]*)'/''/g -e 's/ .*//' -e 's/[ \t]*$//')
  13. UBUNTU="Ubuntu"
  14. DEBIAN="Debian"
  15. OPENSUSE="openSUSE"
  16. FEDORA="Fedora"
  17. # Get the current directory
  18. WORKING_DIR=$(pwd)
  19. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]]; then
  20. # Find out used Linux distribution
  21. RELEASE=$(lsb_release -d | sed 's/Description:\t//g')
  22. # Check if the used OS is Ubuntu 14.04 LTS/14.10 or Linux Mint
  23. RELEASE_VERSION=$(lsb_release -r | sed 's/[^0-9]*//g')
  24. RELEASE_MINT=$(lsb_release -i 2>/dev/null |grep -c "Mint")
  25. # Check for critical build dependencies (especially for Ubuntu 14.04 LTS/14.10 & Linux Mint)
  26. PKG1_CHECK=$(dpkg-query -W -f='${Status}' libnuget-core-cil 2>/dev/null | grep -c "ok installed")
  27. PKG2_CHECK=$(dpkg-query -W -f='${Status}' mono-devel 2>/dev/null | grep -c "ok installed")
  28. PKG3_CHECK=$(dpkg-query -W -f='${Status}' nuget 2>/dev/null | grep -c "ok installed")
  29. # Do we have any OpenRA packages on the system?
  30. PKG4_CHECK=$(dpkg-query -W -f='${Status}' openra 2>/dev/null | grep -c "ok installed")
  31. PKG5_CHECK=$(dpkg-query -W -f='${Status}' openra-playtest 2>/dev/null | grep -c "ok installed")
  32. PKG6_CHECK=$(dpkg-query -W -f='${Status}' openra-bleed 2>/dev/null | grep -c "ok installed")
  33. elif [[ $DISTRO =~ $OPENSUSE ]]; then
  34. # Find out used OpenSUSE version
  35. RELEASE=$(cat /etc/os-release | sed -n 4p | grep -o '".*"' | sed -e 's/"//g' -e s/'([^)]*)'/''/g -e 's/[ \t]*$//')
  36. # Do we have any OpenRA packages on the system?
  37. PKG1_CHECK=$(rpm -qa openra | wc -l)
  38. PKG2_CHECK=$(rpm -qa openra-playtest | wc -l)
  39. PKG3_CHECK=$(rpm -qa openra-bleed | wc -l)
  40. elif [[ $DISTRO =~ $FEDORA ]]; then
  41. # Find out used Fedora version
  42. RELEASE=$(cat /etc/os-release | sed -n '/PRETTY_NAME/p' | grep -o '".*"' | sed -e 's/"//g' -e s/'([^)]*)'/''/g -e 's/[ \t]*$//')
  43. # Do we have any OpenRA packages on the system?
  44. PKG1_CHECK=$(rpm -qa openra | wc -l)
  45. PKG2_CHECK=$(rpm -qa openra-playtest | wc -l)
  46. PKG3_CHECK=$(rpm -qa openra-bleed | wc -l)
  47. fi
  48. # Check for missing RA2 directories.
  49. RA2_MISSINGDIR1="$HOME/openra-master/$PACKAGE/mods/ra2/bits/vehicles"
  50. RA2_MISSINGDIR2="$HOME/openra-master/$PACKAGE/mods/ra2/bits/themes"
  51. # Check if we already have sudo password in memory (timeout/timestamp check)
  52. SUDO_CHECK=$(sudo -n uptime 2>&1|grep "load"|wc -l)
  53. BASH_CHECK=$(ps | grep `echo $$` | awk '{ print $4 }')
  54. bold_in='\e[1m'
  55. line_in='\e[4m'
  56. dim_in='\e[2m'
  57. green_in='\e[32m'
  58. red_in='\e[91m'
  59. out='\e[0m'
  60. #*********************************************************************************************************
  61. ## PRE-CHECK
  62. #
  63. # Check if we're using bash or sh to run the script. If bash, OK. If sh, ask user to run the script with bash.
  64. if [ ! $BASH_CHECK = "bash" ]; then
  65. echo "
  66. Please run this script using bash (/usr/bin/bash).
  67. "
  68. exit 1
  69. fi
  70. # Check if we are root or not. If yes, then terminate the script.
  71. if [[ $UID = 0 ]]; then
  72. echo -e "\nPlease run this script as a regular user. Do not use root or sudo. Some commands used in the script require regular user permissions.\n"
  73. exit 1
  74. fi
  75. #If package dir exists already, delete it.
  76. if [ -d "$HOME/openra-master/" ]; then
  77. rm -rf "$HOME/openra-master"
  78. fi
  79. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]]; then
  80. #If deb package exists already, delete it.
  81. if [ -f $HOME/$PACKAGE_NAME*.deb ]; then
  82. rm -f $HOME/$PACKAGE_NAME*.deb
  83. fi
  84. elif [[ $DISTRO =~ $OPENSUSE ]] || [[ $DISTRO =~ $FEDORA ]]; then
  85. if [ -f $HOME/$PACKAGE_NAME*.rpm ]; then
  86. rm -f $HOME/$PACKAGE_NAME*.rpm
  87. fi
  88. fi
  89. # Stop execution if we encounter an error
  90. set -e
  91. #*********************************************************************************************************
  92. ## PART 1/7
  93. #
  94. ## Installation of OpenRA compilation dependencies and user notification message
  95. echo -e "\n$bold_in***Welcome Comrade*** $out\n"
  96. echo -e "This script compiles and installs OpenRA from source with Tiberian Sun & Red Alert 2.\n
  97. - The script is NOT made by the developers of OpenRA and may contain bugs.
  98. - The script creates an installation package using OpenRA source code and additional Red Alert 2 mod files from Github.\n\nNOTE: As the development of OpenRA & Red Alert 2 continues, this script will likely become unusable some day. Please, feel free to modify it if necessary."
  99. if [[ $DISTRO =~ $UBUNTU ]]; then
  100. echo -e "$line_in\nThe script has been tested on:\n\nDistribution\t\tStatus$out\nUbuntu 16.04 LTS$green_in\tOK$out\nUbuntu 15.10$green_in\t\tOK$out\nUbuntu 15.04 LTS$green_in\tOK$out\nUbuntu 14.10$green_in\t\tOK$out\nUbuntu 14.04 LTS$green_in\tOK$out\nLinux Mint 17.3$green_in\t\tOK$out\nLinux Mint 17.2$green_in\t\tOK$out\nLinux Mint 17.1$green_in\t\tOK$out\nLinux Mint 16$red_in\t\tFailure$out$dim_in (can't find required packages)$out\n"
  101. elif [[ $DISTRO =~ $DEBIAN ]]; then
  102. echo -e "$line_in\nThe script has been tested on:\n\nDistribution\t\tStatus$out\nDebian 8.3 $green_in\t\tOK$out\n"
  103. elif [[ $DISTRO =~ $OPENSUSE ]]; then
  104. echo -e "$line_in\nThe script has been tested on:\n\nDistribution\t\tStatus$out\nOpenSUSE Tumbleweed $green_in\tOK$out\nOpenSUSE Leap 42.1 $green_in\tOK$out\nOpenSUSE 13.2 $green_in\t\tOK$out\nOpenSUSE 13.1 $red_in\t\tFailure$out$dim_in (can't find required packages)$out\n"
  105. elif [[ $DISTRO =~ $FEDORA ]]; then
  106. echo -e "$line_in\nThe script has been tested on:\n\nDistribution\t\tStatus$out\nFedora 23 $green_in\t\tOK$out\nFedora 22 $green_in\t\tOK$out\nOpenSUSE 13.1 $red_in\t\tFailure$out$dim_in (can't find required packages)$out\n"
  107. fi
  108. echo -e "You are using $RELEASE.\n"
  109. read -r -p "Do you want to continue? [y/N] " response
  110. if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
  111. sleep 1
  112. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]]; then
  113. echo -e "\nAllright, let's continue. Do you want $bold_in\n\n1.$out manually check which OpenRA build dependencies (packages) will be installed on your system and manually install OpenRA after compilation? $dim_in(manual apt-get + deb packages installation)$bold_in\n2.$out automatically accept the installation of the OpenRA build dependencies during the script execution and automatically install OpenRA after compilation? $dim_in(apt-get with -y option + automatic .deb packages installation)$out\n"
  114. elif [[ $DISTRO =~ $OPENSUSE ]] || [[ $DISTRO =~ $FEDORA ]]; then
  115. echo -e "\nAllright, let's continue. Do you want $bold_in\n\n1.$out manually check which OpenRA build dependencies (packages) will be installed on your system and manually install OpenRA after compilation? $dim_in(manual rpm packages installation)$bold_in\n2.$out automatically accept the installation of the OpenRA build dependencies during the script execution and automatically install OpenRA after compilation? $dim_in(automatic installation of rpm packages)$out\n"
  116. fi
  117. read -r -p "Please type 1 or 2 (Default: 2): " number
  118. sleep 1
  119. if [[ $number -eq 1 ]]; then
  120. METHOD=''
  121. echo -e "\nSelected installation method:$bold_in Manual$out"
  122. else
  123. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]] || [[ $DISTRO =~ $FEDORA ]]; then
  124. METHOD=-y
  125. echo -e "\nSelected installation method:$bold_in Automatic$out"
  126. elif [[ $DISTRO =~ $OPENSUSE ]]; then
  127. METHOD='--non-interactive --no-gpg-checks'
  128. echo -e "\nSelected installation method:$bold_in Automatic$out"
  129. fi
  130. fi
  131. if [ $SUDO_CHECK -eq 0 ]; then
  132. if [ -z $METHOD ]; then
  133. echo -e "\nOpenRA compilation requires that you install some packages first. Your permission for installation is asked (yes/no) everytime it's needed. This script asks for a required root password now, so you don't have to type it multiple times later on while the script is running.\n\nPlease type sudo/root password now.\n"
  134. else
  135. echo -e "\nOpenRA compilation requires that you install some packages first. This script asks for a required root password now, so you don't have to type it multiple times later on while the script is running.\n\nPlease type sudo/root password now.\n"
  136. fi
  137. sudo echo -e "\nRoot password OK."
  138. sleep 1
  139. else
  140. true
  141. fi
  142. ## Check if the user is running Ubuntu 14.04 LTS/14.10 or Linux Mint and whether required nuget packages are installed if these Linux versions are being used.
  143. if [[ $DISTRO =~ $UBUNTU ]]; then
  144. if [ $RELEASE_VERSION == 1404 ] || [ $RELEASE_VERSION == 1410 ] || [ $RELEASE_MINT -eq 1 ] ; then
  145. echo -e "\nYou are running Ubuntu 14.04 LTS/14.10 or Linux Mint. We need to check if you have required NuGet packages installed.\nThese packages are not (longer available) from the official repository but they are provided by this package.\n"
  146. read -r -p "Press ENTER to proceed." enter
  147. if [ ${#enter} -eq 0 ]; then
  148. echo -e "$line_in\nChecking NuGet packages$out"
  149. fi
  150. #-----------------------------------------------------------------------------------------------------------------------------------------------------------
  151. ## Check existence of 'nuget', 'libnuget-core-lib' & 'mono-devel' packages on Ubuntu 14.04 LTS/14.10/Linux Mint based system.
  152. if [ $PKG2_CHECK -eq 1 ]; then
  153. echo -e "$green_in\nOK$out - 'mono-devel' found."
  154. else
  155. echo -e "$red_in\nWARNING$out - 'mono-devel' not found."
  156. fi
  157. if [ $PKG1_CHECK -eq 1 ]; then
  158. echo -e "$green_in\nOK$out - 'libnuget-core-cil' found."
  159. else
  160. echo -e "$red_in\nWARNING$out - 'libnuget-core-cil' not found."
  161. fi
  162. if [ $PKG3_CHECK -eq 1 ]; then
  163. echo -e "$green_in\nOK$out - 'nuget' found."
  164. else
  165. echo -e "$red_in\nWARNING$out - 'nuget' not found."
  166. fi
  167. if [ ! $PKG2_CHECK -eq 1 ]; then
  168. echo -e "$red_in\nWARNING$out - NuGet requires 'mono-devel' package which was not found.\n\nInstalling 'mono-devel' now."
  169. sleep 5
  170. echo -e "\nUpdating package lists with APT.\n"
  171. sleep 2
  172. sudo apt-get update && \
  173. sudo apt-get $METHOD install mono-devel
  174. fi
  175. if [ ! $PKG1_CHECK -eq 1 ]; then
  176. if [ $number = 1 ]; then
  177. echo
  178. read -r -p "Install 'libnuget-core-cil' now? [y/N] " response2
  179. if [[ $response2 =~ ^([yY][eE][sS]|[yY])$ ]]; then
  180. sudo dpkg -i ./data/linux/ubuntu/libnuget-core-cil_2.8.5+md59+dhx1-1~getdeb1_all.deb
  181. else
  182. echo -e "\nOpenRA installation can't continue. Aborting.\n"
  183. exit 1
  184. fi
  185. else
  186. sudo dpkg -i ./data/linux/ubuntu/libnuget-core-cil_2.8.5+md59+dhx1-1~getdeb1_all.deb
  187. fi
  188. fi
  189. PKG1_RECHECK=$(dpkg-query -W -f='${Status}' libnuget-core-cil 2>/dev/null | grep -c "ok installed")
  190. if [ ! $PKG3_CHECK -eq 1 ]; then
  191. if [ $number = 1 ]; then
  192. echo
  193. read -r -p "Install 'nuget' now? [y/N] " response3
  194. if [[ $response3 =~ ^([yY][eE][sS]|[yY])$ ]]; then
  195. sudo dpkg -i ./data/linux/ubuntu/nuget_2.8.5+md59+dhx1-1~getdeb1_all.deb
  196. else
  197. echo -e "\nOpenRA installation can't continue. Aborting.\n"
  198. exit 1
  199. fi
  200. else
  201. sudo dpkg -i ./data/linux/ubuntu/nuget_2.8.5+md59+dhx1-1~getdeb1_all.deb
  202. fi
  203. fi
  204. PKG3_RECHECK=$(dpkg-query -W -f='${Status}' nuget 2>/dev/null | grep -c "ok installed")
  205. if [ $PKG1_RECHECK -eq 1 ] && [ $PKG3_RECHECK -eq 1 ]; then
  206. echo -e "$green_in\nOK$out - All required NuGet packages are installed."
  207. else
  208. echo -e "$red_in\nWARNING$out - Can't find all required NuGet packages. Aborting.\n"
  209. exit 1
  210. fi
  211. else
  212. true
  213. fi
  214. fi
  215. sleep 2
  216. #-----------------------------------------------------------------------------------------------------------------------------------------------------------
  217. echo -e "$bold_in\n1/7 ***OpenRA build dependencies***\n$out"
  218. sleep 2
  219. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]]; then
  220. echo -e "Updating package lists with APT.\n"
  221. sleep 2
  222. sudo apt-get update
  223. fi
  224. echo -e "Installing required OpenRA build dependencies.\n"
  225. sleep 4
  226. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]]; then
  227. sudo apt-get $METHOD install git dpkg-dev dh-make mono-devel libfreetype6-dev libopenal-data libopenal1 libsdl2-2.0-0 nuget curl liblua5.1-0-dev zenity xdg-utils build-essential gcc make libfile-fcntllock-perl
  228. mozroots --import --sync && \
  229. sudo apt-key update
  230. elif [[ $DISTRO =~ $OPENSUSE ]]; then
  231. if [[ ! $RELEASE = "openSUSE Leap 42.1" ]] || [[ ! $RELEASE = "openSUSE Tumbleweed" ]]; then
  232. sudo zypper $METHOD install rpm-build git mono-devel libfreetype6 libopenal1 libSDL2-2_0-0 curl lua51 liblua5_1 zenity xdg-utils gcc make
  233. sudo zypper $METHOD install ./data/linux/opensuse/mono-nuget-2.8.5-4.2.noarch.rpm
  234. else
  235. sudo zypper $METHOD install rpm-build git mono-devel libfreetype6 libopenal1 libSDL2-2_0-0 mono-nuget curl lua51 liblua5_1 zenity xdg-utils gcc make
  236. fi
  237. mozroots --import --sync
  238. elif [[ $DISTRO =~ $FEDORA ]]; then
  239. sudo dnf $METHOD install rpm-build git mono-devel freetype-devel openal-soft SDL2 libgdiplus-devel libcurl compat-lua zenity xdg-utils gcc make
  240. cd /etc/yum.repos.d/
  241. if [[ $RELEASE = "Fedora 23" ]]; then
  242. sudo wget http://download.opensuse.org/repositories/games:openra/Fedora_23/games:openra.repo
  243. sudo dnf $METHOD --best --allowerasing install mono-core nuget
  244. elif [[ $RELEASE = "Fedora 22" ]]; then
  245. sudo wget http://download.opensuse.org/repositories/games:openra/Fedora_22/games:openra.repo
  246. sudo dnf $METHOD --best --allowerasing install mono-core
  247. if [[ $(uname -m) = "i686" ]];then
  248. sudo dnf $METHOD install $WORKING_DIR/data/linux/fedora/nuget-2.8.7-0.fc22.i686.rpm
  249. elif [[ $(uname -m) = "x86_64" ]];then
  250. sudo dnf $METHOD install $WORKING_DIR/data/linux/fedora/nuget-2.8.7-0.fc22.x86_64.rpm
  251. fi
  252. fi
  253. cd $WORKING_DIR
  254. mozroots --import --sync
  255. fi
  256. #*********************************************************************************************************
  257. ## PART 2/7
  258. #
  259. ## Download the latest OpenRA & Red Alert 2 source files from Github, create build directories to the user's home directory.
  260. ## Once Red Alert 2 source files have been downloaded, move them to the OpenRA parent source directory.
  261. ## Add several missing directories for Red Alert 2.
  262. echo -e "$bold_in\n2/7 ***Downloading OpenRA source code & Red Alert 2 mod files from Github***\n$out"
  263. sleep 2
  264. echo -e "Part 1 (OpenRA source code):\n"
  265. mkdir -p $HOME/openra-master/{$PACKAGE,ra2} && \
  266. git clone -b bleed https://github.com/OpenRA/OpenRA.git $HOME/openra-master/$PACKAGE
  267. echo -e "\nPart 2 (Red Alert 2 mod files):\n"
  268. git clone -b master https://github.com/OpenRA/ra2.git $HOME/openra-master/ra2 && \
  269. mv $HOME/openra-master/ra2/OpenRA.Mods.RA2 $HOME/openra-master/$PACKAGE && \
  270. mv $HOME/openra-master/ra2 $HOME/openra-master/$PACKAGE/mods/
  271. if [ ! -d "$RA2_MISSINGDIR1" ]; then
  272. mkdir "$RA2_MISSINGDIR1"
  273. fi
  274. if [ ! -d "$RA2_MISSINGDIR2" ]; then
  275. mkdir "$RA2_MISSINGDIR2"
  276. fi
  277. cp ./data/patches/*.patch $HOME/openra-master/
  278. #*********************************************************************************************************
  279. ## PART 3/7
  280. #
  281. ## Patch several OpenRA source files (Makefile and such) for Tiberian Sun & Red Alert 2
  282. echo -e "$bold_in\n3/7 ***Preparing OpenRA source files for Tiberian Sun & Red Alert 2***\n$out"
  283. sleep 2
  284. for i in $HOME/openra-master/*.patch; do patch -d $HOME/openra-master/$PACKAGE -Np1 --binary < $i; done
  285. # Get version number for Red Alert 2 mod (Github)
  286. RA2_VERSION=git-$(git ls-remote https://github.com/OpenRA/ra2.git | head -1 | sed "s/HEAD//" | sed 's/^\(.\{7\}\).*/\1/')
  287. sed -i "s/Version: {DEV_VERSION}/Version: $RA2_VERSION/g" $HOME/openra-master/$PACKAGE/mods/ra2/mod.yaml
  288. #*********************************************************************************************************
  289. ## PART 4/7
  290. #
  291. ## Compile the game
  292. echo -e "$bold_in\n4/7 ***Starting OpenRA compilation with Tiberian Sun & Red Alert 2***$out"
  293. sleep 2
  294. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]]; then
  295. cd $HOME/openra-master/$PACKAGE && \
  296. make version && \
  297. make dependencies && \
  298. make all [DEBUG=false]
  299. echo -e "$bold_in\n5/7 ***Preparing OpenRA deb package. This takes a while. Please wait.***\n$out"
  300. dh_make --createorig -s -y && \
  301. echo -e "\noverride_dh_auto_install:\n\tmake install-all install-linux-shortcuts prefix='$HOME/openra-master/$PACKAGE/debian/$PACKAGE_NAME/usr'\n\tsed -i '2s%.*%cd /usr/lib/openra%' '$HOME/openra-master/$PACKAGE/debian/$PACKAGE_NAME/usr/bin/openra'\noverride_dh_usrlocal:\noverride_dh_auto_test:" >> $HOME/openra-master/$PACKAGE/debian/rules && \
  302. sed -i 's/Depends: ${shlibs:Depends}, ${misc:Depends}/Depends: libopenal1, mono-runtime (>= 2.10), libmono-system-core4.0-cil, libmono-system-drawing4.0-cil, libmono-system-data4.0-cil, libmono-system-numerics4.0-cil, libmono-system-runtime-serialization4.0-cil, libmono-system-xml-linq4.0-cil, libfreetype6, libc6, libasound2, libgl1-mesa-glx, libgl1-mesa-dri, xdg-utils, zenity, libsdl2 | libsdl2-2.0-0, liblua5.1-0/g' $HOME/openra-master/$PACKAGE/debian/control && \
  303. sed -i 's/<insert up to 60 chars description>/A multiplayer re-envisioning of early RTS games by Westwood Studios\nConflicts: openra, openra-playtest, openra-bleed/g' $HOME/openra-master/$PACKAGE/debian/control && \
  304. sed -i 's/ <insert long description, indented with spaces>/ ./g' $HOME/openra-master/$PACKAGE/debian/control && \
  305. dpkg-buildpackage -rfakeroot -b -nc -uc -us
  306. #*********************************************************************************************************
  307. ## PART 6/7
  308. #
  309. ## Remove temporary OpenRA build files & directories
  310. echo -e "$bold_in\n6/7 ***Compilation process completed. Moving compiled deb package into '$HOME'***\n$out"
  311. sleep 2
  312. mv $HOME/openra-master/$PACKAGE_NAME*.deb $HOME
  313. elif [[ $DISTRO =~ $OPENSUSE ]] || [[ $DISTRO =~ $FEDORA ]]; then
  314. echo -e "$bold_in\n5/7 ***Compiling OpenRA rpm package.***\n$out"
  315. mkdir -p $HOME/openra-master/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
  316. cp ./data/linux/opensuse/openra.spec $HOME/openra-master/rpmbuild/SPECS/
  317. cp ./data/linux/opensuse/{GeoLite2-Country.mmdb.gz,thirdparty.tar.gz} $HOME/openra-master/rpmbuild/SOURCES/
  318. cd $HOME/openra-master
  319. tar -czf $HOME/openra-master/rpmbuild/SOURCES/$PACKAGE.tar.gz ./$PACKAGE
  320. cd $WORKING_DIR
  321. rpmbuild --define "_topdir $HOME/openra-master/rpmbuild" -bb --clean $HOME/openra-master/rpmbuild/SPECS/openra.spec
  322. echo -e "$bold_in\n6/7 ***Compilation process completed. Moving compiled rpm package into '$HOME'***\n$out"
  323. sleep 2
  324. mv $HOME/openra-master/rpmbuild/RPMS/noarch/$PACKAGE_NAME*.rpm $HOME
  325. fi
  326. echo -e "Removing temporary files."
  327. rm -rf $HOME/openra-master
  328. #*********************************************************************************************************
  329. ## PART 7/7
  330. #
  331. ## Install OpenRA
  332. echo -e "$bold_in\n7/7 ***Starting OpenRA installation process***\n$out"
  333. sleep 2
  334. if [[ $DISTRO =~ $UBUNTU ]] || [[ $DISTRO =~ $DEBIAN ]]; then
  335. if [ $PKG4_CHECK -eq 1 ] || [ $PKG5_CHECK -eq 1 ] || [ $PKG6_CHECK -eq 1 ] ; then
  336. echo -e "\nCan't install '$PACKAGE_NAME' because of conflicting packages.\nPlease remove previously installed openra package from your system and try again.\nBuilt $PACKAGE_NAME deb package can be found in '$HOME'.\n"
  337. else
  338. if [[ $number -eq 1 ]]; then
  339. read -r -p "Install '$PACKAGE_NAME' now? [y/N] " response4
  340. if [[ $response4 =~ ^([yY][eE][sS]|[yY])$ ]]; then
  341. sudo dpkg -i $HOME/$PACKAGE_NAME*.deb
  342. else
  343. echo -e "\nPlease install '$PACKAGE_NAME' manually. You find the compiled package in '$HOME'."
  344. sleep 2
  345. fi
  346. else
  347. sudo dpkg -i $HOME/$PACKAGE_NAME*.deb
  348. fi
  349. fi
  350. elif [[ $DISTRO =~ $OPENSUSE ]] || [[ $DISTRO =~ $FEDORA ]]; then
  351. if [ $PKG1_CHECK -eq 1 ] || [ $PKG2_CHECK -eq 1 ] || [ $PKG3_CHECK -eq 1 ] ; then
  352. echo -e "\nCan't install '$PACKAGE_NAME' because of conflicting packages.\nPlease remove previously installed openra package from your system and try again.\nBuilt $PACKAGE_NAME rpm package can be found in '$HOME'.\n"
  353. else
  354. if [[ $number -eq 1 ]]; then
  355. read -r -p "Install '$PACKAGE_NAME' now? [y/N] " response4
  356. if [[ $response4 =~ ^([yY][eE][sS]|[yY])$ ]]; then
  357. if [[ $DISTRO =~ $FEDORA ]]; then
  358. sudo dnf $METHOD --best --allowerasing install $HOME/$PACKAGE_NAME*.rpm
  359. elif [[ $DISTRO =~ $OPENSUSE ]]; then
  360. sudo zypper $METHOD install $HOME/$PACKAGE_NAME*.rpm
  361. fi
  362. else
  363. echo -e "\nPlease install '$PACKAGE_NAME' manually. You find the compiled package in '$HOME'."
  364. sleep 2
  365. fi
  366. else
  367. if [[ $DISTRO =~ $FEDORA ]]; then
  368. sudo dnf $METHOD --best --allowerasing install $HOME/$PACKAGE_NAME*.rpm
  369. elif [[ $DISTRO =~ $OPENSUSE ]]; then
  370. sudo zypper $METHOD install $HOME/$PACKAGE_NAME*.rpm
  371. fi
  372. fi
  373. fi
  374. fi
  375. #*********************************************************************************************************
  376. else
  377. echo -e "\nAborted.\n"
  378. fi