You are not logged in.

#1 2010-01-29 21:07:21

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,636
Website

get PGKBUILD to modify local files... best way to do it? [SOLVED]

I'm writing a PKGBUILD that will simply place a script in /etc/cron.hourly but I also need to have both /etc/rc.local and /etc/rc.local.shutdown run the script (e.g./etc/cron.d/sync-monitorix.sh).  I don't know how to go about modifying these two files via the PKGBUILD.  Suggestions are welcomed.

pkgname=monitorix-tmpfs
pkgver=1.0
pkgrel=1
pkgdesc='Simple script to allow monitorix to run in tmpfs and sync data back to your hdd.'
arch=(any)
license=(GPL)
depends=(rsync monitorix)
source=(sync-monitorix.sh)
md5sums=(64573a0f7452b2f68cbd69ba86106d6b)

build() {  
  install -D sync-monitorix.sh $pkgdir/etc/cron.hourly/sync-monitorix.sh
}

Last edited by graysky (2010-01-30 01:23:19)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2010-01-29 21:47:22

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: get PGKBUILD to modify local files... best way to do it? [SOLVED]

I wouldn't want a PKGBUILD to do that to my /etc/rc.local and /etc/rc.local.shutdown files. Those are my files and PKGBUILDs shouldn't be tampering with them. You'd have to parse them to know where to put your stuff. I don't know if you're even entitled to assume they're bash files (I forget right now whether they're sourced or executed---if the latter they needn't be bash files, right? though I grant they're overwhelmingly likely to be so).

Are you sure you can't do what you want with an /etc/rc.d/your_daemon? If the timing of when daemons start and stop isn't quite right, have a look at the "hooks" in /etc/rc.d/functions. I'm not sure which version of initscripts this shows up in---perhaps it's already in [core], perhaps still in [testing], perhaps only in the initscripts git repository. I haven't kept track. But it's very nice functionality for registering functions to be run at other times than the etc/rc.d/daemons run.

Or, just write a message on install telling users what they need to do to their /etc/rc.local files. And put it in the manpage/docs.

Offline

#3 2010-01-29 22:00:39

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: get PGKBUILD to modify local files... best way to do it? [SOLVED]

graysky wrote:

I don't know how to go about modifying these two files via the PKGBUILD.  Suggestions are welcomed.

Please don't do it!

Profjim wrote:

just write a message on install telling users what they need to do to their /etc/rc.local files. And put it in the manpage/docs.

Please do this!

Official Arch packages promise to never overwrite your files. Either your package "owns" the file, or you don't touch it.

...I think. Didn't I read that somewhere? tongue

Offline

#4 2010-01-29 22:34:31

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: get PGKBUILD to modify local files... best way to do it? [SOLVED]

Correct.

Offline

#5 2010-01-29 22:40:51

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,636
Website

Re: get PGKBUILD to modify local files... best way to do it? [SOLVED]

I'll echo some text with readme.install, thanks for the tips.

Last edited by graysky (2010-01-30 01:22:31)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB