56
53
archive->column_types[i] = types[i];
58
55
xa_create_liststore (archive,names);
59
if (fseek ( stream, 104 , SEEK_CUR ) )
62
response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't fseek to position 104:"),g_strerror(errno));
65
if ( fread ( bytes, 1, 8, stream ) == 0 )
68
response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't read data from file:"),g_strerror(errno));
71
il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
72
dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
73
sigsize = 8 + 16 * il + dl;
74
offset = 104 + sigsize + ( 8 - ( sigsize % 8 ) ) % 8 + 8;
75
if (fseek ( stream, offset , SEEK_SET ) )
78
response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't fseek in file:"),g_strerror(errno));
81
if ( fread ( bytes, 1, 8, stream ) == 0 )
84
response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't read data from file:"),g_strerror(errno));
87
il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
88
dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
89
sigsize = 8 + 16 * il + dl;
90
offset = offset + sigsize;
93
57
/* Create a unique temp dir in /tmp */
94
58
result = xa_create_temp_directory (archive);
98
gzip_tmp = g_strconcat (archive->tmp,"/file.gz_bz",NULL);
99
ibs = g_strdup_printf ( "%u" , offset );
101
62
/* Now I run dd to have the bzip2 / gzip compressed cpio archive in /tmp */
102
gchar *command = g_strconcat ( "dd if=",archive->escaped_path," ibs=",ibs," skip=1 of=",gzip_tmp,NULL);
104
list = g_slist_append(list,command);
106
result = xa_run_command (archive,list);
112
if (xa_detect_archive_type (gzip_tmp) == XARCHIVETYPE_GZIP)
113
executable = "gzip -dc ";
115
executable = "bzip2 -dc ";
117
command = g_strconcat("sh -c \"",executable,gzip_tmp," > ",archive->tmp,"/file.cpio\"",NULL);
63
gchar *command = g_strconcat ( "sh -c \"rpm2cpio ",archive->escaped_path," > ",archive->tmp, "/file.cpio\"",NULL);
120
65
list = g_slist_append(list,command);
121
66
result = xa_run_command (archive,list);