1: <piml>
2: <targetroot>/</targetroot>
3: <files>
4: <file>
5: <target dist="default"></target>
6: <perlscript mode="fg">
7:
8: use File::Path();
9:
10: my %paths = (
11: 'londaemons' => '/home/httpd/perl',
12: 'apache' => '/home/httpd/lib/perl/Apache',
13: 'londocroot' => '/home/httpd/html',
14: );
15:
16: my %files = (
17: 'londaemons' => ['lonManage','lchtmldir','lonhttpd','lcuseradd','lonc'],
18: 'apache' => ['londropadd.pm','lonconstruct.pm',
19: 'admbookmarks.pm','lonassignments.pm'],
20: 'londocroot' => ['adm/rat/extpickcode.html',
21: 'adm/rat/extpickframe.html',
22: 'adm/help/gif/vbkm.gif',
23: 'adm/help/eps/vbkm.eps'],
24: );
25:
26: my %dirs = (
27: 'londocroot' => 'htmlarea',
28: 'res/adm/pages/bookmarkmenu',
29: );
30:
31: my @filestodelete = ();
32: my @dirstodelete = ();
33: foreach my $key (sort(keys(%files))) {
34: if ($paths{$key} ne '') {
35: if (ref($files{$key}) eq 'ARRAY') {
36: foreach my $file (@{$files{$key}}) {
37: if (-f $paths{$key}.'/'.$file) {
38: push(@filestodelete,$paths{$key}.'/'.$file);
39: }
40: }
41: }
42: }
43: }
44:
45: foreach my $key (sort(keys(%dirs))) {
46: if ($paths{$key} ne '') {
47: if (ref($dirs{$key}) eq 'ARRAY') {
48: foreach my $dir (@{$dirs{$key}}) {
49: if (-d $paths{$key}.'/'.$dir) {
50: push(@dirstodelete,$paths{$key}.'/'.$dir);
51: }
52: }
53: }
54: }
55: }
56:
57: if (@dirstodelete > 0) {
58: print "\nThe following directories were installed for an earlier version of LON-CAPA, and are no longer needed. It is recommended that you delete them. For each one, enter Y if you would the directory to be deleted.\n\n";
59: foreach my $dir (@dirstodelete) {
60: next if (($dir =~/\*/) || ($dir eq '') || ($dir eq '/'));
61: print "$dir -- delete? Enter: Y or N:\n";
62: my $choice=<>;
63: chomp($choice);
64: $choice =~ s/\s+//g;
65: if ($choice eq 'Y') {
66: File::Path::remove_tree($dir);
67: }
68: }
69: }
70:
71: if (@filestodelete > 0) {
72: print "\nThe following files were installed for an earlier version of LON-CAPA, and are no longer needed. It is recommended that you delete them. For each one, enter Y if you would the file to be deleted.\n\n";
73: foreach my $file (@filestodelete) {
74: next if (($file =~/\*/) || ($file eq '') || ($file eq '/'));
75: print "$file -- remove? Enter? Y or N:\n";
76: my $choice=<>;
77: chomp($choice);
78: $choice =~ s/\s+//g;
79: if ($choice eq 'Y') {
80: unlink($file);
81: }
82: }
83: }
84:
85: </perlscript>
86: </file>
87: </files>
88: </piml>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>