From c41d059c5175d6bc21036b0a41c11a333f5cd4a9 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Fri, 17 Apr 2026 12:43:40 +0600 Subject: [PATCH] Test fix for quick installation --- source/ubinstall-gtk-configuration-mode.c | 6 ++- source/ubinstall-gtk-install-start.c | 51 +++++++++++++++-------- source/ubinstall-gtk.h | 7 ++-- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/source/ubinstall-gtk-configuration-mode.c b/source/ubinstall-gtk-configuration-mode.c index 67a2571..3aecbbe 100644 --- a/source/ubinstall-gtk-configuration-mode.c +++ b/source/ubinstall-gtk-configuration-mode.c @@ -68,7 +68,11 @@ void on_path_choose(GtkWidget *,configuration_window *window){ filechooser_window *dialog = yon_config_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SAVE); yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window),CONFIGURATION_MODE_TITLE_LABEL,icon_path,"filechooser_window"); if (yon_file_chooser_start(dialog)==GTK_RESPONSE_APPLY){ - gtk_entry_set_text(GTK_ENTRY(window->PathEntry),dialog->last_success_selection); + char *path = dialog->last_success_selection; + if (!strstr(dialog->last_success_selection,".")){ + path = yon_char_append(dialog->last_any_selection,".ini"); + } + gtk_entry_set_text(GTK_ENTRY(window->PathEntry),path); free(dialog); } } diff --git a/source/ubinstall-gtk-install-start.c b/source/ubinstall-gtk-install-start.c index 9a29405..c79400f 100644 --- a/source/ubinstall-gtk-install-start.c +++ b/source/ubinstall-gtk-install-start.c @@ -8,21 +8,38 @@ int yon_installation_start(main_window *widgets){ void yon_quick_install(GtkWidget *self, main_window *widgets){ if (!yon_installation_check_packages_size(widgets)) return; - if (!main_config.dry_run){ - main_config.save_configured=1; - gtk_widget_hide(self); - gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); - pthread_create(&main_config.install_thread,NULL,on_config_save,widgets); - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); - if (!yon_char_is_empty(main_config.config_load_path)){ - char *command = quick_install_command(main_config.config_load_path); - yon_launch_app_with_arguments(command,NULL); - } - yon_page_init(widgets,YON_PAGE_INSTALLATION); - yon_page_update(widgets); - - } else { - yon_launch("ubconfig --source system get /"); - yon_launch(ubinstall_dry_run_command); - } + main_config.save_configured=1; + gtk_widget_hide(self); + gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); + pthread_create(&main_config.install_thread,NULL,on_quick_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_quick_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",quick_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.h b/source/ubinstall-gtk.h index e817c7d..509e1bd 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -157,7 +157,7 @@ layout && /description:/ {\ #define yon_check_database_command "pacman -Syy >/dev/null" #define internet_tomezone_check_command "curl -s ipinfo.io/timezone" -#define ubinstall_dry_run_command "/usr/bin/bash -c \"ubinstall --dry-run" +#define ubinstall_dry_run_command "/usr/bin/bash -c \"ubinstall --dry-run\"" #define os_name_get_command "sed -En 's/^PRETTY_NAME=[\"]*([^\"]+)[\"]*/\\1/p' /etc/os-release" #define get_keyboard_layout_change_command "grep \"grp:\" /usr/share/X11/xkb/rules/base.lst | awk '{$1=$1; sub(/^!.*$/, \"\"); if ($1 ~ /^grp:/) {opt=$1; $1=\"\"; print opt \"|\" substr($0,2)}}'" @@ -296,7 +296,7 @@ layout && /description:/ {\ #define get_localisation_command "ubconfig -ea --source global get [autoinstall] AUTOINSTALL[installer_locale] -- get [autoinstall] AUTOINSTALL['ubconfig set [locale] LANG'] -- get [locale] LANG" -#define save_config_command yon_char_unite("/usr/bin/bash -c \"nice ubinstall autoinstall",main_config.debug_mode?" --debug":""," --noautoconfig --noinstall_extra\"", NULL) +#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 set_user_config_command yon_char_unite("nice ubinstall autoconfig",main_config.debug_mode?" --debug":""," install_extra", NULL) @@ -1642,4 +1642,5 @@ void yon_status_thread_update_active(main_window *widgets); 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); \ No newline at end of file +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