SPECS: setup.spec - shouldn't the trigger be static program, as se...

Przemek Iskra sparky at sparky.homelinux.org
Fri Sep 16 22:39:40 CEST 2005


On Fri, Sep 16, 2005 at 10:06:04PM +0300, Elan Ruusamäe wrote:

it has to add "devmode=0664,devgid=78" in usbfs in fstab
as most people has changed /etc/fstab the new one will become
/etc/fstab.rpmnew

> could do inline lua scripting i believe?
> 
> %triggerpostin -p <lua>
> LUA SCRIPTING LANGUAGE HERE.
> 
> i don't know lua, i only know it's possible, as i had similiar situation with 
> glibc package :)

OK, I've written some thing like that, what do you think about it ?
+ it's not changing file permissions
- it can be run only once

-- 
 ____  Sparky{PI] -- Przemyslaw _  ___  _  _  ..Mail,MSN  LANG...Pl..Ca..Es..En
/____) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWW........ppcrcd.pld-linux.org
\____\| -_)'___| ||^'||//\\// <   |  _/| |  | : JID......sparky<at>jabberes.org
(____/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| :..sparky<at>sparky.homelinux.org
-------------- next part --------------
#!/usr/bin/lua40

-- find usbfs -> def(aults) -> "space", and put there what is neaded
-- Warning: it's not checking if it was there already

F = readfrom("/etc/fstab")
txt = read("*a")
closefile(F)

usbfs = strfind(txt, "usbfs")
default = strfind(txt, "def", usbfs)
put_in = strfind(txt, "%s", default)

F = openfile("/etc/fstab", "w")
write(F, strsub(txt, 0, put_in - 1))
write(F, ",devmode=0664,devgid=78")
write(F, strsub(txt, put_in))
closefile(F)


More information about the pld-devel-en mailing list