1 | /*:VRX Main
|
---|
2 | */
|
---|
3 | /* Main
|
---|
4 | */
|
---|
5 | Main:
|
---|
6 | /* Process the arguments.
|
---|
7 | Get the parent window.
|
---|
8 | */
|
---|
9 | parse source . calledAs .
|
---|
10 | parent = ""
|
---|
11 | argCount = arg()
|
---|
12 | argOff = 0
|
---|
13 | if( calledAs \= "COMMAND" )then do
|
---|
14 | if argCount >= 1 then do
|
---|
15 | parent = arg(1)
|
---|
16 | argCount = argCount - 1
|
---|
17 | argOff = 1
|
---|
18 | end
|
---|
19 | end; else do
|
---|
20 | call VROptions 'ImplicitNames'
|
---|
21 | call VROptions 'NoEchoQuit'
|
---|
22 | end
|
---|
23 | InitArgs.0 = argCount
|
---|
24 | if( argCount > 0 )then do i = 1 to argCount
|
---|
25 | InitArgs.i = arg( i + argOff )
|
---|
26 | end
|
---|
27 | drop calledAs argCount argOff
|
---|
28 |
|
---|
29 | /* Load the windows
|
---|
30 | */
|
---|
31 | call VRInit
|
---|
32 | parse source . . spec
|
---|
33 | _VREPrimaryWindowPath = ,
|
---|
34 | VRParseFileName( spec, "dpn" ) || ".VRW"
|
---|
35 | _VREPrimaryWindow = ,
|
---|
36 | VRLoad( parent, _VREPrimaryWindowPath )
|
---|
37 | drop parent spec
|
---|
38 | if( _VREPrimaryWindow == "" )then do
|
---|
39 | call VRMessage "", "Cannot load window:" VRError(), ,
|
---|
40 | "Error!"
|
---|
41 | _VREReturnValue = 32000
|
---|
42 | signal _VRELeaveMain
|
---|
43 | end
|
---|
44 |
|
---|
45 | /* Process events
|
---|
46 | */
|
---|
47 | call Init
|
---|
48 | signal on halt
|
---|
49 | do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
|
---|
50 | _VREEvent = VREvent()
|
---|
51 | interpret _VREEvent
|
---|
52 | end
|
---|
53 | _VREHalt:
|
---|
54 | _VREReturnValue = Fini()
|
---|
55 | call VRDestroy _VREPrimaryWindow
|
---|
56 | _VRELeaveMain:
|
---|
57 | call VRFini
|
---|
58 | exit _VREReturnValue
|
---|
59 |
|
---|
60 | VRLoadSecondary:
|
---|
61 | __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
|
---|
62 | if __vrlsWait then do
|
---|
63 | call VRFlush
|
---|
64 | end
|
---|
65 | __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
|
---|
66 | if __vrlsHWnd = '' then signal __vrlsDone
|
---|
67 | if __vrlsWait \= 1 then signal __vrlsDone
|
---|
68 | call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
|
---|
69 | __vrlsTmp = __vrlsWindows.0
|
---|
70 | if( DataType(__vrlsTmp) \= 'NUM' ) then do
|
---|
71 | __vrlsTmp = 1
|
---|
72 | end
|
---|
73 | else do
|
---|
74 | __vrlsTmp = __vrlsTmp + 1
|
---|
75 | end
|
---|
76 | __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
|
---|
77 | __vrlsWindows.0 = __vrlsTmp
|
---|
78 | do while( VRIsValidObject( VRWindow() ) = 1 )
|
---|
79 | __vrlsEvent = VREvent()
|
---|
80 | interpret __vrlsEvent
|
---|
81 | end
|
---|
82 | __vrlsTmp = __vrlsWindows.0
|
---|
83 | __vrlsWindows.0 = __vrlsTmp - 1
|
---|
84 | call VRWindow __vrlsWindows.__vrlsTmp
|
---|
85 | __vrlsHWnd = ''
|
---|
86 | __vrlsDone:
|
---|
87 | return __vrlsHWnd
|
---|
88 |
|
---|
89 | /*:VRX EraseDir
|
---|
90 | */
|
---|
91 | EraseDir:
|
---|
92 | file = arg(1)
|
---|
93 | if VRFileExists(File) then do
|
---|
94 | ok = SysRMDir(File)
|
---|
95 | /* ok = 1 */
|
---|
96 | if ok = 0 then str = file' deleted!'
|
---|
97 | else str = 'DIR 'file' deletion failed (rc='ok')'
|
---|
98 | end
|
---|
99 | else Str = file' does not exist!'
|
---|
100 | ok = VRMethod( "LB_Erased", "AddString", str )
|
---|
101 | return 0
|
---|
102 |
|
---|
103 | /*:VRX EraseFile
|
---|
104 | */
|
---|
105 | EraseFile: procedure
|
---|
106 | file = arg(1)
|
---|
107 | if VRFileExists(File) then do
|
---|
108 | ok = SysFileDelete(File)
|
---|
109 | /* ok = 1 */
|
---|
110 | if ok = 0 then str = file' deleted!'
|
---|
111 | else str = file' deletion failed (rc='ok')'
|
---|
112 | end
|
---|
113 | else Str = file' does not exist!'
|
---|
114 | ok = VRMethod( "LB_Erased", "AddString", str )
|
---|
115 | return 0
|
---|
116 |
|
---|
117 | /*:VRX Fini
|
---|
118 | */
|
---|
119 | Fini:
|
---|
120 | window = VRWindow()
|
---|
121 | call VRSet window, "Visible", 0
|
---|
122 | drop window
|
---|
123 | return 0
|
---|
124 |
|
---|
125 | /*:VRX Halt
|
---|
126 | */
|
---|
127 | Halt:
|
---|
128 | signal _VREHalt
|
---|
129 | return
|
---|
130 |
|
---|
131 | /*:VRX Init
|
---|
132 | */
|
---|
133 | Init:
|
---|
134 | window = VRWindow()
|
---|
135 | call VRMethod window, "CenterWindow"
|
---|
136 | call VRSet window, "Visible", 1
|
---|
137 | call VRMethod window, "Activate"
|
---|
138 | drop window
|
---|
139 | return
|
---|
140 |
|
---|
141 | /*:VRX PB_Close_Click
|
---|
142 | */
|
---|
143 | PB_Close_Click:
|
---|
144 | call Quit
|
---|
145 | return
|
---|
146 |
|
---|
147 | /*:VRX Quit
|
---|
148 | */
|
---|
149 | Quit:
|
---|
150 | window = VRWindow()
|
---|
151 | call VRSet window, "Shutdown", 1
|
---|
152 | drop window
|
---|
153 | return
|
---|
154 |
|
---|
155 | /*:VRX removecfg_Close
|
---|
156 | */
|
---|
157 | removecfg_Close:
|
---|
158 | call Quit
|
---|
159 | return
|
---|
160 |
|
---|
161 | /*:VRX removecfg_Create
|
---|
162 | */
|
---|
163 | removecfg_Create:
|
---|
164 | ok = VRRedirectStdIO("OFF")
|
---|
165 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
|
---|
166 | call SysLoadFuncs
|
---|
167 |
|
---|
168 | ETC = value('ETC',,'OS2ENVIRONMENT')
|
---|
169 | ok = VRSet("EF_ETC","Value",ETC'\samba')
|
---|
170 |
|
---|
171 | /* If ETC is not set properly we abort - too dangerous! */
|
---|
172 | if ETC = "" then do
|
---|
173 | Buttons.1 = "OK"
|
---|
174 | Buttons.0 = 1
|
---|
175 | id = VRMessage( VRWindow(), "ETC not set properly - aborting...", "Samba Deinstallation", "Error", "Buttons.", 1, 1 )
|
---|
176 | call Quit
|
---|
177 | end
|
---|
178 |
|
---|
179 | parse arg smbdir
|
---|
180 | smbdir = VRGet("Application","Commandline")
|
---|
181 | if smbdir = "" then do
|
---|
182 | Buttons.1 = "OK"
|
---|
183 | Buttons.0 = 1
|
---|
184 | id = VRMessage( VRWindow(), "Samba directory not provided - aborting...", "Samba Deinstallation", "Error", "Buttons.", 1, 1 )
|
---|
185 | call Quit
|
---|
186 | end
|
---|
187 |
|
---|
188 | ok = directory(smbdir)
|
---|
189 | ok = VRSet("EF_SMBDIR","Value",smbdir)
|
---|
190 |
|
---|
191 | UnixRoot=value('UNIXROOT',,'OS2ENVIRONMENT')
|
---|
192 | if UnixRoot = "" then UnixRoot = SysBootDrive()||'\MPTN'
|
---|
193 | if strip(UnixRoot,'T','\') <> UnixRoot then UnixRoot = strip(UnixRoot,'T','\')
|
---|
194 | ok = VRSet("EF_UNIXROOT","Value",UNIXROOT'\etc')
|
---|
195 |
|
---|
196 | Buttons.1 = "Yes"
|
---|
197 | Buttons.2 = "No"
|
---|
198 | Buttons.0 = 2
|
---|
199 | id = VRMessage( VRWindow(), "Remove Samba configuration files completely?", "Samba Deinstallation", "Query", "Buttons.", 2, 2 )
|
---|
200 | if id = 2 then call Quit
|
---|
201 | else do
|
---|
202 | ok = EraseFile(Unixroot'\etc\master.passwd')
|
---|
203 | ok = EraseFile(Unixroot'\etc\master.passwd.bak')
|
---|
204 | ok = EraseFile(Unixroot'\etc\group')
|
---|
205 | ok = EraseFile(Unixroot'\etc\group.bak')
|
---|
206 | ok = EraseFile(Unixroot'\etc\pwd.db')
|
---|
207 | ok = EraseFile(Unixroot'\etc\pwd.db.bak')
|
---|
208 | ok = EraseFile(Unixroot'\etc\spwd.db')
|
---|
209 | ok = EraseFile(Unixroot'\etc\spwd.db.bak')
|
---|
210 |
|
---|
211 | ok = SysFileTree(ETC'\samba\*',smbcfg.,'FOS')
|
---|
212 | do I = 1 to smbcfg.0
|
---|
213 | ok = EraseFile(smbcfg.I)
|
---|
214 | end
|
---|
215 |
|
---|
216 | ok = SysFileTree(ETC'\samba\*',smbdir.,'DOS')
|
---|
217 |
|
---|
218 | do I = smbdir.0 to 1 by -1
|
---|
219 | ok = EraseDir(smbdir.I)
|
---|
220 | end
|
---|
221 | ok = EraseDir(ETC'\samba')
|
---|
222 |
|
---|
223 | ok = EraseFile(smbdir'\smbstatus.ini')
|
---|
224 | ok = EraseFile(smbdir'\smbusers.ini')
|
---|
225 | ok = EraseFile(smbdir'\sscc.ini')
|
---|
226 |
|
---|
227 | ok = EraseFile(smbdir'\smbstatus.err')
|
---|
228 | ok = EraseFile(smbdir'\smbusers.err')
|
---|
229 | ok = EraseFile(smbdir'\sscc.err')
|
---|
230 |
|
---|
231 | ok = EraseFile(smbdir'\swatstart.cmd')
|
---|
232 |
|
---|
233 | ok = SysFileTree(smbdir'\swat\*',swatdir.,'DOS')
|
---|
234 | do I = swatdir.0 to 1 by -1
|
---|
235 | ok = EraseDir(swatdir.I)
|
---|
236 | end
|
---|
237 |
|
---|
238 | ok = EraseDir(smbdir'\swat')
|
---|
239 |
|
---|
240 | ok = VRSet("PB_Close","Enabled",1)
|
---|
241 | end
|
---|
242 | return
|
---|