Koha/misc/uninstall.pl
tipaul 1dcbbce170 * uninstaller.pl to uninstall Koha
* -i auto_install_file to install without questions (useful for developper)
2004-06-21 17:13:32 +00:00

39 lines
1.1 KiB
Perl
Executable file

#!/usr/bin/perl
sub ReadConfigFile
{
my $fname = shift; # Config file to read
my $retval = {}; # Return value: ref-to-hash holding the configuration
open (CONF, $fname) or return undef;
while (<CONF>) {
my $var; # Variable name
my $value; # Variable value
chomp;
s/#.*//; # Strip comments
next if /^\s*$/; # Ignore blank lines
next if (!/^\s*(\w+)\s*=\s*(.*?)\s*$/);
$var = $1;
$value = $2;
$retval->{$var} = $value;
}
close CONF;
return $retval;
}
my $config = ReadConfigFile("/etc/koha.conf");
# to remove web sites:
print "\nrm -rf ".$config->{intranetdir};
print "\nrm -rf ".$config->{opacdir};
# remove mySQL stuff
# DB
print "\nmysqladmin -f -u".$config->{user}." -p".$config->{pass}." drop ".$config->{database};
# user
print "enter mySQL root password, please\n";
my $response=<STDIN>;
chomp $response;
print "\nmysql -uroot -p$response -Dmysql -e\"delete from user where user='".$config->{user}.'"';
# reload mysql
print "\nmysqladmin -uroot -p$response reload";
print "\nrm -f /etc/koha-httpd.conf";
print "\nrm -f /etc/koha.conf";
print "\nEDIT httpd.conf to remove /etc/koha-httpd.conf\n";