Move pkg unpack functionality out of unpack command

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-01-30 13:26:05 +01:00
parent b052a12beb
commit f62bab2629
4 changed files with 18 additions and 12 deletions

View File

@ -10,7 +10,7 @@ GLOBALHDR += include/image_entry.h include/pkgio.h
MAIN = main/pkg.c main/util.c main/compressor.c main/command.c main/pkgreader.c
MAIN += main/pkgwriter.c main/image_entry.c main/image_entry_sort.c
MAIN += main/mkdir_p.c main/pkgio_rd_image_entry.c
MAIN += main/mkdir_p.c main/pkgio_rd_image_entry.c main/pkg_unpack.c
pkg_SOURCES = $(GLOBALHDR) $(MAIN)
pkg_CFLAGS = $(AM_CFLAGS)
@ -35,7 +35,6 @@ pkg_SOURCES += main/cmd/dump/dump_header.c
# unpack command
pkg_SOURCES += main/cmd/unpack/unpack.c main/cmd/unpack/unpack.h
pkg_SOURCES += main/cmd/unpack/pkg_unpack.c
# help command
pkg_SOURCES += main/cmd/help.c

View File

@ -4,6 +4,13 @@
#include "pkgreader.h"
#include "image_entry.h"
enum {
UNPACK_NO_CHOWN = 0x01,
UNPACK_NO_CHMOD = 0x02,
};
int pkg_unpack(int rootfd, int flags, pkg_reader_t *rd);
image_entry_t *image_entry_list_from_package(pkg_reader_t *pkg);
#endif /* PKGIO_H */

View File

@ -17,13 +17,4 @@
#include "pkgio.h"
#include "util.h"
enum {
UNPACK_NO_CHOWN = 0x01,
UNPACK_NO_CHMOD = 0x02,
};
int mkdir_p(const char *path);
int pkg_unpack(int rootfd, int flags, pkg_reader_t *rd);
#endif /* UNPACK_H */

View File

@ -1,4 +1,13 @@
#include "unpack.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include "pkgio.h"
#include "util.h"
static int create_hierarchy(int dirfd, image_entry_t *list)
{