[BACK]Return to util.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / distrib / utils / sysinst

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/distrib/utils/sysinst/Attic/util.c between version 1.6 and 1.6.2.1

version 1.6, 1997/10/20 06:13:42 version 1.6.2.1, 1997/10/30 06:14:37
Line 161  void run_makedev (void)
Line 161  void run_makedev (void)
 /* Load files from floppy. */  /* Load files from floppy. */
 int get_via_floppy (void)  int get_via_floppy (void)
 {  {
         char realdir[STRSIZE];  
         char distname[STRSIZE];          char distname[STRSIZE];
         char fddev[STRSIZE] = "/dev/fd0a";          char fddev[STRSIZE] = "/dev/fd0a";
         char dirname[STRSIZE];  
         char fname[STRSIZE];          char fname[STRSIZE];
         char fullname[STRSIZE];          char fullname[STRSIZE];
         char **list;          distinfo *list;
         char **last;  
         char post[4];          char post[4];
         int  mounted = 0;          int  mounted = 0;
           int  first;
         struct stat sb;          struct stat sb;
   
         msg_prompt (MSG_distdir, dist_dir, dist_dir, STRSIZE,  
                     "unloading from floppy");          cd_dist_dir ("unloading from floppy");
         if (*dist_dir == '/')  
                 snprintf (realdir, STRSIZE, "/mnt%s", dist_dir);  
         else  
                 snprintf (realdir, STRSIZE, "/mnt/%s", dist_dir);  
         strcpy (dist_dir, realdir);  
         run_prog ("/bin/mkdir %s", realdir);  
         clean_dist_dir = 1;  
 #ifndef DEBUG  
         if (chdir(realdir)) {  
                 endwin();  
                 (void)fprintf(stderr, msg_string(MSG_realdir), realdir);  
                 exit(1);  
         }  
 #else  
         printf ("chdir (%s)\n", realdir);  
 #endif  
   
         msg_prompt_add (MSG_fddev, fddev, fddev, STRSIZE);          msg_prompt_add (MSG_fddev, fddev, fddev, STRSIZE);
   
         list = dist_list;          list = dist_list;
         last = fd_last;          while (list->name) {
         while (*last) {  
                 strcpy (post, ".aa");                  strcpy (post, ".aa");
                 snprintf (dirname, STRSIZE, *list, rels, "/" );                  snprintf (distname, STRSIZE, list->name, rels, dist_postfix);
                 snprintf (distname, STRSIZE, *list, rels, dist_postfix);                  while (list->getit && strcmp(&post[1],list->fdlast) <= 0) {
                 msg_display (MSG_fdload, dirname);                          snprintf (fname, STRSIZE, list->name, rels, post);
                 process_menu (MENU_yesno);                          snprintf (fullname, STRSIZE, "/mnt2/%s", fname);
                 while (yesno && strcmp(post,*last) <= 0) {                          first = 1;
                         snprintf (fname, STRSIZE, *list, rels, post);  
                         snprintf (fullname, STRSIZE, "/mnt2/%s%s", dirname,  
                                   fname);  
                         while (!mounted || stat(fullname, &sb)) {                          while (!mounted || stat(fullname, &sb)) {
                                 if (mounted)                                  if (mounted)
                                         run_prog ("/sbin/umount /mnt2");                                          run_prog ("/sbin/umount /mnt2 "
                                 msg_display (MSG_fdmount, dirname, fname);                                                    "2>/dev/null");
                                 process_menu (MENU_ok);                                  if (first)
                                 while (!run_prog("/sbin/mount -t %s %s /mnt2",                                          msg_display (MSG_fdmount, fname);
                                   else
                                           msg_display (MSG_fdnotfound, fname);
                                   process_menu (MENU_fdok);
                                   if (!yesno)
                                           return 0;
                                   while (run_prog("/sbin/mount -t %s %s /mnt2",
                                                  fdtype, fddev)) {                                                   fdtype, fddev)) {
                                         msg_display (MSG_fdremount, dirname,                                          msg_display (MSG_fdremount, fname);
                                                      fname);  
                                         process_menu (MENU_fdremount);                                          process_menu (MENU_fdremount);
                                         if (!yesno)                                          if (!yesno)
                                                 return 0;                                                  return 0;
                                 }                                  }
                                 mounted = 1;                                  mounted = 1;
                                   first = 0;
                         }                          }
                         run_prog ("/bin/cat /mnt2/%s >> %s", fullname,                          run_prog ("/bin/cat %s >> %s", fullname, distname);
                                   distname);                          if (post[2] < 'z')
                         if (post[1] < 'z')                                  post[2]++;
                                 post[1]++;  
                         else                          else
                                 post[1]='a', post[2]++;                                  post[2]='a', post[1]++;
                 }                  }
                 run_prog ("/sbin/umount /mnt2");                  run_prog ("/sbin/umount /mnt2 2>/dev/null");
                 mounted = 0;                  mounted = 0;
                 list++;                  list++;
                 last++;  
         }          }
 #ifndef DEBUG  #ifndef DEBUG
         chdir("/");          chdir("/");
Line 246  get_via_cdrom(void)
Line 228  get_via_cdrom(void)
         process_menu (MENU_cdromsource);          process_menu (MENU_cdromsource);
   
         /* Mount it */          /* Mount it */
         while (!run_prog ("/sbin/mount -rt cd9660 %s /mnt2", cdrom_dev)) {          while (run_prog ("/sbin/mount -rt cd9660 /dev/%sa /mnt2", cdrom_dev)) {
                 process_menu (MENU_cdrombadmount);                  process_menu (MENU_cdrombadmount);
                 if (!yesno)                  if (!yesno)
                         return 0;                          return 0;
Line 260  get_via_cdrom(void)
Line 242  get_via_cdrom(void)
         mnt2_mounted = 1;          mnt2_mounted = 1;
         return 1;          return 1;
 }  }
   
   
   void cd_dist_dir (char *forwhat)
   {
           char realdir[STRSIZE];
   
           msg_prompt (MSG_distdir, dist_dir, dist_dir, STRSIZE, forwhat);
           if (*dist_dir == '/')
                   snprintf (realdir, STRSIZE, "/mnt%s", dist_dir);
           else
                   snprintf (realdir, STRSIZE, "/mnt/%s", dist_dir);
           strcpy (dist_dir, realdir);
           run_prog ("/bin/mkdir %s", realdir);
           clean_dist_dir = 1;
   #ifndef DEBUG
           if (chdir(realdir)) {
                   endwin();
                   (void)fprintf(stderr, msg_string(MSG_realdir), realdir);
                   exit(1);
           }
   #else
           printf ("chdir (%s)\n", realdir);
   #endif
   }
   
   /* Support for custom distribution fetches / unpacks. */
   
   void toggle_getit (int num)
   {
           dist_list[num].getit ^= 1;
   }
   
   void show_cur_distsets (void)
   {
           distinfo *list;
   
           msg_display (MSG_cur_distsets);
           list = dist_list;
           while (list->name) {
                   msg_printf_add ("%s%s\n", list->desc, list->getit ?
                                   msg_string(MSG_yes) : msg_string(MSG_no));
                   list++;
           }
   }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.6.2.1

CVSweb <webmaster@jp.NetBSD.org>