Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=416ec363cdb8b24e4deec412b275d06941dd0c33

commit 416ec363cdb8b24e4deec412b275d06941dd0c33
Author: James Buren <[email protected]>
Date:   Fri Sep 7 05:01:03 2012 -0500

use C api to mount /dev, /proc, /sys in install root

diff --git a/src/local.h b/src/local.h
index 87b2e09..43177ee 100644
--- a/src/local.h
+++ b/src/local.h
@@ -9,6 +9,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
+#include <sys/mount.h>
#include <wchar.h>
#include <errno.h>
#include <limits.h>
diff --git a/src/postconfig.c b/src/postconfig.c
index b7e3d8a..137c719 100644
--- a/src/postconfig.c
+++ b/src/postconfig.c
@@ -150,6 +150,24 @@ static bool postconfig_run(void)
fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
return false;
}
+
+  if(mount("none",INSTALL_ROOT "/dev","devtmpfs",0,0) == -1)
+  {
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }
+
+  if(mount("none",INSTALL_ROOT "/proc","proc",0,0) == -1)
+  {
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }
+
+  if(mount("none",INSTALL_ROOT "/sys","sysfs",0,0) == -1)
+  {
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }

if(!is_root_setup() && !ui_window_root(&account) && !root_action(&account))
{
@@ -166,6 +184,24 @@ static bool postconfig_run(void)
}

account_free(&account);
+
+  if(umount2(INSTALL_ROOT "/dev",MNT_DETACH) == -1)
+  {
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }
+
+  if(umount2(INSTALL_ROOT "/proc",MNT_DETACH) == -1)
+  {
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }
+
+  if(umount2(INSTALL_ROOT "/sys",MNT_DETACH) == -1)
+  {
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }

return true;
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to