From f59f260ea2247a222827385ffafe73f87c9d6625 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 2 Aug 2024 14:17:09 +0600 Subject: [PATCH 1/3] Save fix --- source/ubinstall-gtk.c | 35 ++++++++++++++++++++++++++++++++++- source/ubinstall-gtk.h | 1 + ubinstall-gtk.glade | 2 -- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 23a699e..3730671 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -1138,6 +1138,36 @@ void on_log_closed(GtkWidget *, log_window *window){ window->Window=NULL; } +void *on_save_system_configuration(void *data); +void *on_save_system_configuration(void * data){ + main_window *widgets = (main_window*)data; + if (widgets){}; + int size; + config_str all_parameters = yon_config_get_selection_by_key(&size, + user_gecos_parameter, + user_password_parameter, + root_password_parameter, + autologin_parameter, + xkbmodel_parameter, + xkblayout_parameter, + xkbvariant_parameter, + xkboptions_parameter, + hostname_parameter, + zone_parameter, + lang_parameter, + locale_parameter, + NULL); + if (all_parameters){ + char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); + char *command = save_additional_config_command(parameter_string); + if (system(yon_debug_output("%s\n",command))){}; + yon_char_parsed_free(all_parameters,size); + free(command); + if (parameter_string) free(parameter_string); + } + return NULL; +} + log_window *yon_log_window_new(); log_window *yon_log_window_new(){ log_window *window = malloc(sizeof(log_window)); @@ -1498,7 +1528,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username); } - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck))){ + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ yon_config_remove_by_key(user_name_parameter); } else { char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)); @@ -1605,6 +1635,9 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ if (gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress))>0.9){ pthread_t tid; pthread_create(&tid,NULL,on_setup_system_configuration,widgets); + } else { + pthread_t tid; + pthread_create(&tid,NULL,on_save_system_configuration,widgets); } main_config.save_done=1; yon_debug_output("Save changed to: %s\n",yon_char_from_int(main_config.save_done)); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index cade5bc..d2e9852 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -116,6 +116,7 @@ NULL #define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall'", NULL) #define set_user_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters,";nice ubinstall2 autoconfig'",NULL) +#define save_additional_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters,"'",NULL) #define open_gparted_command "gparted" diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index f520ce8..258e697 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -2490,7 +2490,6 @@ and help you install UBLinux on your computer True False True - False @@ -3718,7 +3717,6 @@ installed. True False True - False From 98bda4e4077e9d75030497e15b3d7b23aaee158e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 2 Aug 2024 17:25:00 +0600 Subject: [PATCH 2/3] added debug messages --- source/ubinstall-gtk.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 3730671..590b3ac 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -577,7 +577,7 @@ void on_config_custom_save(GtkWidget *, main_window *widgets){ if (!strstr(file,".ini")) file = yon_char_append(file,".ini"); if (access(file,0)!=F_OK){ char *command_creation = ubconfig_file_create(file); - int a = system(command_creation); + int a = system(yon_debug_output("%s\n",command_creation)); if (access(file,0)!=F_OK||a){ yon_ubl_status_box_render(CUSTOM_CONFIG_CREATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); return; @@ -921,7 +921,7 @@ void *on_config_save(void *data){ fclose(file); char *command = save_config_command(yon_char_parsed_to_string(parameters,size," ")); yon_char_parsed_free(parameters,size); - if (system(command)){ + if (system(yon_debug_output("%s\n",command))){ gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR); }; free(command); @@ -955,7 +955,7 @@ gboolean yon_installation_progress_update(void *data) { char *percentage = yon_char_divide_search(current_copy, ")", -1); yon_char_parsed_free(text, size); - if (strcmp(percentage, "#pb")) { + if (!strstr(percentage, "#pb")) { double fraction = atof(percentage); gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel), current_copy); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), fraction / 100); @@ -1124,7 +1124,7 @@ void *on_setup_system_configuration(void * data){ if (all_parameters){ char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); char *command = set_user_config_command(parameter_string); - if (system(command)){}; + if (system(yon_debug_output("$s\n",command))){}; yon_char_parsed_free(all_parameters,size); free(command); if (parameter_string) free(parameter_string); @@ -2354,7 +2354,6 @@ main_window *yon_main_window_complete(){ if (layout_size){ char *layout_id = yon_char_new(layout[0]); gtk_tree_store_append(widgets->LayoutList,&iter,NULL); - yon_debug_output("%s\n",parsed[i]); gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,1,-1); yon_char_parsed_free(layout,layout_size); layout = yon_config_load(get_layouts_local_command(layout_id),&layout_size); From 28d2e6d1f6933a9d182788aea017efa376fabfc6 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 2 Aug 2024 18:03:38 +0600 Subject: [PATCH 3/3] Fixed unsaving user_name parameter --- source/ubinstall-gtk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 590b3ac..1540b16 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -1108,6 +1108,7 @@ void *on_setup_system_configuration(void * data){ if (widgets){}; int size; config_str all_parameters = yon_config_get_selection_by_key(&size, + user_name_parameter, user_gecos_parameter, user_password_parameter, root_password_parameter, @@ -1144,6 +1145,7 @@ void *on_save_system_configuration(void * data){ if (widgets){}; int size; config_str all_parameters = yon_config_get_selection_by_key(&size, + user_name_parameter, user_gecos_parameter, user_password_parameter, root_password_parameter,