Send plymouth mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.freedesktop.org/mailman/listinfo/plymouth
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of plymouth digest..."


Today's Topics:

   1. [PATCH] [client] Install libply-boot-client library and
      headers (Scott James Remnant)
   2. Re: [PATCH] [client] Install libply-boot-client library and
      headers (Ray Strode)
   3. [PATCH] [main] Write the pid of plymouthd to a file
      (Scott James Remnant)
   4. [PATCH 2/2] [scripts] Don't hardcode LIBEXECDIR and DATADIR
      paths (Scott James Remnant)
   5. [PATCH] [script] drop unused on_draw() function
      (Scott James Remnant)
   6. Re: [PATCH] [main] Write the pid of plymouthd to a file
      (Ray Strode)
   7. Re: [PATCH 2/2] [scripts] Don't hardcode LIBEXECDIR and
      DATADIR paths (Ray Strode)
   8. Re: [PATCH] [main] Write the pid of plymouthd to a file
      (Scott James Remnant)


----------------------------------------------------------------------

Message: 1
Date: Tue, 2 Mar 2010 15:16:33 +0000
From: Scott James Remnant <[email protected]>
Subject: [PATCH] [client] Install libply-boot-client library and
        headers
To: [email protected]
Message-ID: <[email protected]>

When communicating with Plymouth from another process, it's
inconvenient to have to keep spawning the plymouth client binary
and keeping track of it - not to mention slow.

It's far cleaner to be able to link to the same boot client code
that the plymouth binary does, and communicate directly.

Place that code in a new libply-boot-client library, and install
the headers along with it.
---
 configure.ac                     |    1 +
 src/client/Makefile.am           |   21 +++++++++++++++++++++
 src/client/ply-boot-client.pc.in |   10 ++++++++++
 3 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 src/client/ply-boot-client.pc.in

