mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-01-26 11:39:44 +00:00
Prelim: Crusty but functional test of calling into apt from setup
This commit is contained in:
@@ -20,6 +20,7 @@ include(../../../packaging/cmake-inc/linking/CMakeLists.txt)
|
||||
include(../../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
include(../../../packaging/cmake-inc/resources/CMakeLists.txt)
|
||||
|
||||
wintc_resolve_library(gio-unix-2.0 GIO_UNIX)
|
||||
wintc_resolve_library(glib-2.0 GLIB)
|
||||
wintc_resolve_library(gtk+-3.0 GTK3)
|
||||
wintc_resolve_library(wintc-comctl WINTC_COMCTL)
|
||||
@@ -63,6 +64,7 @@ target_include_directories(
|
||||
wintc-setup-gui
|
||||
SYSTEM
|
||||
BEFORE
|
||||
PRIVATE ${GIO_UNIX_INCLUDE_DIRS}
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMCTL_INCLUDE_DIRS}
|
||||
@@ -76,6 +78,7 @@ target_include_directories(
|
||||
|
||||
target_link_directories(
|
||||
wintc-setup-gui
|
||||
PRIVATE ${GIO_UNIX_LIBRARY_DIRS}
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMCTL_LIBRARY_DIRS}
|
||||
@@ -89,6 +92,7 @@ target_link_directories(
|
||||
|
||||
target_link_libraries(
|
||||
wintc-setup-gui
|
||||
PRIVATE ${GIO_UNIX_LIBRARIES}
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMCTL_LIBRARIES}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <glib.h>
|
||||
#include <gio/gunixinputstream.h>
|
||||
#include <wintc/comgtk.h>
|
||||
|
||||
#include "netwiz.h"
|
||||
@@ -52,6 +53,9 @@ static void wintc_setup_controller_go_to_phase(
|
||||
WinTCSetupController* setup,
|
||||
guint phase
|
||||
);
|
||||
static void wintc_setup_controller_test_install_gedit(
|
||||
WinTCSetupController* setup
|
||||
);
|
||||
|
||||
static void on_netwiz_destroyed(
|
||||
GtkWidget* widget,
|
||||
@@ -348,6 +352,8 @@ static void wintc_setup_controller_go_to_phase(
|
||||
|
||||
case PHASE_COPY_FILES:
|
||||
{
|
||||
wintc_setup_controller_test_install_gedit(setup);
|
||||
|
||||
//
|
||||
// FIXME: Implement this later...
|
||||
//
|
||||
@@ -370,6 +376,62 @@ static void wintc_setup_controller_go_to_phase(
|
||||
}
|
||||
}
|
||||
|
||||
static void wintc_setup_controller_test_install_gedit(
|
||||
WINTC_UNUSED(WinTCSetupController* setup)
|
||||
)
|
||||
{
|
||||
gchar* argv[] = {
|
||||
"/usr/bin/apt-get",
|
||||
"install",
|
||||
"-y",
|
||||
"-o",
|
||||
"APT::Status-Fd=1",
|
||||
"gedit"
|
||||
};
|
||||
|
||||
GError* error = NULL;
|
||||
gint fd_out = -1;
|
||||
|
||||
if (
|
||||
!g_spawn_async_with_pipes(
|
||||
NULL,
|
||||
argv,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&fd_out,
|
||||
NULL,
|
||||
&error
|
||||
)
|
||||
)
|
||||
{
|
||||
wintc_log_error_and_clear(&error);
|
||||
return;
|
||||
}
|
||||
|
||||
// TESTING READING STDOUT
|
||||
//
|
||||
GInputStream* fd_stream = g_unix_input_stream_new(fd_out, FALSE);
|
||||
GDataInputStream* stream = g_data_input_stream_new(fd_stream);
|
||||
|
||||
gchar* line;
|
||||
|
||||
while ((line = g_data_input_stream_read_line(stream, NULL, NULL, &error)))
|
||||
{
|
||||
g_message("FROM APT: %s", line);
|
||||
g_free(line);
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
wintc_log_error_and_clear(&error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CALLBACKS
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user