From a9ceeadfd844c8d2a2ba03e17385f509bb0119d2 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Tue, 21 Apr 2026 11:52:29 +0600 Subject: [PATCH] Fixed --autoinstall parameter --- source/ubinstall-gtk-install-start.c | 36 ++++++++++++++++++++++++++++ source/ubinstall-gtk-page-switch.c | 1 + source/ubinstall-gtk.c | 9 +++++-- source/ubinstall-gtk.h | 5 +++- 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/source/ubinstall-gtk-install-start.c b/source/ubinstall-gtk-install-start.c index c79400f..7f62106 100644 --- a/source/ubinstall-gtk-install-start.c +++ b/source/ubinstall-gtk-install-start.c @@ -42,4 +42,40 @@ void *on_quick_install_start(void *data){ yon_launch("ubconfig --source system get /"); } return 0; +} + +void on_autoinstall_start(GtkWidget *, main_window *widgets){ + main_config.save_configured=1; + gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); + pthread_create(&main_config.install_thread,NULL,on_auto_install_start,widgets); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); + yon_page_init(widgets,YON_PAGE_INSTALLATION); + yon_page_update(widgets); + +} +void *on_auto_install_start(void *data){ + main_window *widgets = (main_window*)data; + + g_idle_add((GSourceFunc)yon_progress_bar_start,widgets); + if (!main_config.dry_run){ + char *command = yon_debug_output("%s\n",auto_install_command(main_config.config_load_path)); + yon_debug_output("%s\n","Entered installation"); + if (system(yon_debug_output("%s\n",command))){ + + gdk_threads_add_idle((GSourceFunc)on_install_error,widgets); + free(command); + g_mutex_lock(&main_config.install_mutex); + main_config.install_complete=1; + g_mutex_unlock(&main_config.install_mutex); + return 0; + }; + free(command); + g_mutex_lock(&main_config.install_mutex); + main_config.install_complete=1; + g_mutex_unlock(&main_config.install_mutex); + g_idle_add((GSourceFunc)on_install_success,widgets); + } else { + yon_launch("ubconfig --source system get /"); + } + return 0; } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 5d27784..c810f37 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -656,6 +656,7 @@ void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ pthread_cancel(main_config.install_thread); kill(main_config.install_thread,SIGKILL); + if (main_config.autoinstall) exit(0); g_signal_handlers_disconnect_by_func(G_OBJECT(widgets->install_info_monitor),yon_installation_progress_update,widgets); g_file_monitor_cancel(widgets->install_info_monitor); widgets->install_info_monitor = NULL; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 61d9db7..957b9a2 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -936,6 +936,7 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(yon_on_about),NULL); g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK); } + yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserRootPasswordEntry)); yon_window_config_setup(GTK_WINDOW(widgets->MainWindow)); @@ -1030,6 +1031,10 @@ void yon_main_window_create(main_window *widgets){ gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),(GtkTreeModelFilterVisibleFunc)on_country_filter,widgets,NULL); + if (main_config.autoinstall){ + on_autoinstall_start(NULL,widgets); + } + gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(widgets->LanguagesTree),(GtkTreeViewSearchEqualFunc)on_languages_search_func,widgets,NULL); gtk_overlay_add_overlay(GTK_OVERLAY(widgets->RegionMapOverlay),widgets->TimeZoneMapOverlayBox); gtk_overlay_set_overlay_pass_through(GTK_OVERLAY(widgets->RegionMapOverlay),widgets->TimeZoneMapOverlayBox,1); @@ -1119,13 +1124,13 @@ int main(int argc, char *argv[]){ int option_index = 0; struct option long_options[] = { {"dry-run", 0, 0, 'D'}, - {"scenario", 0, 0, 's'}, + // {"scenario", 0, 0, 's'}, {"autoinstall", 0, 0, 'A'}, {NULL, 0, NULL, 0} }; optind = 1; for (int i = 0; i < size; i++) { - int argument = getopt_long(argc, argv, "D", long_options, &option_index); + int argument = getopt_long(argc, argv, "DA", long_options, &option_index); switch (argument) { case 'D': main_config.dry_run = 1; diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 509e1bd..4b0400c 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -298,6 +298,7 @@ layout && /description:/ {\ #define save_config_command yon_char_unite("/usr/bin/bash -c \"nice ubinstall autoinstall",main_config.debug_mode?" --debug":"","\"", NULL) #define quick_install_command(path) yon_char_unite("nice ubinstall autoinstall",main_config.debug_mode?" --debug":""," --config='",path,"' --noautoconfig --noinstall_extra", NULL) +#define auto_install_command(path) yon_char_unite("nice ubinstall autoinstall",main_config.debug_mode?" --debug":""," --config='",path,"' --autoinstall", NULL) #define set_user_config_command yon_char_unite("nice ubinstall autoconfig",main_config.debug_mode?" --debug":""," install_extra", NULL) #define save_additional_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] ", parameters, NULL) @@ -1643,4 +1644,6 @@ void *yon_status_thread_update(main_window *widgets); void yon_db_lock_update(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,main_window *widgets); void yon_db_unlock_update(GFileMonitor *,GFile *,GFile *,GFileMonitorEvent ,main_window *widgets); void on_config_install_success(GtkWidget *self, int state, main_window *widgets); -void *on_quick_install_start(void *data); \ No newline at end of file +void *on_quick_install_start(void *data); +void on_autoinstall_start(GtkWidget *self, main_window *widgets); +void *on_auto_install_start(void *data); \ No newline at end of file