summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2007-10-21 18:37:30 -0400
committerRay Strode <rstrode@redhat.com>2007-10-21 18:37:30 -0400
commit78302f06c38f4ada1100fee6a2f319a194f7c2ad (patch)
tree251979b0a37d829f0691cd070d5e4c8c1a0193b3 /src
parentd12eaca1051f8a5227286daf7fa94cad2ea29b3a (diff)
downloadplymouth-78302f06c38f4ada1100fee6a2f319a194f7c2ad.tar.gz
plymouth-78302f06c38f4ada1100fee6a2f319a194f7c2ad.tar.xz
plymouth-78302f06c38f4ada1100fee6a2f319a194f7c2ad.zip
chroot back to original / before spawning nash.
Also use ply-utils ls functiona and add random multilib fixes
Diffstat (limited to 'src')
-rw-r--r--src/main.c58
1 files changed, 13 insertions, 45 deletions
diff --git a/src/main.c b/src/main.c
index b612a47..e6feebc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -59,7 +59,14 @@ on_session_start (state_t *state)
if (fchdir (state->original_root_dir_fd) < 0)
{
ply_trace ("Could not change to original root directory "
- "to start session: %m");
+ "to start session: %m");
+ return;
+ }
+
+ if (chroot (".") < 0)
+ {
+ ply_trace ("Could not change root back to original directory "
+ "to start session: %m");
return;
}
ply_trace ("changed to original root fs");
@@ -208,12 +215,10 @@ create_working_directory (state_t *state)
if (!ply_create_directory ("usr/share/plymouth"))
return false;
- ply_trace ("creating usr/lib/plymouth subdirectory");
- if (!ply_create_directory ("usr/lib/plymouth"))
+ ply_trace ("creating " PLYMOUTH_PLUGIN_PATH " subdirectory");
+ if (!ply_create_directory (PLYMOUTH_PLUGIN_PATH + 1))
return false;
- ply_trace ("created detachable working directory '%s'",
- PLY_WORKING_DIRECTORY);
return true;
}
@@ -304,52 +309,14 @@ copy_data_files (state_t *state)
ply_trace ("copied data files");
ply_trace ("copying plugins");
- if (!ply_copy_directory ("/usr/lib/plymouth",
- "usr/lib/plymouth"))
+ if (!ply_copy_directory (PLYMOUTH_PLUGIN_PATH,
+ PLYMOUTH_PLUGIN_PATH + 1))
return false;
ply_trace ("copied plugins files");
return true;
}
-static void
-ls (const char *path)
-{
- DIR *dir;
- struct dirent *entry;
- static int level = 0;
-
- dir = opendir (path);
-
- if (dir == NULL)
- return;
-
- if (level > 5)
- return;
-
- int index = 0;
- while ((entry = readdir (dir)) != NULL)
- {
- char *subdir;
-
- index++;
-
- if (index > 10)
- break;
-
- subdir = NULL;
- asprintf (&subdir, "%s/%s", path, entry->d_name);
- ply_error ("%s ", subdir);
- level++;
- if (entry->d_name[0] != '.')
- ls (subdir);
- level--;
- free (subdir);
- }
-
- closedir (dir);
-}
-
static bool
initialize_environment (state_t *state)
{
@@ -401,6 +368,7 @@ main (int argc,
if (!initialize_environment (&state))
{
ply_error ("could not setup basic operating environment: %m");
+ ply_list_directory (PLY_WORKING_DIRECTORY);
return EX_OSERR;
}