root/trunk/engine/setup/ispcp-uninstall

Revision 1327, 20.5 kB (checked in by rats, 4 months ago)

* Fixed: --scan-knownbad-files and --check-deleted are no longer supported by rkhunter
* Fixed #1471: chkrootkit should be in lenny / hardy
* Updated Chinese (simplified)
* Updated German
* Fixed #1475: typo on installation (ispcp-setup)
* Fixed: default user for rkhunter.log

Line 
1 #!/usr/bin/perl
2
3 # ispCP ω (OMEGA) a Virtual Hosting Control Panel
4 # Copyright (c) 2001-2006 by moleSoftware GmbH
5 # http://www.molesoftware.com
6 # Copyright (c) 2006-2008 by isp Control Panel
7 # http://isp-control.net
8 #
9 #
10 # License:
11 #    This program is free software; you can redistribute it and/or
12 #    modify it under the terms of the MPL Mozilla Public License
13 #    as published by the Free Software Foundation; either version 1.1
14 #    of the License, or (at your option) any later version.
15 #
16 #    This program is distributed in the hope that it will be useful,
17 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
18 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 #    MPL Mozilla Public License for more details.
20 #
21 #    You may have received a copy of the MPL Mozilla Public License
22 #    along with this program.
23 #
24 #    An on-line copy of the MPL Mozilla Public License can be found
25 #    http://www.mozilla.org/MPL/MPL-1.1.html
26 #
27 #
28 # The ispCP ω Home Page is at:
29 #
30 #    http://isp-control.net
31 #
32
33 use FindBin;
34 use lib "$FindBin::Bin/..";
35 require 'ispcp_common_code.pl';
36
37 use strict;
38 use warnings;
39
40 sub welcome_note {
41
42     my ($rs, $rdata) = (undef, undef);
43
44     push_el(\@main::el, 'welcome_note()', 'Starting...');
45
46     my $welcome_message = <<MSG;
47
48     Welcome in ISPCP OMEGA '$main::cfg{'Version'}' Uninstall Program.
49
50     This program will uninstall ispCP OMEGA system from your server.
51
52     /!\\ WARNING: All domain users and their accounts will be removed.  /!\\
53
54     Please press 'Enter' to continue.
55 MSG
56
57     print STDOUT $welcome_message;
58
59     $rdata = readline(\*STDIN);
60         chop($rdata);
61
62     push_el(\@main::el, 'welcome_note()', 'Ending...');
63
64     return 0;
65
66 }
67
68 sub user_dialog {
69
70     my ($rs, $rdata) = (undef, undef);
71
72     push_el(\@main::el, 'user_dialog()', 'Starting...');
73
74     $rs = welcome_note();
75
76     return $rs if ($rs != 0);
77
78     return 0;
79
80 }
81
82 sub uninstall_start_up {
83
84     my ($rs, $rdata) = (undef, undef);
85
86     push_el(\@main::el, 'uninstall_start_up()', 'Starting...');
87
88     # config check;
89
90     $rs = get_conf();
91
92     return $rs if ($rs != 0);
93
94     push_el(\@main::el, 'uninstall_start_up()', 'Ending...');
95
96     return 0;
97
98 }
99
100 sub uninstall_shut_down {
101
102     my ($rs, $rdata) = (undef, undef);
103
104     push_el(\@main::el, 'uninstall_shut_down()', 'Starting...');
105
106     $rs = del_file("/tmp/ispcp-uninstall-services.log");
107
108     return $rs if ($rs != 0);
109
110     my $shut_down_message = <<MSG;
111
112     Congratulations !
113
114     ISPCP OMEGA '$main::cfg{'Version'}' uninstall completed successfully !
115
116     Thank you for using ISPCP OMEGA product !
117
118 MSG
119
120     print STDOUT $shut_down_message;
121
122     push_el(\@main::el, 'uninstall_shut_down()', 'Ending...');
123
124     return 0;
125
126 }
127
128 sub check_host_sql {
129
130     push_el(\@main::el, 'check_host_sql()', 'Starting...');
131
132     my ($rs, $rdata, $sql) = (undef, undef, undef);
133
134     $sql = "show databases;";
135
136     my $store_db_name = $main::db_name;
137
138     $main::db_name = "";
139
140     @main::db_connect = (
141                          "DBI:mysql:$main::db_name:$main::db_host",
142                          $main::db_user,
143                          $main::db_pwd
144                         );
145
146     ($rs, $rdata) = doSQL($sql);
147
148     return $rs if ($rs != 0);
149
150     $main::db = undef;
151
152     $main::db_name = $store_db_name;
153
154     @main::db_connect = (
155                          "DBI:mysql:$main::db_name:$main::db_host",
156                          $main::db_user,
157                          $main::db_pwd
158                         );
159
160     push_el(\@main::el, 'check_host_sql()', 'Ending...');
161
162     return 0;
163 }
164
165 sub check_host_system {
166
167     my ($rs, $rdata) = (undef, undef);
168
169     push_el(\@main::el, 'check_host_system()', 'Starting...');
170
171     $rs = check_host_sql();
172
173     return $rs if ($rs != 0);
174
175     push_el(\@main::el, 'check_host_system()', 'Ending...');
176
177     return 0;
178
179 }
180
181 sub uninstall_system_users {
182
183     my ($rs, $rdata, $rows, $sql) = (undef, undef, undef, undef);
184
185     push_el(\@main::el, 'uninstall_system_users()', 'Starting...');
186
187     my ($fuid, $fgid) = ($main::cfg{'MTA_MAILBOX_UID_NAME'}, $main::cfg{'MTA_MAILBOX_GID_NAME'});
188
189     my ($muid, $mgid) = ($main::cfg{'APACHE_SUEXEC_MIN_UID'}, $main::cfg{'APACHE_SUEXEC_MIN_GID'});
190
191     my ($upref) = ($main::cfg{'APACHE_SUEXEC_USER_PREF'});
192
193     my ($uid, $gid) = (undef, undef);
194
195
196     my @udata = ();
197
198     my @gdata = ();
199
200     #
201         # MTA Mailbox User
202     #
203     @udata = getpwnam($fuid);
204     @gdata = getgrnam($fuid);
205
206     if (scalar(@udata) != 0) { # we have not this one user data;
207
208         my $cmd = "$main::cfg{'CMD_USERDEL'} $fuid";
209
210         $rs = sys_command($cmd);
211
212         return $rs if ($rs != 0);
213
214     }
215
216     if (scalar(@gdata) != 0) { # we have not this one group data;
217
218         my $cmd = "$main::cfg{'CMD_GROUPDEL'} $fuid";
219
220         $rs = sys_command($cmd);
221
222         return $rs if ($rs != 0);
223
224     }
225
226         #
227         # PHP Master
228         #
229
230         @udata = getpwnam("$upref$muid");
231
232         if (scalar(@udata) != 0) { # we have not this one user data;
233
234                 my $cmd = "$main::cfg{'CMD_USERDEL'} $upref$muid";
235
236                 $rs = sys_command($cmd);
237
238                 return $rs if ($rs != 0);
239
240         }
241
242         @gdata = getgrnam("$upref$mgid");
243
244         if (scalar(@gdata) != 0) { # we have not this one group data;
245
246                 my $cmd = "$main::cfg{'CMD_GROUPDEL'} $upref$mgid";
247
248                 $rs = sys_command($cmd);
249
250                 return $rs if ($rs != 0);
251
252         }
253
254         #
255         # Virtual User
256         #
257
258         $sql = "select domain_uid,domain_gid from domain";
259
260         ($rs, $rows) = doSQL($sql);
261
262         return $rs if ($rs != 0);
263
264         if (scalar(@$rows) != 0) {
265
266                 foreach (@$rows) {
267
268                         my $query_user = $_;
269
270                         @udata = getpwnam("$upref@$query_user[0]");
271
272                         if (scalar(@udata) != 0) { # we have not this one user data;
273
274                                 my $cmd = "$main::cfg{'CMD_USERDEL'} $upref@$query_user[0]";
275
276                                 $rs = sys_command($cmd);
277
278                                 return $rs if ($rs != 0);
279
280                         }
281
282                         @gdata = getgrnam("$upref@$query_user[1]");
283
284                         if (scalar(@gdata) != 0) { # we have not this one group data;
285
286                                 my $cmd = "$main::cfg{'CMD_GROUPDEL'} $upref@$query_user[0]";
287
288                                 $rs = sys_command($cmd);
289
290                                 return $rs if ($rs != 0);
291
292                         }
293
294                 }
295
296         }
297
298
299     push_el(\@main::el, 'uninstall_system_users()', 'Ending...');
300
301     return 0;
302
303 }
304
305 sub uninstall_system_dirs {
306
307     my ($rs, $rdata) = (undef, undef);
308
309     push_el(\@main::el, 'uninstall_system_dirs()', 'Starting...');
310
311         # ask to delete directory
312         $rdata = 'yes';
313         my $qmsg = "\tDelete ".$main::cfg{'APACHE_WWW_DIR'}."? [yes]: ";
314         print STDOUT $qmsg;
315
316         $rdata = readline(\*STDIN);
317         chop($rdata);
318
319         if ($rdata eq 'yes' || $rdata eq 'y') {
320             $rs = del_dir($main::cfg{'APACHE_WWW_DIR'});
321             return $rs if ($rs != 0);
322         }
323
324     $rs = del_dir($main::cfg{'APACHE_USERS_LOG_DIR'});
325     return $rs if ($rs != 0);
326
327     $rs = del_dir($main::cfg{'APACHE_BACKUP_LOG_DIR'});
328     return $rs if ($rs != 0);
329
330     $rs = del_dir($main::cfg{'MTA_VIRTUAL_CONF_DIR'});
331     return $rs if ($rs != 0);
332
333
334         # ask to delete directory
335         $rdata = 'yes';
336         $qmsg = "\tDelete ".$main::cfg{'MTA_VIRTUAL_MAIL_DIR'}."? [yes]: ";
337         print STDOUT $qmsg;
338
339         $rdata = readline(\*STDIN);
340         chop($rdata);
341
342         if ($rdata eq 'yes' || $rdata eq 'y') {
343         $rs = del_dir($main::cfg{'MTA_VIRTUAL_MAIL_DIR'});
344         return $rs if ($rs != 0);
345     }
346
347     $rs = del_dir($main::cfg{'LOG_DIR'});
348     return $rs if ($rs != 0);
349
350     $rs = del_dir($main::cfg{'PHP_STARTER_DIR'});
351     return $rs if ($rs != 0);
352
353     push_el(\@main::el, 'uninstall_system_dirs()', 'Ending...');
354
355     return 0;
356 }
357
358 sub uninstall_sql {
359
360     my ($rs, $rdata) = (undef, undef);
361
362     push_el(\@main::el, 'uninstall_sql()', 'Starting...');
363
364     #
365     # check for existing database;
366     #
367
368     my $sql = "show tables;";
369
370     ($rs, $rdata) = doSQL($sql);
371
372     if ($rs == 0) { # Yes, we have one ! Let's drop it;
373
374         my $store_db_name = $main::db_name;
375
376
377         # Let's reset data;
378
379
380         $main::db = undef;
381
382         $main::db_name = '';
383
384         @main::db_connect = (
385                              "DBI:mysql:$main::db_name:$main::db_host",
386                              $main::db_user,
387                              $main::db_pwd
388                             );
389
390         $sql = "drop database $store_db_name;";
391
392         ($rs, $rdata) = doSQL($sql);
393
394         return $rs if ($rs != 0);
395
396
397         # Let's reset data;
398
399
400         $main::db = undef;
401
402         $main::db_name = $store_db_name;
403
404         @main::db_connect = (
405                              "DBI:mysql:$main::db_name:$main::db_host",
406                              $main::db_user,
407                              $main::db_pwd
408                             );
409
410     }
411
412     push_el(\@main::el, 'uninstall_sql()', 'Ending...');
413
414     return 0;
415
416 }
417
418 sub uninstall_crontab {
419
420     my $rs = undef;
421
422     push_el(\@main::el, 'uninstall_crontab()', 'Starting...');
423
424     if ( -e "/etc/cron.d/ispcp") {
425         $rs = del_file("/etc/cron.d/ispcp");
426
427         return $rs if ($rs != 0);
428     }
429
430     push_el(\@main::el, 'uninstall_crontab()', 'Ending...');
431
432     return 0;
433
434 }
435
436 sub uninstall_resolver {
437
438     push_el(\@main::el, 'uninstall_resolver()', 'Starting...');
439
440     my $resolv_file = "/etc/resolv.conf";
441
442     my ($rs, $cmd) = (undef, undef);
443
444     if ( -e "$resolv_file.bkp" ) {
445
446         $cmd = "$main::cfg{'CMD_MV'} $resolv_file.bkp $resolv_file";
447
448         $rs = sys_command_rs($cmd);
449
450         return $rs if ($rs != 0);
451     }
452
453     push_el(\@main::el, 'uninstall_resolver()', 'Ending...');
454
455     return 0;
456
457 }
458
459 sub uninstall_logrotate {
460
461     push_el(\@main::el, 'uninstall_logrotate()', 'Starting...');
462
463     my ($rs, $cmd) = (undef, undef);
464
465     my $logrotate_d = "/etc/logrotate.d";
466
467     if ( -e "$logrotate_d/ispcp" ) {
468
469         $rs = del_file("$logrotate_d/ispcp");
470
471         return $rs if ($rs != 0);
472     }
473
474     push_el(\@main::el, 'uninstall_logrotate()', 'Ending...');
475
476     return 0;
477
478 }
479
480 sub uninstall_named {
481
482     my ($rs, $rdata) = (undef, undef);
483
484     push_el(\@main::el, 'uninstall_named()', 'Starting...');
485
486     my $cfg_dir = "$main::cfg{'CONF_DIR'}/bind";
487
488     my $bk_dir = "$cfg_dir/backup";
489
490     my $wrk_dir = "$cfg_dir/working";
491
492     my ($cfg_tpl, $cfg, $cmd) = (undef, undef, undef);
493
494     sys_command_rs("$main::cfg{'CMD_NAMED'} stop &> /tmp/ispcp-uninstall-services.log");
495
496     if (-e "$bk_dir/named.conf.system") {
497
498         $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/named.conf.system $main::cfg{'BIND_CONF_FILE'}";
499
500         $rs = sys_command($cmd);
501
502         return $rs if ($rs != 0);
503
504         $rs = del_file("$bk_dir/named.conf.system");
505
506         return $rs if ($rs != 0);
507
508         $rs = del_file("$bk_dir/named.conf.ispcp");
509
510         return $rs if ($rs != 0);
511
512     }
513
514     sys_command_rs("$main::cfg{'CMD_NAMED'} start &> /tmp/ispcp-uninstall-services.log");
515
516     push_el(\@main::el, 'uninstall_named()', 'Ending...');
517
518     return 0;
519
520 }
521
522 sub uninstall_httpd {
523
524     my ($rs, $rdata) = (undef, undef);
525
526     push_el(\@main::el, 'uninstall_httpd()', 'Starting...');
527
528     my $cfg_dir = "$main::cfg{'CONF_DIR'}/apache";
529
530     my $bk_dir = "$cfg_dir/backup";
531
532     my $wrk_dir = "$cfg_dir/working";
533
534     my ($cfg_tpl, $cfg, $cmd) = (undef, undef, undef);
535
536     sys_command_rs("$main::cfg{'CMD_HTTPD'} stop &> /tmp/ispcp-uninstall-services.log");
537
538     sys_command_rs("a2dissite ispcp.conf &> /tmp/ispcp-uninstall-services.log");
539
540     $rs = del_file("$main::cfg{'APACHE_SITES_DIR'}/ispcp.conf");
541
542     return $rs if ($rs != 0);
543
544     sys_command_rs("a2dissite 00_master.conf &> /tmp/ispcp-uninstall-services.log");
545
546     $rs = del_file("$main::cfg{'APACHE_SITES_DIR'}/00_master.conf");
547
548     return $rs if ($rs != 0);
549
550     sys_command_rs("a2dismod fastcgi_ispcp &> /tmp/ispcp-uninstall-services.log");
551
552     $rs = del_file("$main::cfg{'APACHE_MODS_DIR'}/fastcgi_ispcp.conf");
553
554     return $rs if ($rs != 0);
555         if ( -e "$main::cfg{'APACHE_MODS_DIR'}/fastcgi_ispcp.load") {
556             $rs = del_file("$main::cfg{'APACHE_MODS_DIR'}/fastcgi_ispcp.load");
557
558             return $rs if ($rs != 0);
559         }
560     sleep(5);
561
562     sys_command_rs("$main::cfg{'CMD_HTTPD'} start &> /tmp/ispcp-uninstall-services.log");
563
564     push_el(\@main::el, 'uninstall_httpd()', 'Ending...');
565
566     return 0;
567
568 }
569
570 sub uninstall_mta {
571
572     my ($rs, $rdata) = (undef, undef);
573
574     push_el(\@main::el, 'uninstall_mta()', 'Starting...');
575
576     my $cfg_dir = "$main::cfg{'CONF_DIR'}/postfix";
577
578     my $bk_dir = "$cfg_dir/backup";
579
580     my $wrk_dir = "$cfg_dir/working";
581
582     my $vrl_dir = "$cfg_dir/ispcp";
583
584     my ($cfg_tpl, $cfg, $cmd) = (undef, undef, undef);
585
586     sys_command_rs("$main::cfg{'CMD_MTA'} stop &> /tmp/ispcp-uninstall-services.log");
587
588     if (-e "$bk_dir/main.cf.system") {
589
590         $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/main.cf.system $main::cfg{'POSTFIX_CONF_FILE'}";
591
592         $rs = sys_command($cmd);
593
594         return $rs if ($rs != 0);
595
596         $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/master.cf.system $main::cfg{'POSTFIX_MASTER_CONF_FILE'}";
597
598         $rs = sys_command($cmd);
599
600         return $rs if ($rs != 0);
601
602         $rs = del_file("$bk_dir/main.cf.system");
603
604         return $rs if ($rs != 0);
605
606         $rs = del_file("$bk_dir/master.cf.system");
607
608         return $rs if ($rs != 0);
609
610         $rs = del_file("$bk_dir/main.cf.ispcp");
611
612         return $rs if ($rs != 0);
613
614         $rs = del_file("$bk_dir/master.cf.ispcp");
615
616         return $rs if ($rs != 0);
617
618     }
619
620     if ( -e "/var/spool/postfix/private/ispcp-arpl" ) {
621         $rs = del_file("/var/spool/postfix/private/ispcp-arpl");
622
623         return $rs if ($rs != 0);
624     }
625
626     $rs = sys_command("$main::cfg{'CMD_NEWALIASES'} &> /tmp/ispcp-uninstall-services.log");
627
628     return $rs if ($rs != 0);
629
630     sys_command_rs("$main::cfg{'CMD_MTA'} start &> /tmp/ispcp-uninstall-services.log");
631
632     push_el(\@main::el, 'uninstall_mta()', 'Ending...');
633
634     return 0;
635
636 }
637
638 sub uninstall_po {
639
640     my ($rs, $rdata) = (undef, undef);
641
642     push_el(\@main::el, 'uninstall_po()', 'Starting...');
643
644     my $cfg_dir = "$main::cfg{'CONF_DIR'}/courier";
645
646     my $bk_dir = "$cfg_dir/backup";
647
648     my $wrk_dir = "$cfg_dir/working";
649
650     my ($cfg_tpl, $cfg, $cmd) = (undef, undef, undef);
651
652     sys_command_rs("$main::cfg{'CMD_AUTHD'} stop &> /tmp/ispcp-uninstall-services.log");
653
654     sys_command_rs("$main::cfg{'CMD_IMAP'} stop &> /tmp/ispcp-uninstall-services.log");
655
656     sys_command_rs("$main::cfg{'CMD_POP'} stop &> /tmp/ispcp-uninstall-services.log");
657
658     if (-e "$bk_dir/imapd.system") {
659
660
661         # Let's backup system configs;
662
663         if (exists $main::cfg{'AUTHLIB_CONF_DIR'} && $main::cfg{'AUTHLIB_CONF_DIR'}) {
664
665         $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/authdaemonrc.system $main::cfg{'AUTHLIB_CONF_DIR'}/authdaemonrc";
666
667         $rs = sys_command($cmd);
668
669         return $rs if ($rs != 0);
670
671         $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/authmodulelist.system $main::cfg{'AUTHLIB_CONF_DIR'}/authmodulelist";
672
673         $rs = sys_command($cmd);
674
675         return $rs if ($rs != 0);
676
677         if (-e "$bk_dir/userdb.system") {
678
679             $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/userdb.system $main::cfg{'AUTHLIB_CONF_DIR'}/userdb";
680
681             $rs = sys_command($cmd);
682
683         }
684
685         } else {
686
687                 $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/authdaemonrc.system $main::cfg{'AUTHLIB_CONF_DIR'}/authdaemonrc";
688
689         $rs = sys_command($cmd);
690
691         return $rs if ($rs != 0);
692
693                 if (-e "$bk_dir/authmodulelist.system") {
694                 $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/authmodulelist.system $main::cfg{'AUTHLIB_CONF_DIR'}/authmodulelist";
695                 $rs = sys_command($cmd);
696                 return $rs if ($rs != 0);
697         }
698
699         if (-e "$bk_dir/userdb.system") {
700             $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/userdb.system $main::cfg{'AUTHLIB_CONF_DIR'}/userdb";
701             $rs = sys_command($cmd);
702         }
703
704         }
705
706         return $rs if ($rs != 0);
707
708         $rs = del_file("$bk_dir/imapd.system");
709
710         return $rs if ($rs != 0);
711
712         $rs = del_file("$bk_dir/pop3d.system");
713
714         return $rs if ($rs != 0);
715
716         $rs = del_file("$bk_dir/authdaemonrc.system");
717
718         return $rs if ($rs != 0);
719
720         $rs = del_file("$bk_dir/authmodulelist.system");
721
722         return $rs if ($rs != 0);
723
724         if (-e "$bk_dir/userdb.system") {
725
726             $rs = del_file("$bk_dir/userdb.system");
727
728             return $rs if ($rs != 0);
729
730         }
731
732         $rs = del_file("$bk_dir/imapd.ispcp");
733
734         return $rs if ($rs != 0);
735
736         $rs = del_file("$bk_dir/pop3d.ispcp");
737
738         return $rs if ($rs != 0);
739
740         $rs = del_file("$bk_dir/authdaemonrc.ispcp");
741
742         return $rs if ($rs != 0);
743
744         $rs = del_file("$bk_dir/authmodulelist.ispcp");
745
746         return $rs if ($rs != 0);
747
748     }
749
750     $rs = sys_command($main::cfg{'CMD_MAKEUSERDB'});
751
752     return $rs if ($rs != 0);
753
754     sys_command_rs("$main::cfg{'CMD_AUTHD'} start &> /tmp/ispcp-uninstall-services.log");
755
756     sys_command_rs("$main::cfg{'CMD_IMAP'} start &> /tmp/ispcp-uninstall-services.log");
757
758     sys_command_rs("$main::cfg{'CMD_POP'} start &> /tmp/ispcp-uninstall-services.log");
759
760     push_el(\@main::el, 'uninstall_po()', 'Ending...');
761
762     return 0;
763
764 }
765
766 sub uninstall_ftpd {
767
768     my ($rs, $rdata) = (undef, undef);
769
770     push_el(\@main::el, 'uninstall_ftpd()', 'Starting...');
771
772     my $cfg_dir = "$main::cfg{'CONF_DIR'}/proftpd";
773
774     my $bk_dir = "$cfg_dir/backup";
775
776     my ($cfg_tpl, $cfg, $cmd) = (undef, undef, undef);
777
778     sys_command_rs("$main::cfg{'CMD_FTPD'} stop &> /tmp/ispcp-uninstall-services.log");
779
780     if (-e "$bk_dir/proftpd.conf.system") {
781
782         $cmd = "$main::cfg{'CMD_CP'} -p $bk_dir/proftpd.conf.system $main::cfg{'FTPD_CONF_FILE'}";
783
784         $rs = sys_command($cmd);
785
786         return $rs if ($rs != 0);
787
788         $rs = del_file("$bk_dir/proftpd.conf.system");
789
790         return $rs if ($rs != 0);
791
792         $rs = del_file("$bk_dir/proftpd.conf.ispcp");
793
794         return $rs if ($rs != 0);
795
796     }
797
798     sys_command_rs("$main::cfg{'CMD_FTPD'} start &> /tmp/ispcp-uninstall-services.log");
799
800     push_el(\@main::el, 'uninstall_ftpd()', 'Ending...');
801
802     return 0;
803
804 }
805
806 sub uninstall_ispcpd {
807
808     my ($rs, $rdata) = (undef, undef);
809
810     push_el(\@main::el, 'uninstall_ispcpd()', 'Starting...');
811
812     sys_command_rs("$main::cfg{'CMD_ISPCPD'} stop &> /tmp/ispcp-uninstall-services.log");
813
814     sys_command_rs("$main::cfg{'CMD_ISPCPN'} stop &> /tmp/ispcp-uninstall-services.log");
815
816     if ( -x "/usr/lib/lsb/install_initd" ) { #LSB 3.1 Core section 20.4 compatibility
817
818         sys_command_rs("/usr/lib/lsb/install_initd $main::cfg{'CMD_ISPCPD'} &> /tmp/ispcp-uninstall-services.log");
819         sys_command_rs("/usr/lib/lsb/install_initd $main::cfg{'CMD_ISPCPN'} &> /tmp/ispcp-uninstall-services.log");
820
821     }
822
823     $rs = del_file("$main::cfg{'CMD_ISPCPD'}");
824
825     return $rs if ($rs != 0);
826
827     $rs = del_file("$main::cfg{'CMD_ISPCPN'}");
828
829     return $rs if ($rs != 0);
830
831     if ( ! -x "/usr/lib/lsb/install_initd" && -x "/usr/sbin/update-rc.d" ) {
832
833         sys_command_rs("/usr/sbin/update-rc.d ispcp_daemon remove &> /tmp/ispcp-uninstall-services.log");
834         sys_command_rs("/usr/sbin/update-rc.d ispcp_network remove &> /tmp/ispcp-uninstall-services.log");
835
836     }
837
838     push_el(\@main::el, 'uninstall_ispcpd()', 'Ending...');
839
840     return 0;
841
842 }
843
844 sub uninstall_host_system {
845
846     my ($rs, $rdata) = (undef, undef);
847
848     push_el(\@main::el, 'uninstall_host_system()', 'Starting...');
849
850     $rs = uninstall_system_users();
851
852     return $rs if ($rs != 0);
853
854     $rs = uninstall_system_dirs();
855
856     return $rs if ($rs != 0);
857
858     $rs = uninstall_sql();
859
860     return $rs if ($rs != 0);
861
862     $rs = uninstall_crontab();
863
864     return $rs if ($rs != 0);
865
866     $rs = uninstall_resolver();
867
868     return $rs if ($rs != 0);
869
870     $rs = uninstall_httpd();
871
872     return $rs if ($rs != 0);
873
874     $rs = uninstall_mta();
875
876     return $rs if ($rs != 0);
877
878     $rs = uninstall_po();
879
880     return $rs if ($rs != 0);
881
882     $rs = uninstall_ftpd();
883
884     return $rs if ($rs != 0);
885
886     $rs = uninstall_named();
887
888     return $rs if ($rs != 0);
889
890     $rs = uninstall_ispcpd();
891
892     return $rs if ($rs != 0);
893
894     push_el(\@main::el, 'uninstall_host_system()', 'Ending...');
895
896     return 0;
897
898 }
899
900 ################################################################################
901 ##                                    MAIN                                    ##
902 ################################################################################
903
904 # Clear screen
905 system('clear');
906
907 my $rs = undef;
908
909 $rs = uninstall_start_up();
910
911 if ($rs != 0) {
912
913     my $el_data = pop_el(\@main::el);
914
915     my ($sub_name, $msg) = split(/$main::el_sep/, $el_data);
916
917     print STDERR "$msg\n";
918
919     exit 1;
920
921 }
922
923 $rs = user_dialog();
924
925 if ($rs != 0) {
926
927     my $el_data = pop_el(\@main::el);
928
929     my ($sub_name, $msg) = split(/$main::el_sep/, $el_data);
930
931     print STDERR "$msg\n";
932
933     exit 1;
934
935 }
936
937 $rs = check_host_system();
938
939 if ($rs != 0) {
940
941     my $el_data = pop_el(\@main::el);
942
943     my ($sub_name, $msg) = split(/$main::el_sep/, $el_data);
944
945     print STDERR "$msg\n";
946
947     exit 1;
948
949 }
950
951 $rs = uninstall_host_system();
952
953 if ($rs != 0) {
954
955     my $el_data = pop_el(\@main::el);
956
957     my ($sub_name, $msg) = split(/$main::el_sep/, $el_data);
958
959     print STDERR "$msg\n";
960
961     exit 1;
962
963 }
964
965 $rs = uninstall_shut_down();
966
967 if ($rs != 0) {
968
969     my $el_data = pop_el(\@main::el);
970
971     my ($sub_name, $msg) = split(/$main::el_sep/, $el_data);
972
973     print STDERR "$msg\n";
974
975     exit 1;
976
977 }
Note: See TracBrowser for help on using the browser.