SPECS: setup.spec - trigger script written in lua

sparky sparky at pld-linux.org
Sat Sep 17 00:25:38 CEST 2005


Author: sparky                       Date: Fri Sep 16 22:25:38 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- trigger script written in lua

---- Files affected:
SPECS:
   setup.spec (1.110 -> 1.111) 

---- Diffs:

================================================================
Index: SPECS/setup.spec
diff -u SPECS/setup.spec:1.110 SPECS/setup.spec:1.111
--- SPECS/setup.spec:1.110	Fri Sep 16 20:37:50 2005
+++ SPECS/setup.spec	Sat Sep 17 00:25:33 2005
@@ -95,13 +95,26 @@
 
 %triggerpostun -p %{_sbindir}/joinpasswd -- %{name} < %{version}-%{release}
 
-%triggerpostun -- %{name} < 2.4.10-1
-# TODO: description what this trigger supposed to do
-awk '/^none.*usbfs/  { gsub(/.*/, \
-	"none\t\t/proc/bus/usb\t\tusbfs\tdefaults,noauto,devgid=78,devmode=0664\t0 0") \
-	} {print}' /etc/fstab > /etc/fstab.new
-cat /etc/fstab.new > /etc/fstab
-rm -f /etc/fstab.new
+%triggerin -p <lua> -- %{name} < 2.4.10-1
+
+-- this script adds ",devmode=0664,devgid=78" in usbfs in old fstab
+-- Warning: it''s not checking if it was already updated
+
+print("Warning: updating /etc/fstab")
+
+F = io.input("/etc/fstab")
+txt = io.read("*a")
+io.close(F)
+
+usbfs = string.find(txt, "usbfs")
+default = string.find(txt, "def", usbfs)
+put_in = string.find(txt, "%s", default)
+
+F = io.output("/etc/fstab")
+io.write(string.sub(txt, 0, put_in - 1))
+io.write(",devmode=0664,devgid=78")
+io.write(string.sub(txt, put_in))
+io.close(F)
 
 %files
 %defattr(644,root,root,755)
@@ -133,6 +146,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.111  2005/09/16 22:25:33  sparky
+- trigger script written in lua
+
 Revision 1.110  2005/09/16 18:37:50  sparky
 - aAAA! one more typo and I'll kill myself :/
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/setup.spec?r1=1.110&r2=1.111&f=u




More information about the pld-cvs-commit mailing list