diff --git a/configure.ac b/configure.ac
index 6ecb628..6ade4c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,7 @@ AC_OUTPUT([Makefile
            src/plugins/controls/Makefile
            src/plugins/controls/label/Makefile
            src/Makefile
+           src/client/ply-boot-client.pc
            src/client/Makefile
            src/viewer/Makefile
            src/tests/Makefile
diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index 8dde0f8..9487901 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -17,6 +17,26 @@ plymouth_SOURCES = \
                       $(srcdir)/ply-boot-client.c                             \
                       $(srcdir)/plymouth.c
 
+lib_LTLIBRARIES = libply-boot-client.la
+
+libply_boot_clientdir = $(includedir)/plymouth-1/ply-boot-client
+libply_boot_client_HEADERS = \
+                      $(srcdir)/../ply-boot-protocol.h                        \
+                     ply-boot-client.h
+
+libply_boot_client_la_CFLAGS = $(PLYMOUTH_CFLAGS)
+libply_boot_client_la_LIBADD = $(PLYMOUTH_LIBS) ../libply/libply.la
+libply_boot_client_la_LDFLAGS = -export-symbols-regex '^[^_].*' \
+               -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+               -no-undefined
+libply_boot_client_la_SOURCES = \
+                      $(srcdir)/../ply-boot-protocol.h                        \
+                      $(srcdir)/ply-boot-client.h                             \
+                      $(srcdir)/ply-boot-client.c
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = ply-boot-client.pc
+
 if WITH_RHGB_COMPAT_LINK
 install-data-hook:
        (mkdir -p $(DESTDIR)$(bindir) && cd $(DESTDIR)$(bindir) && ln -sf 
../../bin/plymouth rhgb-client)
@@ -26,4 +46,5 @@ uninstall-hook:
        -rmdir -p $(DESTDIR)$(bindir)/rhgb-client >& /dev/null
 endif
 
+EXTRA_DIST = ply-boot-client.pc.in
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/client/ply-boot-client.pc.in b/src/client/ply-boot-client.pc.in
new file mode 100644
index 0000000..d9984b0
--- /dev/null
+++ b/src/client/ply-boot-client.pc.in
@@ -0,0 +1,10 @@
+pref...@prefix@
+exec_pref...@exec_prefix@
+libd...@libdir@
+included...@includedir@
+
+Name: Plymouth
+Description: Client Library for Boot Splash
+Version: @VERSION@
+Libs: -L${libdir} -lply -lply-boot-client
+Cflags: -I${includedir}/plymouth-1/ply 
-I${includedir}/plymouth-1/ply-boot-client
-- 
1.6.3.3



------------------------------

Message: 2
Date: Tue, 2 Mar 2010 11:02:58 -0500
From: Ray Strode <[email protected]>
Subject: Re: [PATCH] [client] Install libply-boot-client library and
        headers
To: Scott James Remnant <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

Hi,

On Tue, Mar 2, 2010 at 10:16 AM, Scott James Remnant <[email protected]> wrote:
> When communicating with Plymouth from another process, it's
> inconvenient to have to keep spawning the plymouth client binary
> and keeping track of it - not to mention slow.
>
> It's far cleaner to be able to link to the same boot client code
> that the plymouth binary does, and communicate directly.
>
> Place that code in a new libply-boot-client library, and install
> the headers along with it.

Sounds like a good idea to me.  Feel free to commit it.

--Ray


------------------------------

Message: 3
Date: Tue, 2 Mar 2010 16:38:55 +0000
From: Scott James Remnant <[email protected]>
Subject: [PATCH] [main] Write the pid of plymouthd to a file
To: [email protected]
Message-ID: <[email protected]>

Add a --pid-file option to plymouthd that will cause the daemon's
pid to be written to the named file.  Useful to avoid grovelling
through ps output to find it again.

Author: Alberto Milone <[email protected]>
Signed-off-by: Scott James Remnant <[email protected]>
---
 src/libply/ply-utils.c |   25 ++++++++++++++++++++++++-
 src/libply/ply-utils.h |    4 +++-
 src/main.c             |   19 ++++++++++++++++++-
 3 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c
index b26773c..4b40e67 100644
--- a/src/libply/ply-utils.c
+++ b/src/libply/ply-utils.c
@@ -794,7 +794,7 @@ ply_show_new_kernel_messages (bool should_show)
 }
 
 ply_daemon_handle_t *
-ply_create_daemon (void)
+ply_create_daemon (const char *pid_file)
 {
   pid_t pid;
   int sender_fd, receiver_fd;
@@ -820,6 +820,22 @@ ply_create_daemon (void)
           _exit (1);
         }
 
+      if ((byte == 0) && (pid_file != NULL))
+        {
+         FILE *pidf;
+
+         pidf = fopen (pid_file, "w");
+         if (!pidf)
+           {
+             ply_error ("could not write pid file %s: %m", pid_file);
+           }
+         else
+           {
+             fprintf (pidf, "%d\n", pid);
+             fclose (pidf);
+           }
+       }
+
       _exit ((int) byte);
     }
   close (receiver_fd);
@@ -853,6 +869,13 @@ ply_detach_daemon (ply_daemon_handle_t *handle,
   return true;
 }
 
