From: <ale...@us...> - 2003-10-26 23:02:04
|
Update of /cvsroot/morphix/morphixinstaller/src In directory sc8-pr-cvs1:/tmp/cvs-serv26116/src Modified Files: callbacks.c cmdline.c installer.h instlib.c interface.c Log Message: added Mantas's changes, see Changelog for details Index: callbacks.c =================================================================== RCS file: /cvsroot/morphix/morphixinstaller/src/callbacks.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** callbacks.c 24 Sep 2003 23:23:03 -0000 1.13 --- callbacks.c 26 Oct 2003 22:56:18 -0000 1.14 *************** *** 255,259 **** } // done with install, join our threads and continue with ! // the configuration process g_thread_join(thread); timeout = 1; --- 255,262 ---- } // done with install, join our threads and continue with ! // the configuration process or inform user about failing install ! // TODO: ! // if there are 0 free space now installing cannot continue ! g_thread_join(thread); timeout = 1; *************** *** 403,408 **** SetUpHomeDir((gchar *)gtk_entry_get_text(GTK_ENTRY(entry_user)),(gchar *)gtk_entry_get_text(GTK_ENTRY(entry1))); ! ! UseXsessionBoot((gchar *)gtk_entry_get_text(GTK_ENTRY(entry_user))); CopyKernel(); --- 406,411 ---- SetUpHomeDir((gchar *)gtk_entry_get_text(GTK_ENTRY(entry_user)),(gchar *)gtk_entry_get_text(GTK_ENTRY(entry1))); ! // This should be optional and should be realized in postinstall.sh, not in installers binary ! // UseXsessionBoot((gchar *)gtk_entry_get_text(GTK_ENTRY(entry_user))); CopyKernel(); *************** *** 740,745 **** gpointer user_data) { SelectPartExpert = create_SelectPartExpert (); ! gtk_widget_show (SelectPartExpert); GtkWidget *expert_selected_wid[MAX_EXPERT_MOUNTS]; --- 743,750 ---- gpointer user_data) { + // should create only first time when user press expert partitioning + if (SelectPartExpert == NULL) { SelectPartExpert = create_SelectPartExpert (); ! GtkWidget *expert_selected_wid[MAX_EXPERT_MOUNTS]; *************** *** 752,759 **** for (j = 0; j < MAX_EXPERT_MOUNTS; j++) { ! gtk_combo_set_popdown_strings(GTK_COMBO(expert_selected_wid[j]),items); } } void on_cancelButtonExpert_clicked (GtkButton *button, --- 757,767 ---- for (j = 0; j < MAX_EXPERT_MOUNTS; j++) { ! gtk_combo_set_popdown_strings(GTK_COMBO(expert_selected_wid[j]),items); } + } + gtk_widget_show (SelectPartExpert); } + // TODO: cancel doesn't work as expect - from users view cancel is same like ok void on_cancelButtonExpert_clicked (GtkButton *button, Index: cmdline.c =================================================================== RCS file: /cvsroot/morphix/morphixinstaller/src/cmdline.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cmdline.c 22 Aug 2003 22:25:23 -0000 1.1 --- cmdline.c 26 Oct 2003 22:56:18 -0000 1.2 *************** *** 427,431 **** } SetUpHomeDir(cmdlineargs.username,cmdlineargs.userpass); ! UseXsessionBoot(cmdlineargs.username); /* lilo section */ --- 427,432 ---- } SetUpHomeDir(cmdlineargs.username,cmdlineargs.userpass); ! //UseXsessionBoot should be optional and realized in postinstall.sh, not in installers binar ! // UseXsessionBoot(cmdlineargs.username); /* lilo section */ Index: installer.h =================================================================== RCS file: /cvsroot/morphix/morphixinstaller/src/installer.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** installer.h 22 Aug 2003 22:25:23 -0000 1.6 --- installer.h 26 Oct 2003 22:56:18 -0000 1.7 *************** *** 25,30 **** #define TEMPLATE_FILENAME "knx-templates-0.37.tgz" #define ROOT_MOUNTPOINT "/mnt/target" ! #define LOOP_MOUNTPOINT_1 "/mnt/l1" ! #define LOOP_MOUNTPOINT_2 "/mnt/l2" #define TEMPLATE_DIR "/tmp/templates" --- 25,30 ---- #define TEMPLATE_FILENAME "knx-templates-0.37.tgz" #define ROOT_MOUNTPOINT "/mnt/target" ! #define LOOP_MOUNTPOINT_1 "/tmp/l1" ! #define LOOP_MOUNTPOINT_2 "/tmp/l2" #define TEMPLATE_DIR "/tmp/templates" Index: instlib.c =================================================================== RCS file: /cvsroot/morphix/morphixinstaller/src/instlib.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** instlib.c 7 Oct 2003 14:11:30 -0000 1.8 --- instlib.c 26 Oct 2003 22:56:18 -0000 1.9 *************** *** 108,111 **** --- 108,113 ---- sprintf(cmdline,"xterm -fn 10x20 -e cfdisk /dev/%s",harddisk); + // TODO: Here should be check if in system exist QTParted or other GUI partitioner + // sprintf(cmdline,"/usr/sbin/qtparted /dev/%s",harddisk); debug("Exec: %s\n",cmdline); g_spawn_command_line_sync(cmdline,&outbuffer,NULL,&exit_status,NULL); *************** *** 158,216 **** } ! gpointer MakeRoot(gpointer data) { gchar cmdline[256]; ! gint i; ! ! /* choose the fs, space for specific commands here */ switch (selected_fs_nr) { case (0): case (1): ! sprintf(cmdline,"mkfs.%s %s",selected_fs,selected_rootpart); break; case (2): ! sprintf(cmdline,"mkfs.%s -f -f %s",selected_fs,selected_rootpart); break; case (3): ! sprintf(cmdline,"mkfs.%s -f %s",selected_fs,selected_rootpart); break; default: ! sprintf(cmdline,"mkfs.%s %s",selected_fs,selected_rootpart); break; } ExecuteCommand(cmdline); ! root_done = TRUE; ! // for each partition selected, make a new filesystem on it ! // the type of filesystem is the same as the root filesystem, ! // as most people shouldn't need any weird different partitiontypes ! if (expert_part == TRUE) { ! for (i = 0; i < MAX_EXPERT_MOUNTS; i++) { ! if (strcmp(expert_selected_parts[i],"none") == 0 || ! strcmp(expert_selected_parts[i],"") == 0) { ! continue; ! } ! if (expert_new_filesystem[i] == TRUE) { ! switch (selected_fs_nr) { ! case (0): ! case (1): ! sprintf(cmdline,"mkfs.%s %s",selected_fs,expert_selected_parts[i]); ! break; ! case (2): ! sprintf(cmdline,"mkfs.%s -f -f %s",selected_fs,expert_selected_parts[i]); ! break; ! case (3): ! sprintf(cmdline,"mkfs.%s -f %s",selected_fs,expert_selected_parts[i]); ! break; ! default: ! sprintf(cmdline,"mkfs.%s %s",selected_fs,expert_selected_parts[i]); ! break; ! } ! ExecuteCommand(cmdline); ! } ! } } ! ! debug("Root partition generated\n"); } --- 160,237 ---- } ! /* choose the fs, space for specific commands here */ ! gboolean MakeFS (gchar *selected_fs, gchar *selected_part) { gchar cmdline[256]; ! switch (selected_fs_nr) { case (0): case (1): ! sprintf(cmdline,"mkfs.%s %s",selected_fs,selected_part); break; case (2): ! //mkfs.reiserfs --help: -q | --quiet quiet work without messages, progress and ! // questions. Useful if run in a script. For use by end users only. ! sprintf(cmdline,"mkfs.%s -f -f -q %s",selected_fs,selected_part); break; case (3): ! sprintf(cmdline,"mkfs.%s -f %s",selected_fs,selected_part); break; default: ! sprintf(cmdline,"mkfs.%s %s",selected_fs,selected_part); break; } ExecuteCommand(cmdline); ! } ! gpointer MakeRoot(gpointer data) { ! ! gchar cmdline[256]; ! gint i; ! ! /* umount the partitions for sure and check for duplicating */ ! // somewhere should be check is target directory empty or not ! /* another partition can be leaved mounted ex. during previous install */ ! if (expert_part == TRUE) { ! for (i = 0; i < MAX_EXPERT_MOUNTS; i++) { ! if (strcmp(expert_selected_parts[i],"") != 0 && ! strcmp(expert_selected_parts[i],"none") != 0) { ! // Not sure about && expert_fstab_only[i] != TRUE) ! if (strcmp(selected_rootpart,expert_selected_parts[i]) != 0){ ! sprintf(cmdline,"umount %s",expert_selected_parts[i]); ! ExecuteCommand(cmdline); ! } ! else{ ! debug("root partition can't be mounted somewhere else!!!\n"); ! root_done = FALSE; ! return; ! } ! } } ! } ! sprintf(cmdline,"umount %s",selected_rootpart); ! ExecuteCommand(cmdline); ! ! sprintf(cmdline,"umount %s",ROOT_MOUNTPOINT); ! ExecuteCommand(cmdline); ! ! MakeFS (selected_fs,selected_rootpart); ! root_done = TRUE; ! ! // for each partition selected, make a new filesystem on it ! // the type of filesystem is the same as the root filesystem, ! // as most people shouldn't need any weird different partitiontypes ! if (expert_part == TRUE) { ! for (i = 0; i < MAX_EXPERT_MOUNTS; i++) { ! if (strcmp(expert_selected_parts[i],"none") != 0 && ! strcmp(expert_selected_parts[i],"") != 0 && ! expert_new_filesystem[i] == TRUE) { ! ! MakeFS (selected_fs,expert_selected_parts[i]); ! } ! } ! } ! ! debug("Root partition generated\n"); } *************** *** 235,255 **** /* mount extra partitions, if these have been selected... */ if (expert_part == TRUE) { ! for (i = 0; i < MAX_EXPERT_MOUNTS; i++) { ! if (strcmp(expert_selected_parts[i],"none") == 0 || ! strcmp(expert_selected_parts[i],"") == 0) { ! continue; ! } ! if (expert_fstab_only[i] != TRUE) { ! sprintf(cmdline,"%s%s", ! ROOT_MOUNTPOINT,expert_selected_mounts[i]); ! if (mkdir(cmdline,0755) == -1) { ! debug("Error creating directory %s\n",cmdline); ! continue; ! } ! sprintf(cmdline,"mount %s %s%s",expert_selected_parts[i], ! ROOT_MOUNTPOINT,expert_selected_mounts[i]); ! ExecuteCommand(cmdline); ! } } } if (cpio_passthrough == TRUE) { --- 256,280 ---- /* mount extra partitions, if these have been selected... */ if (expert_part == TRUE) { ! for (i = 0; i < MAX_EXPERT_MOUNTS; i++) { ! if (strcmp(expert_selected_parts[i],"") != 0 && ! strcmp(expert_selected_parts[i],"none") != 0 && ! expert_fstab_only[i] != TRUE) { ! ! sprintf(cmdline,"%s%s", ! ROOT_MOUNTPOINT,expert_selected_mounts[i]); ! //continue operator is not recommended to use in "for" cycle ! if (mkdir(cmdline,0755) == -1) { ! debug("Error creating directory %s\n",cmdline); ! continue; ! } ! // type of newly created filesystem is selected_fs ! if (expert_new_filesystem[i] != TRUE) ! sprintf(cmdline,"mount %s %s%s",expert_selected_parts[i], ! ROOT_MOUNTPOINT,expert_selected_mounts[i]); ! else sprintf(cmdline,"mount -t %s %s %s%s",selected_fs,expert_selected_parts[i], ! ROOT_MOUNTPOINT,expert_selected_mounts[i]); ! ExecuteCommand(cmdline); } + } } if (cpio_passthrough == TRUE) { *************** *** 374,379 **** } ! debug("proc /proc proc defaults 0 0\n/dev/fd0 /floppy vfat defaults,user,noauto,showexec,umask=022 0 0\n/dev/cdrom /cdrom iso9660 defaults,ro,user,noexec,noauto 0 0\n"); ! fprintf(file,"proc /proc proc defaults 0 0\n/dev/fd0 /mnt/auto/floppy auto defaults,user,noauto,showexec,umask=022 0 0\n/dev/cdrom /mnt/auto/cdrom auto defaults,ro,user,noexec,noauto 0 0\n"); // add any entries in regular fstab that have been added my morphix-base --- 399,405 ---- } ! // TODO: I think is bad solution to hardcode /etc/fstab into installer. I think parts of live-CD fstab should be used instead ! debug("proc /proc proc defaults 0 0\n/dev/fd0 /floppy vfat defaults,user,noauto,showexec,umask=022 0 0\n/cdrom /cdrom supermount auto,users,ro,fs=auto,dev=/dev/cdrom 0 0\n"); ! fprintf(file,"proc /proc proc defaults 0 0\n/floppy /floppy supermount auto,users,fs=vfat,dev=/dev/fd0 0 0\n/cdrom /cdrom supermount auto,users,ro,fs=auto,dev=/dev/cdrom 0 0\n"); // add any entries in regular fstab that have been added my morphix-base *************** *** 411,415 **** fclose(file); ! sprintf(cmdline,"cp -af /morphix/init.sh %s/etc/init.d/xsession",ROOT_MOUNTPOINT); ExecuteCommand(cmdline); --- 437,444 ---- fclose(file); ! // this is really not installers job, for example Gnome module doesn't need this ! // at all, if there are modules, that needs this then do this in postinst.sh ! ! /* sprintf(cmdline,"cp -af /morphix/init.sh %s/etc/init.d/xsession",ROOT_MOUNTPOINT); ExecuteCommand(cmdline); *************** *** 419,422 **** --- 448,452 ---- sprintf(cmdline,"chmod a+rx %s/etc/init.d/xsession",ROOT_MOUNTPOINT); ExecuteCommand(cmdline); + */ /* umount extra partitions, if these have been selected... */ *************** *** 672,712 **** /* This looks ugly, but it works... sortof :o)*/ void SetUpHomeDir(gchar *username, gchar *password) { ! gchar cmdline[256]; ! if (strncmp(username,"morph",6) != 0) { ! // move the morph dir to the new username's ! sprintf(cmdline,"chroot %s sh -c 'mv /home/morph /home/%s'",ROOT_MOUNTPOINT,username); ! ExecuteCommand(cmdline); ! ! // remove the morph user ! sprintf(cmdline,"chroot %s sh -c 'deluser morph'",ROOT_MOUNTPOINT); ! ExecuteCommand(cmdline); ! // add the new group ! sprintf(cmdline,"chroot %s sh -c 'groupadd %s'",ROOT_MOUNTPOINT,username); ! ExecuteCommand(cmdline); ! // add the new user ! sprintf(cmdline,"chroot %s sh -c 'useradd -s /bin/bash -d /home/%s -c \"Morphix User\" -g %s -G audio,video,users -p '%s' %s'",ROOT_MOUNTPOINT,username,username,crypt(password),username); ! ExecuteCommand(cmdline); ! // Add the new user to /etc/sudoers - Even though the file may be deleted later on ! ! sprintf(cmdline,"chroot %s sh -c 'echo %s ALL:=NOPASSWD:ALL\n >> /etc/sudoers'",ROOT_MOUNTPOINT,username); ! ExecuteCommand(cmdline); ! // make sure the user's files have the right permissions ! sprintf(cmdline,"chroot %s sh -c 'chown -R %s.%s /home/%s'",ROOT_MOUNTPOINT,username,username,username); ! ExecuteCommand(cmdline); ! ! } ! else { ! // change the morph-user's password ! sprintf(cmdline,"chroot %s sh -c \"echo \\\"morph:%s\\\" | chpasswd\"",ROOT_MOUNTPOINT,password); ! ExecuteCommand(cmdline); ! } } void UseXsessionBoot(gchar *username) { gchar *input_buf; --- 702,755 ---- /* This looks ugly, but it works... sortof :o)*/ void SetUpHomeDir(gchar *username, gchar *password) { ! //TODO: User groups should made customizable in future, ! // not hardcoded in executable like now ! const gchar user_groups[64] = "audio,video,users,lp,cdrom,floppy,games"; ! // It is enough 256 characters ? ! gchar cmdline[256]; ! ! if (strncmp(username,"morph",6) != 0) { ! // I think morph user can be left as is (TODO: maybe with no password) ! // move the morph dir to the new username's ! // sprintf(cmdline,"chroot %s sh -c 'mv /home/morph /home/%s'",ROOT_MOUNTPOINT,username); ! // ExecuteCommand(cmdline); ! // remove the morph user ! // sprintf(cmdline,"chroot %s sh -c 'deluser morph'",ROOT_MOUNTPOINT); ! // ExecuteCommand(cmdline); ! // add the new group ! sprintf(cmdline,"chroot %s sh -c 'groupadd %s'",ROOT_MOUNTPOINT,username); ! ExecuteCommand(cmdline); ! // add the new user ! sprintf(cmdline,"chroot %s sh -c 'useradd -m -s /bin/bash -d /home/%s -c \"Morphix User\" -g %s -p '%s' %s'", ! ROOT_MOUNTPOINT, username, username, crypt(password), username); ! ExecuteCommand(cmdline); ! // Add the new user to /etc/sudoers - Even though the file may be deleted later on ! ! sprintf(cmdline,"chroot %s sh -c 'echo %s ALL:=NOPASSWD:ALL\n >> /etc/sudoers'",ROOT_MOUNTPOINT,username); ! ExecuteCommand(cmdline); ! // make sure the user's files have the right permissions ! sprintf(cmdline,"chroot %s sh -c 'chown -R %s.%s /home/%s'",ROOT_MOUNTPOINT,username,username,username); ! ExecuteCommand(cmdline); ! } ! else { ! // change the morph-user's password ! sprintf(cmdline,"chroot %s sh -c \"echo \\\"morph:%s\\\" | chpasswd\"",ROOT_MOUNTPOINT,password); ! ExecuteCommand(cmdline); ! } ! ! // add user to needed groups ! sprintf(cmdline,"chroot %s sh -c 'usermod -G %s %s'", ROOT_MOUNTPOINT, user_groups, username); ! ExecuteCommand(cmdline); ! ! sprintf(cmdline,"chroot %s sh -c 'usermod -G dip %s'",ROOT_MOUNTPOINT,username); ! ExecuteCommand(cmdline); } + /* void UseXsessionBoot(gchar *username) { gchar *input_buf; *************** *** 742,745 **** --- 785,789 ---- g_strfreev(input_array); } + */ /* *************** *** 752,755 **** --- 796,800 ---- void SetupLilo(gint lilo_mode) { + // lilo.conf shouldn't be hardcoded to executable gchar lilo_conf[4092]; gchar *outbuffer; *************** *** 992,997 **** /* add pump to the inittab (messy, i know, gotta fix this to detect if DHCP is used...) */ ! sprintf(cmdline,"%s/etc/inittab",ROOT_MOUNTPOINT); file =fopen(cmdline,"a"); // add getty's so each console has it's login prompt fprintf(file,"2:2345:respawn:/sbin/getty 38400 tty2\n"); --- 1037,1044 ---- /* add pump to the inittab (messy, i know, gotta fix this to detect if DHCP is used...) */ ! // TODO: detect if DHCP is used and make correct /etc/network/interfaces in this case ! /* sprintf(cmdline,"%s/etc/inittab",ROOT_MOUNTPOINT); file =fopen(cmdline,"a"); + // standart Debian inittab already contains this stuff // add getty's so each console has it's login prompt fprintf(file,"2:2345:respawn:/sbin/getty 38400 tty2\n"); *************** *** 1002,1006 **** fprintf(file,"P1:2345:once:/sbin/pump\n"); fclose(file); ! // TODO - add DMA --- 1049,1053 ---- fprintf(file,"P1:2345:once:/sbin/pump\n"); fclose(file); ! */ // TODO - add DMA *************** *** 1101,1110 **** void UnmountTarget() { ! gchar cmdline[256]; ! // doesn't work ! debug("Unmounting /mnt/target\n"); ! sprintf(cmdline,"umount %s",ROOT_MOUNTPOINT); ! ExecuteCommand(cmdline); } --- 1148,1173 ---- void UnmountTarget() { ! gchar cmdline[256]; ! gint i; ! // target/miniroot and expert partitions should be unmounted first ! ! if (expert_part == TRUE) { ! for (i = 0; i < MAX_EXPERT_MOUNTS; i++) { ! if (strcmp(expert_selected_parts[i],"") != 0 && ! strcmp(expert_selected_parts[i],"none") != 0) { ! sprintf(cmdline,"umount %s",expert_selected_parts[i]); ! ExecuteCommand(cmdline); ! } ! } ! } ! ! // Don't know where is the best place for umounting miniroot ! sprintf(cmdline,"umount %s/miniroot",ROOT_MOUNTPOINT); ! ExecuteCommand(cmdline); ! ! debug("Unmounting target\n"); ! sprintf(cmdline,"umount %s",ROOT_MOUNTPOINT); ! ExecuteCommand(cmdline); } *************** *** 1341,1345 **** gint total_size_mb = 0; ! cmdline = g_strdup_printf("du -s /cdrom"); g_spawn_command_line_sync(cmdline,&outbuffer,NULL,&exitstatus,NULL); output_array = g_strsplit(outbuffer,"\n",0); --- 1404,1413 ---- gint total_size_mb = 0; ! // I think we should care about really size of copiedfiles and use ! // du -s /usr + du -s /lib and so on ... but for some stange reasons ! // /usr on CD is significally bigger - /usr/lib and /usr/X11R6 are duplicated ! // Btw, here should displayed somewhat like "Calculating free space..." ! // Because, on slower CPU's and CD's this may take more than 2 minutes ! cmdline = g_strdup_printf("du -s /usr"); g_spawn_command_line_sync(cmdline,&outbuffer,NULL,&exitstatus,NULL); output_array = g_strsplit(outbuffer,"\n",0); *************** *** 1350,1354 **** gchar device[64]; gint num_finds = 0; ! num_finds = sscanf(output_array[i],"%63s /cdrom",size); // if (num_finds == 0) { /* fixme: check for multiple cdrom's... */ --- 1418,1422 ---- gchar device[64]; gint num_finds = 0; ! num_finds = sscanf(output_array[i],"%63s /usr",size); // if (num_finds == 0) { /* fixme: check for multiple cdrom's... */ *************** *** 1420,1424 **** gdouble GetCurrentPercentage(gint cdrom_size, gint curr_rootpart_size) { gdouble perc; ! gdouble unpacked_cdrom_size = cdrom_size * 2.8; // just guessing this one perc = (gdouble)curr_rootpart_size / unpacked_cdrom_size; --- 1488,1492 ---- gdouble GetCurrentPercentage(gint cdrom_size, gint curr_rootpart_size) { gdouble perc; ! gdouble unpacked_cdrom_size = cdrom_size; perc = (gdouble)curr_rootpart_size / unpacked_cdrom_size; Index: interface.c =================================================================== RCS file: /cvsroot/morphix/morphixinstaller/src/interface.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** interface.c 24 Sep 2003 23:23:03 -0000 1.10 --- interface.c 26 Oct 2003 22:56:18 -0000 1.11 *************** *** 247,251 **** gtk_box_pack_start (GTK_BOX (hbox4), vbox3, TRUE, TRUE, 0); ! label4 = gtk_label_new (_("Please select your harddisk,\nthis will launch cfdisk, a partition tool for Linux. \nIt is console-based, but temporary.\n\nMake sure you have at least one Linux and one swap partition\n")); gtk_widget_show (label4); gtk_box_pack_start (GTK_BOX (vbox3), label4, FALSE, FALSE, 0); --- 247,251 ---- gtk_box_pack_start (GTK_BOX (hbox4), vbox3, TRUE, TRUE, 0); ! label4 = gtk_label_new (_("Please select your harddisk,\nthis will launch a Linux partitioning tool.\n\nMake sure you have at least one Linux and one swap partition\n")); gtk_widget_show (label4); gtk_box_pack_start (GTK_BOX (vbox3), label4, FALSE, FALSE, 0); |