On 03/08/22 17:18, Richard W.M. Jones wrote:
On Tue, Mar 08, 2022 at 04:00:15PM +0000, Richard W.M. Jones wrote:
> This patch is fine, thanks ...
>
>> + it is taken as [default_prio], that is, 5000. If [prio] is smaller than 0
>> + or greater than 9999, an Assert_failure is raised (the [prio] parameter
>> + is not expected to depend on external data).
>
> ... but I'm confused by what you meant by "is not expected to depend
> on external data"?
>
> Anyway, ACK
... but see my comment on patch 11:
https://listman.redhat.com/archives/libguestfs/2022-March/028400.html
I've pushed the patch as commit ab708d11d832 with the following updates:
1: 70d06d85099b ! 1: ab708d11d832 mlcustomize/firstboot: take an optional priority in
"add_firstboot_script"
@@ -10,6 +10,10 @@
Suggested-by: Richard W.M. Jones <rjones(a)redhat.com>
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1788823
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220308142922.6267-1-lersek(a)redhat.com>
+ [lersek(a)redhat.com: s/external data/user input/ in MLI docs (Rich)]
+ [lersek(a)redhat.com: remove "default_prio", open-code prio 5000 (Rich)]
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/mlcustomize/firstboot.mli b/mlcustomize/firstboot.mli
--- a/mlcustomize/firstboot.mli
@@ -21,8 +25,6 @@
-val add_firstboot_script : Guestfs.guestfs -> string -> string -> string
-> unit
- (** [add_firstboot_script g root name content] adds a firstboot
- script called [name] containing [content].
-+val default_prio : int
-+
+val add_firstboot_script : Guestfs.guestfs -> string -> ?prio:int -> string
->
+ string -> unit
+ (** [add_firstboot_script g root prio name content] adds a firstboot
@@ -37,9 +39,9 @@
+ Within a given priority, the scripts are run in the order they are
+ registered. A group of scripts with a numerically lower priority is run
+ before a group with a numerically greater priority. If [prio] is omitted,
-+ it is taken as [default_prio], that is, 5000. If [prio] is smaller than 0
-+ or greater than 9999, an Assert_failure is raised (the [prio] parameter
-+ is not expected to depend on external data).
++ it is taken as 5000. If [prio] is smaller than 0 or greater than 9999, an
++ Assert_failure is raised (the [prio] parameter is not expected to depend
++ on user input).
For Linux guests using SELinux you should make sure the
filesystem is relabelled after calling this. *)
@@ -52,9 +54,7 @@
let script_count = ref 0
-let add_firstboot_script (g : Guestfs.guestfs) root name content =
-+let default_prio = 5000
-+
-+let add_firstboot_script (g : Guestfs.guestfs) root ?(prio = default_prio) name
++let add_firstboot_script (g : Guestfs.guestfs) root ?(prio = 5000) name
+ content =
+ assert (prio >= 0 && prio <= 9999);
let typ = g#inspect_get_type root in
Thans,
Laszlo