diff options
author | George Lebl <jirka@5z.com> | 2002-07-23 22:06:14 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2002-07-23 22:06:14 +0000 |
commit | 4d0446db733089b9d6795ac40107b6dbfda41b7d (patch) | |
tree | 71b4a551b23bbc3822e868a858d1df5823332752 | |
parent | d8243741f4a2d705e8cdc3c22b3e811bb03f6d42 (diff) | |
download | gdm-4d0446db733089b9d6795ac40107b6dbfda41b7d.tar.gz |
change dir to /root or / when starting the setup proggie. Also set the
Tue Jul 23 15:15:16 2002 George Lebl <jirka@5z.com>
* daemon/slave.c: change dir to /root or / when starting the
setup proggie. Also set the busy cursor in the main process
rather then risk weird things happening from two processes
trying to do it at the same time.
* gui/gdmsetup.c: support .bz2 archives for theme installing
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | daemon/slave.c | 27 | ||||
-rw-r--r-- | gui/gdmsetup.c | 59 |
3 files changed, 73 insertions, 22 deletions
@@ -1,3 +1,12 @@ +Tue Jul 23 15:15:16 2002 George Lebl <jirka@5z.com> + + * daemon/slave.c: change dir to /root or / when starting the + setup proggie. Also set the busy cursor in the main process + rather then risk weird things happening from two processes + trying to do it at the same time. + + * gui/gdmsetup.c: support .bz2 archives for theme installing + Tue Jul 23 12:20:26 2002 George Lebl <jirka@5z.com> * Release 2.4.0.3 diff --git a/daemon/slave.c b/daemon/slave.c index 9be037ec..30f04c40 100644 --- a/daemon/slave.c +++ b/daemon/slave.c @@ -747,6 +747,16 @@ run_config (GdmDisplay *display, struct passwd *pwent) { pid_t pid; + /* Set the busy cursor */ + if (d->dsp != NULL) { + Cursor xcursor = XCreateFontCursor (d->dsp, GDK_WATCH); + XDefineCursor (d->dsp, + DefaultRootWindow (d->dsp), + xcursor); + XFreeCursor (d->dsp, xcursor); + XSync (d->dsp, False); + } + gdm_sigchld_block_push (); gdm_sigterm_block_push (); pid = d->sesspid = fork (); @@ -754,19 +764,17 @@ run_config (GdmDisplay *display, struct passwd *pwent) gdm_sigchld_block_pop (); if (pid < 0) { - /* can't fork, damnit */ - display->sesspid = 0; - return; - } - - /* Set the busy cursor */ - if (d->dsp != NULL) { - Cursor xcursor = XCreateFontCursor (d->dsp, GDK_WATCH); + /* return left pointer */ + Cursor xcursor = XCreateFontCursor (d->dsp, GDK_LEFT_PTR); XDefineCursor (d->dsp, DefaultRootWindow (d->dsp), xcursor); XFreeCursor (d->dsp, xcursor); XSync (d->dsp, False); + + /* can't fork, damnit */ + display->sesspid = 0; + return; } if (pid == 0) { @@ -804,6 +812,9 @@ run_config (GdmDisplay *display, struct passwd *pwent) openlog ("gdm", LOG_PID, LOG_DAEMON); + if (chdir ("/root") != 0) + chdir ("/"); + /* exec the configurator */ argv = ve_split (GdmConfigurator); if (argv != NULL && diff --git a/gui/gdmsetup.c b/gui/gdmsetup.c index c9fbb729..09fb26f1 100644 --- a/gui/gdmsetup.c +++ b/gui/gdmsetup.c @@ -1266,23 +1266,54 @@ selected_toggled (GtkCellRendererToggle *cell, run_timeout (theme_list, 500, greeter_theme_timeout); } +static gboolean +is_ext (const char *filename, const char *ext) +{ + const char *dot; + + dot = strrchr (filename, '.'); + if (dot == NULL) + return FALSE; + + if (strcmp (dot, ext) == 0) + return TRUE; + else + return FALSE; +} + +/* sense the right unzip program */ static char * -find_gunzip (void) +find_unzip (const char *filename) { char *prog; - char *try[] = { + char *tryg[] = { "/bin/gunzip", "/usr/bin/gunzip", NULL }; + char *tryb[] = { + "/bin/bunzip2", + "/usr/bin/bunzip2", + NULL }; int i; + if (is_ext (filename, ".bz2")) { + prog = g_find_program_in_path ("bunzip2"); + if (prog != NULL) + return prog; + + for (i = 0; tryb[i] != NULL; i++) { + if (access (tryb[i], X_OK) == 0) + return g_strdup (tryb[i]); + } + } + prog = g_find_program_in_path ("gunzip"); if (prog != NULL) return prog; - for (i = 0; try[i] != NULL; i++) { - if (access (try[i], X_OK) == 0) - return g_strdup (try[i]); + for (i = 0; tryg[i] != NULL; i++) { + if (access (tryg[i], X_OK) == 0) + return g_strdup (tryg[i]); } /* Hmmm, fallback */ return g_strdup ("/bin/gunzip"); @@ -1388,9 +1419,9 @@ get_the_dir (FILE *fp, char **error) static char * get_archive_dir (const char *filename, char **untar_cmd, char **error) { - char *quoted = g_shell_quote (filename); - char *tar = find_tar (); - char *gunzip = find_gunzip (); + char *quoted; + char *tar; + char *unzip; char *cmd; char *dir; FILE *fp; @@ -1406,9 +1437,9 @@ get_archive_dir (const char *filename, char **untar_cmd, char **error) quoted = g_shell_quote (filename); tar = find_tar (); - gunzip = find_gunzip (); + unzip = find_unzip (filename); - cmd = g_strdup_printf ("%s -c %s | %s -tf -", gunzip, quoted, tar); + cmd = g_strdup_printf ("%s -c %s | %s -tf -", unzip, quoted, tar); fp = popen (cmd, "r"); g_free (cmd); if (fp != NULL) { @@ -1417,9 +1448,9 @@ get_archive_dir (const char *filename, char **untar_cmd, char **error) ret = pclose (fp); if (ret == 0 && dir != NULL) { *untar_cmd = g_strdup_printf ("%s -c %s | %s -xf -", - gunzip, quoted, tar); + unzip, quoted, tar); g_free (tar); - g_free (gunzip); + g_free (unzip); g_free (quoted); return dir; } @@ -1443,7 +1474,7 @@ get_archive_dir (const char *filename, char **untar_cmd, char **error) *untar_cmd = g_strdup_printf ("%s -xf %s", tar, quoted); g_free (tar); - g_free (gunzip); + g_free (unzip); g_free (quoted); return dir; } @@ -1458,7 +1489,7 @@ get_archive_dir (const char *filename, char **untar_cmd, char **error) *error = _("File not a tar.gz or tar archive"); g_free (tar); - g_free (gunzip); + g_free (unzip); g_free (quoted); return NULL; |