procd: add docker support
authorPaul Spooren <mail@aparcar.org>
Mon, 27 May 2019 09:33:29 +0000 (11:33 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 29 May 2019 12:00:32 +0000 (14:00 +0200)
detects if running in a docker container, which then requires special
treatment of mounts. OpenWrt within Docker is useful for CI testing.

Signed-off-by: Paul Spooren <mail@aparcar.org>
container.h

index d33fa3266dc09e627ace4f8397796ad018d853b2..dd2e432adbfc586fd824846d63485b42248fe8a9 100644 (file)
 
 #include <stdlib.h>
 #include <stdbool.h>
 
 #include <stdlib.h>
 #include <stdbool.h>
+#include <sys/stat.h>
 
 static inline bool is_container() {
 
 static inline bool is_container() {
-       return !!getenv("container");
+       struct stat s;
+       return !!getenv("container") || !!stat("/.dockerenv", &s);
 }
 
 #endif
 }
 
 #endif