Permalink
Browse files

Add a nullfs backed "socket" passthrough layer to pbifs, this allows …

…sockets in

/var/run to be available to PBIs, same as in /tmp

This fixes bugs with CUPS not being able to work in PBIs
  • Loading branch information...
1 parent 27b31a3 commit 6d736fb8c74b7e236fefd99271b3e9f2613b3a32 @kmoore134 kmoore134 committed Mar 6, 2014
Showing with 24 additions and 1 deletion.
  1. +17 −1 src-sh/pbi-manager/pbifs/main.c
  2. +7 −0 src-sh/pbi-manager/pbime/pbimount
@@ -120,7 +120,7 @@ int get_modified_path(char *npath, const char *opath)
// First, lets look for calls to /var/run/ld-elf*.so.hints
// These need to be replaced with calls to our new hints file in hintsdir
- if ( strpos(rPath, "/var/run/") == 0 )
+ if ( strpos(rPath, "/var/run") == 0 )
{
if ( strcmp(rPath, "/var/run/ld-elf.so.hints") == 0 )
{
@@ -134,6 +134,22 @@ int get_modified_path(char *npath, const char *opath)
strcat(npath, "/ld-elf32.so.hints");
return 0;
}
+
+ // Check for requests to socket files
+ if ( strpos(rPath, ".sock") != -1 )
+ {
+ // Return the "nullfs-mounted" /var/run
+ strcpy(npath, replace_str(rPath, "/var/run", "/usr/pbi/varrun"));
+ return 0;
+ }
+ // Check for requests to socket files
+ if ( strpos(rPath, "socket") != -1 )
+ {
+ // Return the "nullfs-mounted" /var/run
+ strcpy(npath, replace_str(rPath, "/var/run", "/usr/pbi/varrun"));
+ return 0;
+ }
+
}
if ( strcmp(rPath, "/etc/rc.d/ldconfig") == 0 )
@@ -68,6 +68,13 @@ mount_dirs() {
is_mounted "${pDir}/virtbase/proc" || mount -t procfs procfs "${pDir}/virtbase/proc"
is_mounted "${pDir}/virtbase/tmp" || mount_nullfs /tmp "${pDir}/virtbase/tmp"
+ # Mount our real system /var/run with nullfs, so that sockets are available which tend
+ # to exist there
+ if [ ! -d "/usr/pbi/varrun" ] ; then
+ mkdir /usr/pbi/varrun
+ fi
+ is_mounted "${pDir}/virtbase/usr/pbi/varrun" || mount_nullfs /var/run "${pDir}/virtbase/usr/pbi/varrun"
+
if [ -d "${pDir}/virtbase/compat/linux/proc" ] ; then
is_mounted "${pDir}/virtbase/compat/linux/proc" || mount -t linprocfs linprocfs "${pDir}/virtbase/compat/linux/proc"
fi

0 comments on commit 6d736fb

Please sign in to comment.