Advertisement
Guest User

Untitled

a guest
May 6th, 2021
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 0 0
  1. # Maintainer : Uwe Grasshoff <aurpackages@crazyideas.dee>
  2. # Contributor: Felix Golatofski <contact@xdfr.de>
  3. # Contributor: Red_Squirrel <evangelion87d@gmail.com>
  4. # Contributor: Xavier114fch <xavier114fch@gmail.com>
  5. # Contributor: nachoig <areta@outlook.com.br>
  6. # Contributor: nTia89 <mattia.b89@gmail.com>
  7. # Contributor: Mark E. Lee <mark@markelee.com>
  8.  
  9. ## Check for new LibreOffice releases:
  10. # $ wget "https://download.documentfoundation.org/libreoffice/stable/" -q -O /tmp/lo.html && echo "LibreOffice versions" && awk '{print $3;}' /tmp/lo.html|cut -b 7-11|grep --color=never [0-9].[0-9].[0-9]; rm /tmp/lo.html
  11. # site to look for the sha256sum
  12. # https://download.documentfoundation.org/libreoffice/stable/7.1.2/rpm/x86_64/LibreOffice_7.1.2_Linux_x86-64_rpm.tar.gz.mirrorlist
  13.  
  14. pkgname=libreoffice-fresh-rpm
  15. pkgver=7.1.3
  16. pkgrel=3
  17. pkgdesc="LGPL Office Suite installed from rpms"
  18. arch=('x86_64')
  19. url='https://www.libreoffice.org'
  20. license=('LGPL')
  21. depends=('glibc>=2.5' 'gtk2>=2.10.4' 'xorg-server')
  22. conflicts=('libreoffice-fresh' 'libreoffice-base')
  23. makedepends=('curl' 'awk')
  24. optdepends=('jre8-openjdk' 'gtk3' 'gst-plugins-base' 'gst-plugins-good' 'gst-plugins-bad' 'gst-plugins-ugly')
  25. # WARNING sha256sums values should be taken from details page about rpm.tar.gz files from servers. DO NOT USE _updpgksums_ tool.
  26. arch_mod='x86_64';
  27. sha256sums=('09adb0653e76614ada61f01f7ce4a4943e4bd90568d141f6a884f0a247b6b1f4')
  28. source=("https://download.documentfoundation.org/libreoffice/stable/${pkgver}/rpm/${arch_mod}/LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm.tar.gz")
  29.  
  30. prepare() { ## prepare function
  31.  
  32. ## install optional language & help packs (queries user)
  33. msg "Debug: 1";
  34. curl "http://download.documentfoundation.org/libreoffice/stable/${pkgver}/rpm/${arch_mod}/" -o index.html; ## get index.html
  35. msg "Debug: 2";
  36. declare -ar opt_pak=('langpack' 'helppack'); ## declare optional extensions
  37. msg "Debug: 3";
  38. for a in ${opt_pak[@]}; do ## loop for all optional extensions
  39. read -p "Do you want to install additional ${a} (Y/y/N/n)?" opt_ans;
  40. case $opt_ans in ## evaluate the answer
  41. Y|y)
  42. echo "Which ${a} do you want to install?";
  43. ## generate a menu for all available packages
  44. select opt_ext in $(cat index.html | awk -F'_' "/${a}/ && !/.asc/ {print \$7}" | awk -F'.' '{print $1}'); do
  45. ## download the rpm package
  46. msg "Retrieving LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz...";
  47. curl -L -O "https://download.documentfoundation.org/libreoffice/stable/${pkgver}/rpm/${arch_mod}/LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz";
  48. ## download the rpm sha256
  49. curl -L -O "https://download.documentfoundation.org/libreoffice/stable/${pkgver}/rpm/${arch_mod}/LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz.sha256";
  50. ## check the sha256 sum for the package
  51. msg "Done";
  52. msg "Validating LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz with sha256sum...";
  53. sha256sum -c "LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz.sha256"
  54. if [ ! $? -eq 0 ]; then ## check the sha256sum error
  55. echo "Failed sha256sum check for https://download.documentfoundation.org/libreoffice/stable/${pkgver}/rpm/${arch_mod}/LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz";
  56. exit;
  57. else
  58. msg "Done";
  59. ## extract the help/lang pack archive
  60. msg "Extracting LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz..."
  61. tar -xf "LibreOffice_${pkgver}_Linux_${arch_mod/_/-}_rpm_${a}_${opt_ext}.tar.gz";
  62. msg "Done";
  63. fi;
  64. break; ## break the select loop
  65. done;
  66. ;;
  67. N|n)
  68. echo "Not installing additional $a";
  69. ;;
  70. *)
  71. echo "Not a valid answer";
  72. ;;
  73. esac;
  74. done;
  75.  
  76. }
  77.  
  78. package() { ## package function
  79.  
  80. ## check kernel version to allow arbitrarily patched kernels
  81. min_kernMajor=2;
  82. min_kernMinor=6;
  83. min_kernRelease=18;
  84. ## in bash, we need to split kernVer assigning into 2 steps
  85. tmp_kernVer=$(uname -r);
  86. new_kernVer=${tmp_kernVer%%-*}
  87. kernVer=(${new_kernVer//./ });
  88. ## remove temporary variables
  89. unset new_kernVer tmp_kernVer;
  90.  
  91. if [ ${kernVer[0]} -le $min_kernMajor ]; then
  92. if [ ${kernVer[1]} -le $min_kernMinor ]; then
  93. if [ ${kernVer[2]} -lt $min_kernRelease ]; then
  94. msg "The kernel version needs to be at least 2.6.18. The current kernel version is $(uname -r). Please update your linux kernel";
  95. exit;
  96. fi;
  97. fi;
  98. fi;
  99.  
  100. cd ${srcdir}; ## enter the package source directory
  101. ## extract rpms and install them
  102. for a in $(ls -d */); do ## loop for all directories found
  103. cd "${srcdir}/${a}/RPMS"; ## enter the RPMS directory
  104. for b in *.rpm; do ## loop for all rpm files found
  105. bsdtar -xf $b; ## extract the rpm files
  106. done;
  107.  
  108. cp -rf */ ${pkgdir}/; ## copy and merge all found directories to the package directory
  109.  
  110. ## change the permissions for files that shouldn't be executable
  111. declare -a wrongexec=("opt/libreoffice$(echo $pkgver | awk -F'.' 'OFS="." {print $1,$2}')/CREDITS.fodt" "opt/libreoffice$(echo $pkgver | awk -F'.' 'OFS="." {print $1,$2}')/LICENSE" "opt/libreoffice$(echo $pkgver | awk -F'.' 'OFS="." {print $1,$2}')/NOTICE"); ## set the array to change permissions
  112. for a in ${wrongexec[@]}; do
  113. chmod 644 ${pkgdir}/$a; ## change permissions to read/write for root, read only for users
  114. done;
  115. done;
  116.  
  117. }
  118.  
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement