1 |
snetram |
1.1 |
--- smeserver-subversion-1.4/root/etc/e-smith/events/actions/repository-delete.ImproveRepositoryDeleteSanityCheck 2006-08-26 23:59:54.000000000 +0200 |
2 |
|
|
+++ smeserver-subversion-1.4/root/etc/e-smith/events/actions/repository-delete 2008-02-25 21:15:47.000000000 +0100 |
3 |
|
|
@@ -24,18 +24,30 @@ |
4 |
|
|
#---------------------------------------------------------------------- |
5 |
|
|
|
6 |
|
|
#------------------------------------------------------------ |
7 |
|
|
-# Delete the Unix account and files for the repository. |
8 |
|
|
+# Delete the files for the repository. |
9 |
|
|
#------------------------------------------------------------ |
10 |
|
|
|
11 |
|
|
-event=$1 |
12 |
|
|
-repository=$2 |
13 |
|
|
-if [ -z "$repository" ] |
14 |
|
|
-then |
15 |
|
|
- echo repositoryName argument missing |
16 |
|
|
- exit 1 |
17 |
|
|
-fi |
18 |
|
|
- |
19 |
|
|
-/bin/rm -rf /home/e-smith/files/repositories/$repository |
20 |
|
|
-#/usr/sbin/userdel "$repository" |
21 |
|
|
-#/usr/sbin/groupdel "$repository" |
22 |
|
|
-/sbin/e-smith/db accounts delete $repository |
23 |
|
|
+use strict; |
24 |
|
|
+use Errno; |
25 |
|
|
+use File::Path; |
26 |
|
|
+ |
27 |
|
|
+use esmith::AccountsDB; |
28 |
|
|
+my $adb = esmith::AccountsDB->open_ro(); |
29 |
|
|
+ |
30 |
|
|
+my $event = $ARGV [0]; |
31 |
|
|
+my $repository = $ARGV [1]; |
32 |
|
|
+ |
33 |
|
|
+$a = $adb->get($repository) || undef; |
34 |
|
|
+unless ( defined $a && $a->prop('type') eq "repository-deleted" ) |
35 |
|
|
+{ |
36 |
|
|
+ warn "$repository is not a repository\n"; |
37 |
|
|
+ exit (0); |
38 |
|
|
+} |
39 |
|
|
+ |
40 |
|
|
+my $dir = "/home/e-smith/files/repositories/$repository"; |
41 |
|
|
+ |
42 |
|
|
+exit 0 unless ( -d $dir ); |
43 |
|
|
+ |
44 |
|
|
+rmtree( $dir ) || die "Couldn't remove tree $dir\n"; |
45 |
|
|
+ |
46 |
|
|
+exit (0); |