FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ununpack_globals.h
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2011-2014 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
10 #ifndef UNUNPACK_GLOBALS_H
11 #define UNUNPACK_GLOBALS_H
12 
13 #ifdef COMMIT_HASH
14 char BuildVersion[]="Build version: " COMMIT_HASH ".\n";
15 char Version[]=COMMIT_HASH;
16 #else
17 char Version[]="0.9.9";
18 #endif
19 
20 int Verbose=0;
21 int Quiet=0;
23 int UnlinkAll=0;
25 int ForceDuplicate=0; /* when using db, should it process duplicates? */
26 int PruneFiles=0;
27 int SetContainerArtifact=1; /* should initial container be an artifact? */
28 FILE *ListOutFile=NULL;
31 
32 /* for the repository */
34 char REP_GOLD[16]="gold";
35 char REP_FILES[16]="files";
36 
37 char UploadFileName[FILENAME_MAX]; /* upload file name */
38 
39 /*** For DB queries ***/
40 char *Pfile = NULL;
41 char *Pfile_Pk = NULL; /* PK for *Pfile */
42 char *Upload_Pk = NULL; /* PK for upload table */
43 PGconn *pgConn = NULL; /* PGconn from DB */
44 int agent_pk=-1; /* agent ID */
45 char SQL[MAXSQL];
46 char uploadtree_tablename[19]; /* upload.uploadtree_tablename */
47 magic_t MagicCookie = 0;
48 
49 unpackqueue Queue[MAXCHILD+1]; /* manage children */
50 int MaxThread=1; /* value between 1 and MAXCHILD */
51 int Thread=0;
52 
53 /*** Global Stats (for summaries) ***/
54 long TotalItems=0; /* number of records inserted */
55 int TotalFiles=0;
60 
61 /*** Command table ***/
63 {
64 /* 0 */ { "","","","","",CMD_NULL,0,0177000,0177000, },
65 /* 1 */ { "application/gzip","zcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
66 /* 2 */ { "application/x-gzip","zcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
67 /* 3 */ { "application/x-compress","zcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
68 /* 4 */ { "application/x-bzip","bzcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
69 /* 5 */ { "application/x-bzip2","bzcat","","> '%s' 2>/dev/null","",CMD_PACK,1,0177000,0177000, },
70 #if UPX_SUPPORT
71 /* 6 */ { "application/x-upx","upx","-d -o'%s'",">/dev/null 2>&1","",CMD_PACK,1,0177000,0177000, },
72 #endif
73 /* 7 */ { "application/pdf","pdftotext","-htmlmeta","'%s' >/dev/null 2>&1","",CMD_PACK,1,0100000,0100000, },
74 /* 8 */ { "application/x-pdf","pdftotext","-htmlmeta","'%s' >/dev/null 2>&1","",CMD_PACK,1,0100000,0100000, },
75 /* 9 */ { "application/x-zip","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
76 /* 10 */{ "application/zip","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
77 /* 11 */{ "application/x-tar","tar","-xSf","2>&1 ; echo ''","",CMD_ARC,1,0177000,0177777, },
78 /* 12 */{ "application/x-gtar","tar","-xSf","2>&1 ; echo ''","",CMD_ARC,1,0177000,0177777, },
79 /* 13 */{ "application/x-cpio","cpio","--no-absolute-filenames -i -d <",">/dev/null 2>&1","",CMD_ARC,1,0177777,0177777, },
80 /* 14 */{ "application/x-rar","unrar","x -o+ -p-",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
81 /* 15 */{ "application/x-cab","cabextract","",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
82 /* 16 */{ "application/x-7z-compressed","7z","x -y -pjunk",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
83 /* 17 */{ "application/x-7z-w-compressed","7z","x -y -pjunk",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
84 /* 18 */{ "application/x-rpm","rpm2cpio","","> '%s' 2> /dev/null","rpm -qip '%s' > '%s' 2>&1",CMD_RPM,1,0177000,0177000, },
85 /* 19 */{ "application/x-archive","ar","x",">/dev/null 2>&1","",CMD_AR,1,0177000,0177777, },
86 /* 20 */{ "application/x-debian-package","ar","x",">/dev/null 2>&1","dpkg -I '%s' > '%s'",CMD_AR,1,0177000,0177777, },
87 /* 21 */{ "application/x-iso","","","","isoinfo -d -i '%s' > '%s'",CMD_ISO,1,0177777,0177777, },
88 /* 22 */{ "application/x-iso9660-image","","","","isoinfo -d -i '%s' > '%s'",CMD_ISO,1,0177777,0177777, },
89 /* 23 */{ "application/x-fat","fat","","","",CMD_DISK,1,0177700,0177777, },
90 /* 24 */{ "application/x-ntfs","ntfs","","","",CMD_DISK,1,0177700,0177777, },
91 /* 25 */{ "application/x-ext2","linux-ext","","","",CMD_DISK,1,0177777,0177777, },
92 /* 26 */{ "application/x-ext3","linux-ext","","","",CMD_DISK,1,0177777,0177777, },
93 /* 27 */{ "application/x-x86_boot","departition","","> /dev/null 2>&1","",CMD_PARTITION,1,0177000,0177000, },
94 /* 28 */{ "application/x-debian-source","dpkg-source","-x","'%s' >/dev/null 2>&1","",CMD_DEB,1,0177000,0177000, },
95 /* 29 */{ "application/x-xz","tar","-JxSf",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177777, },
96 /* 30 */{ "application/jar","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
97 /* 31 */{ "application/java-archive","unzip","-q -P none -o","-x / >/dev/null 2>&1","unzip -Zhzv '%s' > '%s'",CMD_ARC,1,0177000,0177000, },
98 /* 32 */{ "application/x-dosexec","7z","x -y -pjunk",">/dev/null 2>&1","",CMD_ARC,1,0177000,0177000, },
99 /* 33 */{ "application/vnd.debian.binary-package","ar","x",">/dev/null 2>&1","dpkg -I '%s' > '%s'",CMD_AR,1,0177000,0177777, },
100 /* 34 */{ "application/zstd", "zstd", "-d", ">/dev/null 2>&1", "zstd -lv '%s' > '%s'", CMD_ZSTD, 1, 0177000, 0177000, },
101 /* 35 */{ "application/x-lz4", "zstd", "-d", ">/dev/null 2>&1", "", CMD_ZSTD, 1, 0177000, 0177000, },
102 /* 36 */{ "application/x-lzma", "zstd", "-d", ">/dev/null 2>&1", "", CMD_ZSTD, 1, 0177000, 0177000, },
103 /* 37 */{ "","","",">/dev/null 2>&1","",CMD_DEFAULT,1,0177000,0177000, },
104  { NULL,NULL,NULL,NULL,NULL,-1,-1,0177000,0177000, },
105 };
106 #endif
int agent_pk
Definition: agent.h:74
char BuildVersion[]
Definition: buckets.c:68
Command table's single row.
Definition: ununpack.h:143
Queue for files to be unpacked.
Definition: ununpack.h:89
int SetContainerArtifact
Should initial container be an artifact?
char * Pfile_Pk
Pfile pk in DB.
int ReunpackSwitch
Set if the uploadtree records are missing from db.
int UseRepository
Using files from the repository?
char uploadtree_tablename[19]
upload.uploadtree_tablename
int MaxThread
Value between 1 and MAXCHILD.
int UnlinkSource
Remove recursive sources after unpacking?
char * Pfile
Pfile name (SHA1.MD5.Size)
int TotalDirectories
Number of directories.
unpackqueue Queue[MAXCHILD+1]
Manage children.
int Quiet
Run in quiet mode?
int Thread
Number of threads in execution.
int TotalFiles
Number of regular files.
int TotalArtifacts
Number of artifacts.
PGconn * pgConn
Database connection.
cmdlist CMD[]
Global command table.
int PruneFiles
Remove links? >1 hard links, zero files, etc.
char SQL[MAXSQL]
For DB.
int TotalContainers
Number of containers.
char UploadFileName[FILENAME_MAX]
Upload file name.
magic_t MagicCookie
for Magic
int Verbose
Verbose level for log.
char * Upload_Pk
Upload pk in DB.
int UnlinkAll
Remove ALL unpacked files when done (clean up)?
char REP_FILES[16]
Files repository name.
FILE * ListOutFile
File to store unpack list.
char REP_GOLD[16]
Gold repository name.
long TotalItems
Number of records inserted.
int IgnoreSCMData
1: Ignore SCM data, 0: dont ignore it.
int TotalCompressedFiles
Number of compressed files.
int ForceDuplicate
When using db, should it process duplicates?
int ForceContinue
Force continue when unpack tool fails?