makedevs: Add file and diretory creation code (from OE)

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2642 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie 2007-09-01 23:47:58 +00:00
parent bbbb9f5f08
commit 8d342dc056
3 changed files with 10 additions and 2 deletions

View File

@ -106,6 +106,7 @@ static char *xstrdup(const char *s)
static void add_new_directory(char *name, char *path,
unsigned long uid, unsigned long gid, unsigned long mode)
{
mkdir(path,mode);
// printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode);
}
@ -136,6 +137,13 @@ static void add_new_device(char *name, char *path, unsigned long uid,
static void add_new_file(char *name, char *path, unsigned long uid,
unsigned long gid, unsigned long mode)
{
int fd = open(path,O_CREAT | O_WRONLY, mode);
if(fd<0)
{
error_msg_and_die("%s: file can not be created!", path);
} else {
close(fd);
}
// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
// path, name, gid, uid, mode);
}

View File

@ -1,6 +1,6 @@
SECTION = "base"
require makedevs_${PV}.bb
inherit native
inherit native
FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/makedevs-${PV}"

View File

@ -4,7 +4,7 @@ SECTION = "base"
PRIORITY = "required"
SRC_URI = "file://makedevs.c"
S = "${WORKDIR}/makedevs-${PV}"
PR = "r2"
PR = "r3"
do_configure() {
install -m 0644 ${WORKDIR}/makedevs.c ${S}/