You are not logged in.

#1 2014-12-12 23:00:07

exul
Member
Registered: 2012-07-26
Posts: 4

[SOLVED] Run vim command in post_install()

Hi

I'm trying to create a PKGBUILD for https://github.com/fatih/vim-go (there is already a package vim-go but it covers another vim plugin).

To install the binaries the package uses the vim command :GoInstallBinaries (as stated in the README). This could be invoked via:

post_install(){
  vim +GoInstallBinaries
}

Problem is: GoInstallBinaries is usually executed by the user who uses the plugin. It installes the binaries to the $GOPATH. But during the installation this will be executed as root, which means that $GOPATH is not set.

What's the best way to solve this? Just a message after the intallation?

My current PKGBUILD looks like this:

# Maintainer: exul <exul  [at] v-net [dot] ch>

pkgname=vim-go-git
pkgver=20141212
pkgrel=1
pkgdesc='Go (golang) support for Vim.'
arch=('x86_64' 'i686')
license=('unknown')
conflicts=('gocode-git gocode-bin')
makedepends=('git mercurial')
url=('https://github.com/fatih/vim-go')

_gitroot="https://github.com/fatih/vim-go.git"

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [ -d $pkgname ] ; then
    cd $_gitname && git pull origin
    msg "The local files are updated."
  else
    git clone $_gitroot $pkgname
    cd $pkgname
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting build..."
} 

package() {
  msg "Installing vim files..."
  mkdir -p ${pkgdir}/usr/share/vim/vimfiles
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/autoload ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/compiler ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/doc ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/ftdetect ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/ftplugin ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/gosnippets ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/indent ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/plugin ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/scripts ${pkgdir}/usr/share/vim/vimfiles/
  cp -dr --no-preserve=ownership ${srcdir}/${pkgname}/syntax ${pkgdir}/usr/share/vim/vimfiles/
}

Last edited by exul (2014-12-12 23:28:45)

Offline

#2 2014-12-12 23:21:02

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Run vim command in post_install()

exul wrote:

What's the best way to solve this? Just a message after the intallation?

Yep.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-12-12 23:28:59

exul
Member
Registered: 2012-07-26
Posts: 4

Re: [SOLVED] Run vim command in post_install()

Thank you.

Offline

Board footer

Powered by FluxBB