Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/sysinst Remove precisely the set files when ti...



details:   https://anonhg.NetBSD.org/src/rev/1bba7636ea22
branches:  trunk
changeset: 571159:1bba7636ea22
user:      dsl <dsl%NetBSD.org@localhost>
date:      Thu Nov 11 22:30:49 2004 +0000

description:
Remove precisely the set files when tidying up after an ftp install.
(why this code persists in running 'rm -f' and not just calling unlink()
is rather beyond me....)

diffstat:

 distrib/utils/sysinst/util.c |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 03292468e7ba -r 1bba7636ea22 distrib/utils/sysinst/util.c
--- a/distrib/utils/sysinst/util.c      Thu Nov 11 22:21:53 2004 +0000
+++ b/distrib/utils/sysinst/util.c      Thu Nov 11 22:30:49 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.130 2004/09/12 19:12:45 dsl Exp $   */
+/*     $NetBSD: util.c,v 1.131 2004/11/11 22:30:49 dsl Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -752,6 +752,7 @@
 {
        int got_dist;
        int verbose;
+       distinfo *list;
 
        /* Ensure mountpoint for distribution files exists in current root. */
        (void)mkdir("/mnt2", S_IRWXU| S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH);
@@ -793,12 +794,23 @@
        mnt_net_config();
        
        /* Clean up dist dir (use absolute path name) */
-       if (clean_dist_dir && ext_dir[0] == '/' && ext_dir[1] != 0) {
-               msg_display(MSG_delete_dist_files,
-                   ext_dir + strlen(target_prefix()));
+       if (clean_dist_dir) {
+               msg_display(MSG_delete_dist_files, dist_dir);
                process_menu(MENU_yesno, NULL);
-               if (yesno)
-                       run_program(0, "/bin/rm -rf %s", ext_dir);
+               if (yesno) {
+                       for (list = dist_list; list->desc != NULL; list++) {
+                               if (list->name == NULL)
+                                       /* menu entry for a group of sets */
+                                       continue;
+                               run_program(0, "/bin/rm -f %s/%s/%s%s",
+                                       target_prefix(), dist_dir,
+                                       list->name, dist_postfix);
+                       }
+                       /* chroot 'cos no rmdir in install fs */
+                       run_program(RUN_CHROOT | RUN_SILENT | RUN_ERROR_OK,
+                                       "/bin/rmdir %s/%s",
+                                       target_prefix(), dist_dir);
+               }
        }
 
        /* Mounted dist dir? */



Home | Main Index | Thread Index | Old Index