annotate netinstall/uninstall.cc @ 666:146d342ff859

[xemacs-hg @ 2001-09-25 02:35:32 by andyp] more updates
author andyp
date Tue, 25 Sep 2001 02:35:32 +0000
parents ce0b3f2eff35
children a307f9a2021d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
657
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
1 /*
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
2 * Copyright (c) 2000, Red Hat, Inc.
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
3 *
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
7 * (at your option) any later version.
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
8 *
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
9 * A copy of the GNU General Public License can be found at
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
10 * http://www.gnu.org/
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
11 *
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
12 * Written by DJ Delorie <dj@cygnus.com>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
13 *
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
14 */
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
15
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
16 /* The purpose of this file is to intall all the packages selected in
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
17 the install list (in ini.h). Note that we use a separate thread to
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
18 maintain the progress dialog, so we avoid the complexity of
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
19 handling two tasks in one thread. We also create or update all the
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
20 files in /etc/setup and create the mount points. */
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
21
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
22 #include <io.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
23 #include <stdio.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
24 #include <stdlib.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
25 #include <ctype.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
26 #ifndef WIN32_NATIVE
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
27 #include <unistd.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
28 #endif
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
29 #include <sys/types.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
30 #include <sys/stat.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
31 #include <errno.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
32 #include <zlib.h>
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
33
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
34 #include "win32.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
35 #include "commctrl.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
36
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
37 #include "resource.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
38 #include "ini.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
39 #include "dialog.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
40 #include "concat.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
41 #include "geturl.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
42 #include "mkdir.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
43 #include "state.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
44 #include "tar.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
45 #include "diskfull.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
46 #include "msg.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
47 #include "regedit.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
48 #include "reginfo.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
49 #include "log.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
50 #include "hash.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
51
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
52 #include "port.h"
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
53
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
54 #define XM_DONE (WM_USER + 101)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
55
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
56 static HWND unins_dialog = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
57 static HWND unins_action = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
58 static HWND unins_pkgname = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
59 static HWND unins_filename = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
60 static HWND unins_pprogress = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
61 static HWND unins_iprogress = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
62 static HWND unins_diskfull = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
63 static HANDLE init_event;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
64
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
65 static int package_bytes = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
66 static int uninstall_started = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
67
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
68 extern char * map_filename (char *fn, int type);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
69 void remove_desktop_setup ();
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
70 static void start_uninstall ();
666
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
71 extern char* find_xemacs_exe_name();
657
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
72
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
73 char *
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
74 base (char *s);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
75
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
76 static BOOL
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
77 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
78 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
79 switch (id)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
80 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
81 case IDCANCEL:
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
82 exit_setup (1);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
83 case IDOK:
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
84 if (uninstall_started == 0) {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
85 uninstall_started = 1;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
86 start_uninstall();
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
87 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
88 else
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
89 exit_setup(0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
90 break;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
91 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
92 return FALSE;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
93 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
94
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
95 static BOOL CALLBACK
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
96 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
97 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
98 switch (message)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
99 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
100 case WM_INITDIALOG:
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
101 unins_dialog = h;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
102 unins_action = GetDlgItem (h, IDC_UNINS_ACTION);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
103 unins_pkgname = GetDlgItem (h, IDC_UNINS_PKG);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
104 unins_filename = GetDlgItem (h, IDC_UNINS_FILE);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
105 unins_pprogress = GetDlgItem (h, IDC_UNINS_PPROGRESS);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
106 unins_iprogress = GetDlgItem (h, IDC_UNINS_IPROGRESS);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
107 unins_diskfull = GetDlgItem (h, IDC_UNINS_DISKFULL);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
108 SendMessage (unins_pprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100));
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
109 SendMessage (unins_iprogress, PBM_SETRANGE, 0, MAKELPARAM (0, 100));
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
110 SendMessage (unins_diskfull, PBM_SETRANGE, 0, MAKELPARAM (0, 100));
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
111 SetWindowText (unins_pkgname, "");
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
112 SetWindowText (unins_filename, "");
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
113 SendMessage (unins_pprogress, PBM_SETPOS, (WPARAM) 0, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
114 SendMessage (unins_iprogress, PBM_SETPOS, (WPARAM) 0, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
115 SendMessage (unins_diskfull, PBM_SETPOS, (WPARAM) 0, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
116 return FALSE;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
117
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
118 case XM_DONE:
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
119 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
120 SetWindowText (GetDlgItem (h, IDOK), "Ok");
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
121 LONG style = GetWindowLong (GetDlgItem (h, IDCANCEL),
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
122 GWL_STYLE);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
123 SetWindowLong (GetDlgItem (h, IDCANCEL),
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
124 GWL_STYLE, style & WS_DISABLED);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
125 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
126 return FALSE;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
127
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
128 case WM_COMMAND:
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
129 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
130 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
131 return DefWindowProc (h, message, wParam, lParam);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
132 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
133
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
134 static DWORD WINAPI uninstall_all (void *);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
135
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
136 static void
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
137 start_uninstall ()
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
138 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
139 DWORD tid;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
140 HANDLE thread;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
141 init_event = CreateEvent (0, 0, 0, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
142 thread = CreateThread (0, 0, uninstall_all, 0, 0, &tid);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
143 WaitForSingleObject (init_event, 10000);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
144 CloseHandle (init_event);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
145 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
146
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
147 static void
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
148 progress (int bytes, int num)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
149 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
150 int perc;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
151 log (0, "%d bytes", bytes);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
152 if (package_bytes > 100)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
153 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
154 perc = (bytes * 100) / package_bytes;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
155 SendMessage (unins_pprogress, PBM_SETPOS, (WPARAM) perc, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
156 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
157
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
158 if (npackages > 0)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
159 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
160 perc = (num * 100) / npackages;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
161 SendMessage (unins_iprogress, PBM_SETPOS, (WPARAM) perc, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
162 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
163 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
164
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
165 static int num_installs, num_uninstalls;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
166
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
167 static void
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
168 uninstall_one (char *name, int type, int num)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
169 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
170 hash dirs;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
171 char line[_MAX_PATH];
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
172 char* fname = (type == TY_GENERIC ?
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
173 concat (root_dir, XEMACS_PACKAGE_DIR, "pkginfo/MANIFEST.",
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
174 name, 0) :
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
175 concat (root_dir, XEMACS_SETUP_DIR, "MANIFEST.", name, 0));
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
176
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
177 FILE* lst = fopen (fname, "rb");
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
178 int pos = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
179
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
180 if (lst)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
181 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
182 fseek (lst, 0, SEEK_END);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
183 package_bytes = ftell (lst);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
184 fseek (lst, 0, SEEK_SET);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
185
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
186 SetWindowText (unins_pkgname, name);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
187 SetWindowText (unins_action, "Uninstalling...");
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
188 log (0, "uninstalling %s", name);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
189
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
190 while (fgets (line, sizeof (line), lst))
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
191 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
192 progress (pos, num);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
193 pos += strlen(line);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
194 if (line[strlen(line)-1] == '\n')
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
195 line[strlen(line)-1] = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
196
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
197 dirs.add_subdirs (line);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
198
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
199 char *d = map_filename (line, type);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
200 DWORD dw = GetFileAttributes (d);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
201 if (dw != 0xffffffff && !(dw & FILE_ATTRIBUTE_DIRECTORY))
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
202 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
203 log (LOG_BABBLE, "unlink %s", d);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
204 DeleteFile (d);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
205 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
206 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
207 fclose (lst);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
208 remove (fname);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
209
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
210 dirs.reverse_sort ();
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
211 char *subdir = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
212 while ((subdir = dirs.enumerate (subdir)) != 0)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
213 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
214 char *d = map_filename (subdir, type);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
215 if (RemoveDirectory (d))
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
216 log (LOG_BABBLE, "rmdir %s", d);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
217 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
218 num_uninstalls ++;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
219 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
220 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
221
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
222 void
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
223 do_uninstall (HINSTANCE h)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
224 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
225 num_installs = 0, num_uninstalls = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
226
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
227 next_dialog = 0; // we're done after this
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
228
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
229 if (!root_dir)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
230 fatal ("no installation found");
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
231
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
232 int rv = DialogBox (h, MAKEINTRESOURCE (IDD_UNINSTALL), 0, dialog_proc);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
233 if (rv == -1)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
234 fatal (IDS_DIALOG_FAILED);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
235 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
236
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
237 static void
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
238 read_installed_db ()
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
239 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
240 if (!root_dir)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
241 return;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
242
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
243 char line[1000], pkg[1000], inst[1000], src[1000];
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
244 int instsz, srcsz;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
245
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
246 FILE *db = fopen (concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0), "rt");
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
247 if (!db)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
248 return;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
249
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
250 while (fgets (line, 1000, db))
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
251 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
252 src[0] = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
253 srcsz = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
254 sscanf (line, "%s %s %d %s %d", pkg, inst, &instsz, src, &srcsz);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
255
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
256 log (0, "read %s", pkg);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
257 Package* np = new_package(strdup(pkg));
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
258 pinfo(*np).install = inst;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
259 pinfo(*np).install_size = instsz;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
260 // pick up versoin
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
261 char *v, *d;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
262 for (v=base (inst); *v; v++)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
263 if (*v == '-' && isdigit(v[1]))
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
264 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
265 v++;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
266 break;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
267 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
268 if (!v)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
269 v = inst;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
270 for (d=v; *d; d++)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
271 if (strncmp (d, ".tar", 4) == 0
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
272 || strncmp (d, "-pkg", 4) == 0)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
273 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
274 *d = 0;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
275 break;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
276 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
277 if (v[0])
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
278 pinfo(*np).version = strdup (v);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
279 else
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
280 pinfo(*np).version = "0";
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
281 // Crude but effective
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
282 if (pkg != 0)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
283 if (strncmp ("xemacs-i686", pkg, 11) == 0
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
284 || (strncmp ("xemacs-i586", pkg, 11) == 0))
666
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
285 {
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
286 np->type = install_type;
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
287 xemacs_package = np;
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
288 }
657
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
289 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
290 fclose (db);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
291 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
292
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
293 static DWORD WINAPI
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
294 uninstall_all (void *)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
295 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
296 int i;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
297 SetEvent (init_event);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
298
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
299 int df = diskfull (root_dir);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
300 SendMessage (unins_diskfull, PBM_SETPOS, (WPARAM) df, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
301
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
302 read_installed_db();
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
303
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
304 log (0, "There are %d packages\n", npackages);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
305 for (i=0; i<npackages; i++)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
306 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
307 log (0, "uninstalling %s\n", package[i].name);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
308 uninstall_one (package[i].name, package[i].type, i);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
309 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
310
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
311 PostMessage (unins_dialog, XM_DONE, 0, 0);
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
312
666
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
313 remove (concat (root_dir, XEMACS_SETUP_DIR, "installed.db.old", 0));
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
314 remove (concat (root_dir, XEMACS_SETUP_DIR, "installed.db", 0));
657
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
315
666
146d342ff859 [xemacs-hg @ 2001-09-25 02:35:32 by andyp]
andyp
parents: 657
diff changeset
316 remove_desktop_setup();
657
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
317 remove_xemacs_root();
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
318 remove_uninstall_path();
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
319
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
320 if (num_installs == 0)
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
321 {
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
322 // exit_msg = IDS_UNINSTALL_COMPLETE;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
323 return FALSE;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
324 }
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
325
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
326 return FALSE;
ce0b3f2eff35 [xemacs-hg @ 2001-09-09 04:37:41 by andyp]
andyp
parents:
diff changeset
327 }