You are not logged in.

#1 2013-06-12 23:31:01

will.price94
Member
From: UK
Registered: 2011-11-09
Posts: 63
Website

Creating files in packages

Hello,

I'm currently fixing the floola PKGBUILD and it creates some files, the PKGBUILD looks a bit ugly the way I've done it (I can't indent the `cat` lines without having indentation in the files created which I think is worse that indentation in the PKGBUILD.

package() {
  mkdir -p "${pkgdir}/usr/share/"{floola,pixmaps,applications}
  mkdir -p "${pkgdir}/usr/bin"

  install "${srcdir}/128x128.png" "${pkgdir}/usr/share/pixmaps/floola.png"
  cp -R "${srcdir}"/Floola/* "${pkgdir}/usr/share/floola/"
  
  if [ $CARCH = 'x86_64' ]; then
    cat > "${pkgdir}/usr/bin/floola" <<EOF 
#!/bin/bash
export GTK_PATH=/usr/lib32/gtk-2.0
/usr/share/floola/Floola/Floola
EOF
  else
    cat > "${pkgdir}/usr/bin/floola" <<EOF 
#!/bin/bash
/usr/share/floola/Floola/Floola
EOF
fi
  chmod +x "${pkgdir}/usr/bin/floola"

  cat > "${pkgdir}/usr/share/applications/floola.desktop" <<EOF 
[Desktop Entry]
Version=6.1
Name=Floola
Comment=${pkgdesc%.}
Exec=floola
Icon=floola
Type=Application
Categories=AudioVideo;Player; 
EOF

}

Is there a more aesthetically pleasing way to create files from PKGBUILDs? Any other criticisms are appreciated too!

Offline

#2 2013-06-12 23:36:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Creating files in packages

Why do you want to stick it in the PKGBUILD in the first place?

Edit: See e.g. https://projects.archlinux.org/svntogit … s/chromium - .desktop files are provided as separate files.
Arch packages are often more than just the PKGBUILD.


I found https://wiki.archlinux.org/index.php/Desktop_Entries - have a look at it.

Last edited by karol (2013-06-12 23:43:11)

Offline

#3 2013-06-12 23:46:51

will.price94
Member
From: UK
Registered: 2011-11-09
Posts: 63
Website

Re: Creating files in packages

Hi Karol.

I didn't know about bundling files, much much cleaner! Thanks for that. I also wasn't aware of `gendesk`, something I'll look into.

Cheers

Offline

Board footer

Powered by FluxBB