Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

fireofx-kde-opensuse clean chroot build script

By: a guest on May 5th, 2012  |  syntax: Bash  |  size: 2.33 KB  |  views: 94  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. BUILDDIR=$HOME/build
  4. CHROOT=$HOME/build/chroot
  5.  
  6. getSource () {
  7.     cd $BUILDDIR
  8.     if [[ ! -f $BUILDDIR/kmozillahelper.tar.gz ]]; then
  9.         wget http://aur.archlinux.org/packages/km/kmozillahelper/kmozillahelper.tar.gz
  10.     fi
  11.     if [[ ! -f $BUILDDIR/firefox-kde-opensuse.tar.gz ]]; then
  12.         wget http://aur.archlinux.org/packages/fi/firefox-kde-opensuse/firefox-kde-opensuse.tar.gz
  13.     fi    
  14. }
  15.  
  16.  
  17. cleanBuildDir () {
  18.     if [[ -d $CHROOT ]]; then
  19.         sudo rm -rf $CHROOT
  20.     fi
  21. }
  22.  
  23. addToLoacalRepo () {
  24.     ARCH=$1
  25.     sudo mkdir $CHROOT/root/repo
  26.     sudo chmod 0777 $CHROOT/root/repo
  27.     cp $BUILDDIR/kmozillahelper/kmozillahelper-*-$ARCH.pkg.tar.xz $CHROOT/root/repo
  28.     cd $CHROOT/root/repo
  29.     sudo repo-add local.db.tar.gz kmozillahelper-*.pkg.tar.xz
  30.     echo "\n[local]\nServer = file:///repo\n" | sudo tee -a $CHROOT/root/etc/pacman.conf > /dev/null
  31.     if [[ $ARCH == "x86_64" ]]; then
  32.         sudo mkarchroot -u $CHROOT/root
  33.     elif [[ $ARCH == "i686" ]]; then
  34.         sudo linux32 mkarchroot -u $CHROOT/root
  35.     fi
  36. }
  37.  
  38. buildPackage () {
  39.     ARCH=$1
  40.     if [[ $ARCH == "x86_64" ]]; then
  41. # Install CHROOT
  42.     sudo mkarchroot -C /usr/share/devtools/pacman-extra.conf -M /usr/share/devtools/makepkg-$ARCH.conf $CHROOT/root base base-devel sudo
  43.  
  44. # Build kmozillahelper
  45.         tar xf $BUILDDIR/kmozillahelper.tar.gz
  46.         cd $BUILDDIR/kmozillahelper
  47.         sudo makechrootpkg -c -r $CHROOT
  48.  
  49. # Add package in local repo
  50.         addToLoacalRepo $ARCH  
  51.  
  52. # Build Firefox
  53.         tar xf $BUILDDIR/firefox-kde-opensuse.tar.gz
  54.         cd $BUILDDIR/firefox-kde-opensuse
  55.         sed -i 's/pgo="n"/pgo="y"/g' PKGBUILD
  56.         sudo makechrootpkg -c -r $CHROOT
  57.        
  58.     elif [[ $ARCH == "i686" ]]; then
  59. # Install CHROOT
  60.         sudo linux32 mkarchroot -C /usr/share/devtools/pacman-extra.conf -M /usr/share/devtools/makepkg-$ARCH.conf $CHROOT/root base base-devel sudo
  61.  
  62. # Build kmozillahelper
  63.         tar xf $BUILDDIR/kmozillahelper.tar.gz
  64.         cd $BUILDDIR/kmozillahelper
  65.         sudo linux32 makechrootpkg -c -r $CHROOT
  66.  
  67. # Add package in local repo
  68.         addToLoacalRepo $ARCH
  69.  
  70. # Build Firefox
  71.         tar xf $BUILDDIR/firefox-kde-opensuse.tar.gz
  72.         cd $BUILDDIR/firefox-kde-opensuse
  73.         sed -i 's/pgo="n"/pgo="y"/g' PKGBUILD
  74.         sudo linux32 makechrootpkg -c -r $CHROOT
  75.     fi
  76. }
  77.  
  78. # Main programm
  79. getSource
  80. cleanBuildDir
  81. mkdir $CHROOT
  82. buildPackage x86_64
  83. cleanBuildDir
  84. mkdir $CHROOT
  85. buildPackage i686
  86. cleanBuildDir