+void
+ply_remove_pid_file (const char *pid_file)
+{
+  if (ply_file_exists (pid_file))
+    unlink (pid_file);
+}
+
 
 /*                    UTF-8 encoding
 00000000-01111111      00-7F   US-ASCII (single byte)
diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h
index 5e41f84..16f37ad 100644
--- a/src/libply/ply-utils.h
+++ b/src/libply/ply-utils.h
@@ -98,10 +98,12 @@ bool ply_create_file_link (const char *source,
                            const char *destination);
 void ply_show_new_kernel_messages (bool should_show);
 
-ply_daemon_handle_t *ply_create_daemon (void);
+ply_daemon_handle_t *ply_create_daemon (const char *pid_file);
 bool ply_detach_daemon (ply_daemon_handle_t *handle,
                         int                  exit_code);
 
+void ply_remove_pid_file (const char *pid_file);
+
 int ply_utf8_character_get_size (const char   *string,
                                  size_t        n);
 int ply_utf8_string_get_length (const char   *string,
diff --git a/src/main.c b/src/main.c
index af956ee..9dbd293 100644
--- a/src/main.c
+++ b/src/main.c
@@ -134,6 +134,7 @@ static void on_error_message (ply_buffer_t *debug_buffer,
                               size_t        number_of_bytes);
 static ply_buffer_t *debug_buffer;
 static char *debug_buffer_path = NULL;
+static char *pid_file = NULL;
 static void check_for_consoles (state_t    *state,
                                 const char *default_tty,
                                 bool        should_add_displays);
@@ -688,6 +689,13 @@ quit_program (state_t *state)
   ply_trace ("exiting event loop");
   ply_event_loop_exit (state->loop, 0);
 
+  if (pid_file != NULL)
+    {
+      ply_remove_pid_file (pid_file);
+      free (pid_file);
+      pid_file = NULL;
+    }
+
 #ifdef PLY_ENABLE_GDM_TRANSITION
   if (state->should_retain_splash)
     {
@@ -1515,6 +1523,13 @@ on_crash (int signum)
         pause ();
       }
 
+    if (pid_file != NULL)
+      {
+       ply_remove_pid_file (pid_file);
+       free (pid_file);
+       pid_file = NULL;
+      }
+
     signal (signum, SIG_DFL);
     raise(signum);
 }
@@ -1543,6 +1558,7 @@ main (int    argc,
                                   "debug", "Output debugging information", 
PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "debug-file", "File to output debugging 
information to", PLY_COMMAND_OPTION_TYPE_STRING,
                                   "mode", "Mode is one of: boot, shutdown", 
PLY_COMMAND_OPTION_TYPE_STRING,
+                                 "pid-file", "Write the pid of the daemon to a 
file", PLY_COMMAND_OPTION_TYPE_STRING,
                                   NULL);
 
   if (!ply_command_parser_parse_arguments (state.command_parser, state.loop, 
argv, argc))
@@ -1564,6 +1580,7 @@ main (int    argc,
                                   "no-daemon", &no_daemon,
                                   "debug", &debug,
                                   "debug-file", &debug_buffer_path,
+                                 "pid-file", &pid_file,
                                   NULL);
 
   if (should_help)
@@ -1605,7 +1622,7 @@ main (int    argc,
 
   if (! no_daemon)
     {
-      daemon_handle = ply_create_daemon ();
+      daemon_handle = ply_create_daemon (pid_file);
 
       if (daemon_handle == NULL)
         {
-- 
1.6.3.3



------------------------------

Message: 4
Date: Tue, 2 Mar 2010 18:13:26 +0000
From: Scott James Remnant <[email protected]>
Subject: [PATCH 2/2] [scripts] Don't hardcode LIBEXECDIR and DATADIR
        paths
To: [email protected]
Message-ID: <[email protected]>

The scripts hard-coded the paths for LIBEXECDIR and DATADIR, unless
passed as environment variables.  Instead of doing this, which breaks
if plymouth is installed outside of /usr, set these derived from the
configure @libexecdir@ and @datadir@ variables just as we do for
pkg-config, etc.

Since we use so many variables, it makes more sense to generate these
scripts from config.status rather than having special Makefile rules
for them.
---
 configure.ac                          |    2 ++
 scripts/Makefile.am                   |   16 ----------------
 scripts/plymouth-populate-initrd.in   |   11 +++++++++--
 scripts/plymouth-set-default-theme.in |   13 ++++++++++---
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6ade4c8..7b2390e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,6 +245,8 @@ AC_OUTPUT([Makefile
            themes/glow/Makefile
            themes/script/Makefile
            images/Makefile
+          scripts/plymouth-populate-initrd
+          scripts/plymouth-set-default-theme
            scripts/Makefile
            docs/Makefile
 ])
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 3de5046..dea4caf 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -6,25 +6,9 @@ initrdscript_SCRIPTS = plymouth-update-initrd 
plymouth-generate-initrd plymouth-
 sbinscriptsdir = $(sbindir)
 sbinscripts_SCRIPTS = plymouth-set-default-theme
 
-plymouth-populate-initrd: $(srcdir)/plymouth-populate-initrd.in
-       sed -e 's,[...@]logofile[@],$(logofile),g'                              
  \
-           -e 's,[...@]plymouthclientdir[@],$(plymouthclientdir),g'            
  \
-           -e 's,[...@]plymouthdaemondir[@],$(plymouthdaemondir),g'            
  \
-           -e 's,[...@]release_file[@],$(RELEASE_FILE),g'              \
-           $(srcdir)/plymouth-populate-initrd.in > plymouth-populate-initrd
-
-plymouth-set-default-theme: $(srcdir)/plymouth-set-default-theme.in
-       sed -e 's,[...@]logofile[@],$(logofile),g'                              
  \
-           -e 's,[...@]plymouthclientdir[@],$(plymouthclientdir),g'            
  \
-           -e 's,[...@]plymouthdaemondir[@],$(plymouthdaemondir),g'            
  \
-           $(srcdir)/plymouth-set-default-theme.in > plymouth-set-default-theme
-
 EXTRA_DIST= plymouth-update-initrd                                             
\
            plymouth-generate-initrd                                           \
            plymouth-populate-initrd.in                                        \
            plymouth-set-default-theme.in                                     \
            $(noinst_SCRIPTS)                                                  \
            default.cfg
-
-CLEANFILES = plymouth-populate-initrd plymouth-set-default-theme
-MAINTAINERCLEANFILES = Makefile.in plymouth-populate-initrd 
plymouth-set-default-theme
diff --git a/scripts/plymouth-populate-initrd.in 
b/scripts/plymouth-populate-initrd.in
index 14eb6fc..db545d7 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -2,8 +2,15 @@
 
 [ -z "$DESTDIR" ] || exit 0
 
-[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
-[ -z "$DATADIR" ] && DATADIR="/usr/share"
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+libexecdir="@libexecdir@"
+datarootdir="@datarootdir@"
+datadir="@datadir@"
+
+[ -z "$LIBEXECDIR" ] && LIBEXECDIR="${libexecdir}"
+[ -z "$DATADIR" ] && DATADIR="${datadir}"
 [ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth 
--get-splash-plugin-path)"
 [ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@logofile@"
 [ -z "$PLYMOUTH_THEME_NAME" ] && 
PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
diff --git a/scripts/plymouth-set-default-theme.in 
b/scripts/plymouth-set-default-theme.in
index e5e2ef0..aeea304 100755
--- a/scripts/plymouth-set-default-theme.in
+++ b/scripts/plymouth-set-default-theme.in
@@ -2,13 +2,20 @@
 
 set -e
 
-[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
-[ -z "$DATADIR" ] && DATADIR="/usr/share"
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+libexecdir="@libexecdir@"
+datarootdir="@datarootdir@"
+datadir="@datadir@"
+
+[ -z "$LIBEXECDIR" ] && LIBEXECDIR="${libexec}"
+[ -z "$DATADIR" ] && DATADIR="${datadir}"
 if [ -z "$PLYMOUTH_PLUGIN_PATH" ]; then
     if [ -z "$LIB" ]; then
         PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
     else
-        [ -z "$LIBDIR" ] && LIBDIR="/usr/$LIB"
+        [ -z "$LIBDIR" ] && LIBDIR="${libdir}"
         PLYMOUTH_PLUGIN_PATH=${LIBDIR}/plymouth/
     fi
 fi
-- 
1.6.3.3



------------------------------

Message: 5
Date: Tue, 2 Mar 2010 18:21:15 +0000
From: Scott James Remnant <[email protected]>
Subject: [PATCH] [script] drop unused on_draw() function
To: [email protected]
Message-ID: <[email protected]>

The on_draw() function inside the script plugin isn't referenced
anywhere, but references a static function from script-lib-sprite.c;
if building without optimisation, it's possible that gcc won't elide
this code so will fail during linking.
---
 src/plugins/splash/script/plugin.c |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/src/plugins/splash/script/plugin.c 
b/src/plugins/splash/script/plugin.c
index 0f990f2..b35994c 100644
--- a/src/plugins/splash/script/plugin.c
+++ b/src/plugins/splash/script/plugin.c
@@ -308,19 +308,6 @@ on_keyboard_input (ply_boot_splash_plugin_t *plugin,
 }
 
 static void
-on_draw (ply_boot_splash_plugin_t *plugin,
-         ply_pixel_buffer_t       *pixel_buffer,
-         int                       x,
-         int                       y,
-         int                       width,
-         int                       height)
-{
-  script_lib_sprite_draw_area (plugin->script_sprite_lib,
-                               pixel_buffer,
-                               x, y, width, height);
-}
-
-static void
 set_keyboard (ply_boot_splash_plugin_t *plugin,
               ply_keyboard_t           *keyboard)
 {
-- 
1.6.3.3



------------------------------

Message: 6
Date: Tue, 2 Mar 2010 14:20:36 -0500
From: Ray Strode <[email protected]>
Subject: Re: [PATCH] [main] Write the pid of plymouthd to a file
To: Scott James Remnant <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

Hi,

On Tue, Mar 2, 2010 at 11:38 AM, Scott James Remnant <[email protected]> wrote:
> Add a --pid-file option to plymouthd that will cause the daemon's
> pid to be written to the named file. ?Useful to avoid grovelling
> through ps output to find it again.
In principle seems fine.  I have few comments below:

> --- a/src/libply/ply-utils.c
> +++ b/src/libply/ply-utils.c
> @@ -820,6 +820,22 @@ ply_create_daemon (void)
> ? ? ? ? ? _exit (1);
> ? ? ? ? }
>
> + ? ? ?if ((byte == 0) && (pid_file != NULL))
> + ? ? ? ?{
> + ? ? ? ? FILE *pidf;
> +
> + ? ? ? ? pidf = fopen (pid_file, "w");
> + ? ? ? ? if (!pidf)
> + ? ? ? ? ? {
> + ? ? ? ? ? ? ply_error ("could not write pid file %s: %m", pid_file);
> + ? ? ? ? ? }
> + ? ? ? ? else
> + ? ? ? ? ? {
> + ? ? ? ? ? ? fprintf (pidf, "%d\n", pid);
Since pid is type pid_t, this should probably have a (int) cast.

> +void
> +ply_remove_pid_file (const char *pid_file)
> +{
> + ?if (ply_file_exists (pid_file))
> + ? ?unlink (pid_file);
> +}
> +
This function isn't really useful.  It would be better to drop
the ply_file_exists entirely and unconditionally call unlink() where
ply_remove_pid_file is called.

> +static char *pid_file = NULL;
This should probably go in the state_t structure with the other state.

--Ray


------------------------------

Message: 7
Date: Tue, 2 Mar 2010 14:28:56 -0500
From: Ray Strode <[email protected]>
Subject: Re: [PATCH 2/2] [scripts] Don't hardcode LIBEXECDIR and
        DATADIR paths
To: Scott James Remnant <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

Hi,

On Tue, Mar 2, 2010 at 1:13 PM, Scott James Remnant <[email protected]> wrote:
> The scripts hard-coded the paths for LIBEXECDIR and DATADIR, unless
> passed as environment variables. ?Instead of doing this, which breaks
> if plymouth is installed outside of /usr, set these derived from the
> configure @libexecdir@ and @datadir@ variables just as we do for
> pkg-config, etc.
>
> Since we use so many variables, it makes more sense to generate these
> scripts from config.status rather than having special Makefile rules
> for them.

I guess this is okay. I'm a little uneasy about config.status since it
doesn't fully expand its arguments.

That means we have to guess which things go up top (e.g.
datarootdir="@datarootdir@"). The sed from Makefile.am technique is
pretty widespread, but i'm not super tied to it.

We can do the config.status thing, but it may end up spontaneously
breaking down the road.  I'm not too worried about it, though.  If
things break we can just fix them.

--Ray


------------------------------

Message: 8
Date: Tue, 02 Mar 2010 19:42:52 +0000
From: Scott James Remnant <[email protected]>
Subject: Re: [PATCH] [main] Write the pid of plymouthd to a file
To: Ray Strode <[email protected]>
Cc: [email protected]
Message-ID: <1267558972.2005.0.ca...@quest>
Content-Type: text/plain; charset="utf-8"

On Tue, 2010-03-02 at 14:20 -0500, Ray Strode wrote:

> > +static char *pid_file = NULL;
> This should probably go in the state_t structure with the other state.
> 
I thought that too and actually modified Alberto's patch to do that, but
then I realised that you don't have a pointed to that in on_crash() -
it'd mean leaving the pid file around in case of crash.

Which is better?

Scott
-- 
Scott James Remnant
[email protected]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: 
<http://lists.freedesktop.org/archives/plymouth/attachments/20100302/3308a1ea/attachment.pgp>

------------------------------

_______________________________________________
plymouth mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/plymouth


End of plymouth Digest, Vol 17, Issue 1
***************************************

Reply via email to