Changeset 278
- Timestamp:
- Mar 6, 2009, 10:38:05 PM (16 years ago)
- Location:
- trunk/dasscm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r277 r278 358 358 my $mode = get_type( $info->mode ) & 07777; 359 359 my $modestring = sprintf( "%04o", $mode ); 360 my $uid 361 my $uid name = getpwuid($uid);362 my $gid 363 my $gid name = getgrgid($gid);360 my $uidnumber = $info->uid; 361 my $uid = getpwuid($uidnumber) || $uidnumber; 362 my $gidnumber = $info->gid; 363 my $gid = getgrgid($gidnumber) || $gidnumber; 364 364 push( 365 365 @permlist, 366 366 sprintf( "%-55s %-17s %4d", 367 $file, "${uid name}:${gidname}", $modestring )367 $file, "${uid}:${gid}", $modestring ) 368 368 ); 369 369 } else { … … 597 597 my %removedfiles = (); 598 598 my %changedfiles = (); 599 my %unknownfiles = (); 599 600 600 601 # create list of modified files … … 607 608 608 609 if ( -d $realfile ) { 609 ## directory. do nothing 610 # directory 611 if( !-d "$cvsworkfile" ) { 612 # real is directory, repository is not. This is a problem 613 $changedfiles{"$realfile"} = $cvsworkfile; 614 } 615 } elsif ( !-e $realfile ) { 616 $removedfiles{"$realfile"} = $cvsworkfile; 610 617 } elsif ( !-r $realfile ) { 611 $removedfiles{"$realfile"} = $cvsworkfile; 618 # don't have permission to read the file, 619 # can't check it 620 $unknownfiles{"$realfile"} = $cvsworkfile; 612 621 } else { 613 622 ( -r "$cvsworkfile" ) 614 || die("Fehler: $cvsworkfile ist nicht lesbar");623 || fatalerror("failed to read $cvsworkfile"); 615 624 if ( compare( $cvsworkfile, $realfile ) != 0 ) { 616 625 $changedfiles{"$realfile"} = $cvsworkfile; … … 620 629 } 621 630 622 return ( \%changedfiles, \%removedfiles );631 return ( \%changedfiles, \%removedfiles, \%unknownfiles ); 623 632 } 624 633 … … 732 741 "DASSCM_PASSWORD: (hidden)\n", "DASSCM_PROD: $DASSCM_PROD\n", 733 742 "DASSCM_REPO: $DASSCM_REPO\n", 734 "Server Repository: $DASSCM_SVN_REPOSITORY\n", "\n", "[dasscm shell]\n\n"; 735 743 "Server Repository: $DASSCM_SVN_REPOSITORY\n", "\n"; 744 745 status(); 746 747 print "\n[dasscm shell]\n\n"; 736 748 my $shell = $SHELL || "bash"; 737 749 exec($shell) or die "failed to start new shell"; … … 1019 1031 # update local repository 1020 1032 # 1021 svn_update( $filename_prod ); 1022 1023 ( my $refChangedFiles, my $refRemovedFiles ) = 1033 #svn_update( $filename_prod ); 1034 1035 # check, if permissions have changed 1036 permissions(); 1037 1038 # get modified files 1039 ( my $refChangedFiles, my $refRemovedFiles, my $refUnknownFiles ) = 1024 1040 getModifiedFiles($dirname_prod); 1025 1041 my %changedfiles = %{$refChangedFiles}; 1026 1042 my %removedfiles = %{$refRemovedFiles}; 1027 1028 if ( %removedfiles or %changedfiles ) { 1043 my %unknownfiles = %{$refUnknownFiles}; 1044 1045 if ( %removedfiles or %changedfiles or %unknownfiles ) { 1046 1029 1047 if (%removedfiles) { 1030 print "deleted files (found in repository, but not in system):\n"; 1031 foreach my $key ( keys %removedfiles ) { 1032 print "$key\n"; 1033 } 1034 print "\n"; 1048 print "DELETED: files found in repository, but not in system:\n"; 1049 print join( "\n", ( keys %removedfiles ) ) . "\n\n"; 1035 1050 } 1036 1051 1037 1052 if (%changedfiles) { 1038 print "modified files:\n"; 1039 foreach my $key ( keys %changedfiles ) { 1040 print "$key\n"; 1041 } 1042 } 1053 print "MODIFIED: files differs between repository and system:\n"; 1054 print join( "\n", ( keys %changedfiles ) ) . "\n\n"; 1055 } 1056 1057 if (%unknownfiles) { 1058 print "UNKNOWN: insufficient permission to check files:\n"; 1059 print join( "\n", ( keys %unknownfiles ) ) . "\n\n"; 1060 } 1061 1043 1062 } else { 1044 1063 print "no modified files found in $dirname_repo\n"; … … 1057 1076 1058 1077 # return code for the shell 1059 # default: error1060 1078 my $return_code = $RETURN_OK; 1061 1079 my $return_string = "OK: no modified files"; 1062 1080 1063 ( my $refChangedFiles, my $refRemovedFiles ) = 1081 # check, if permissions have changed 1082 permissions(); 1083 1084 # get modified files 1085 ( my $refChangedFiles, my $refRemovedFiles, my $refUnknownFiles ) = 1064 1086 getModifiedFiles( "/" ); 1065 1087 my %changedfiles = %{$refChangedFiles}; 1066 1088 my %removedfiles = %{$refRemovedFiles}; 1089 my %unknownfiles = %{$refUnknownFiles}; 1067 1090 1068 1091 if ( %removedfiles or %changedfiles ) { … … 1074 1097 $return_string .= "removed: " . join( ", ", ( keys %removedfiles ) ) . ". "; 1075 1098 } 1099 if (%unknownfiles) { 1100 $return_string .= "unknown: " . join( ", ", ( keys %unknownfiles ) ) . ". "; 1101 } 1076 1102 $return_code = $RETURN_WARN; 1077 1103 } … … 1089 1115 { 1090 1116 check_env(); 1117 1118 my $return_code = $RETURN_OK; 1091 1119 1092 1120 # … … 1108 1136 1109 1137 # Verzeichnis existiert => schreiben 1110 print "storing permissions in file $permissions_file\n";1111 1138 open( OUTFILE, ">$permissions_file" ) 1112 1139 || die("failed to write to $permissions_file: $!"); … … 1118 1145 } else { 1119 1146 1120 # Pfad für Sicherungsdatei existiert nicht => schreiben auf stdout 1121 # Alias Filehandle für stdout erzeugen 1122 *OUTFILE = *STDOUT; 1123 } 1147 if( $command eq "permission" ) { 1148 # Pfad für Sicherungsdatei existiert nicht => schreiben auf stdout 1149 # Alias Filehandle für stdout erzeugen 1150 $return_code = $RETURN_WARN; 1151 *OUTFILE = *STDOUT; 1152 } else { 1153 # TODO: improve this. Check for diff? 1154 $return_code = $RETURN_CRIT; 1155 return $return_code; 1156 } 1157 } 1158 1124 1159 foreach my $line (@permissions) { 1125 1160 print OUTFILE "$line\n"; … … 1130 1165 } 1131 1166 } 1167 1168 return $return_code; 1132 1169 } 1133 1170 … … 1230 1267 } elsif (m/^permissions$/i) { 1231 1268 $command = "permissions"; 1232 permissions();1269 $return_code = permissions(); 1233 1270 } elsif (m/^cleanup$/i) { 1234 1271 $command = "cleanup"; -
trunk/dasscm/dasscm.spec
r272 r278 62 62 rm -rf $RPM_BUILD_ROOT 63 63 64 64 # TODO: Gruppe dasscm: 4199 65 65 66 66 %files … … 68 68 %dir /var/lib/dasscm/ 69 69 /usr/bin/dasscm 70 % config(noreplace) /etc/dasscm.conf70 %attr(root,4199) %config(noreplace) /etc/dasscm.conf 71 71 %doc Changes doc/* subversion-servers.dass-it
Note:
See TracChangeset
for help on using the changeset viewer.