Custom.pm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # $OpenBSD: Custom.pm,v 1.1 2009/01/28 01:36:00 sthen Exp $
  2. package Slim::Utils::OS::Custom;
  3. use strict;
  4. use Config;
  5. use File::Spec::Functions qw(:ALL);
  6. use FindBin qw($Bin);
  7. use base qw(Slim::Utils::OS::Unix);
  8. sub initDetails {
  9. my $class = shift;
  10. $class->{osDetails}->{'os'} = 'OpenBSD';
  11. $class->{osDetails}->{'osName'} = 'OpenBSD';
  12. $class->{osDetails}->{'uid'} = getpwuid($>);
  13. $class->{osDetails}->{'osArch'} = `arch -s`;
  14. $class->{osDetails}->{isOpenBSD}= 1 ;
  15. return $class->{osDetails};
  16. }
  17. sub name {
  18. return 'OpenBSD';
  19. }
  20. sub initSearchPath {
  21. my $class = shift;
  22. $class->SUPER::initSearchPath();
  23. my @paths = (split(/:/, $ENV{'PATH'}), qw(/usr/bin ${LOCALBASE}/bin /usr/libexec ${LOCALBASE}/libexec /usr/sbin));
  24. Slim::Utils::Misc::addFindBinPaths(@paths);
  25. }
  26. sub dirsFor {
  27. my ($class, $dir) = @_;
  28. my @dirs = ();
  29. if ($dir eq 'oldprefs') {
  30. push @dirs, $class->SUPER::dirsFor($dir);
  31. } elsif ($dir =~ /^(?:Firmware|Graphics|HTML|IR|MySQL|SQL)$/) {
  32. push @dirs, "${LOCALBASE}/share/squeezecenter/$dir";
  33. } elsif ($dir eq 'Plugins') {
  34. push @dirs, $class->SUPER::dirsFor($dir);
  35. push @dirs, "${LOCALBASE}/share/squeezecenter/Plugins";
  36. push @dirs, "${LOCALBASE}/libdata/perl5/site_perl/Slim/Plugin";
  37. } elsif ($dir =~ /^(?:lib|Bin)$/) {
  38. push @dirs, "${LOCALBASE}/libdata/squeezecenter";
  39. } elsif ($dir =~ /^(?:strings|revision)$/) {
  40. push @dirs, "${LOCALBASE}/share/squeezecenter";
  41. } elsif ($dir eq 'libpath') {
  42. push @dirs, "${LOCALBASE}/libdata/squeezecenter";
  43. # Because we use the system MySQL, we need to point to the right
  44. # directory for the errmsg. files. Default to english.
  45. } elsif ($dir eq 'mysql-language') {
  46. push @dirs, "${LOCALBASE}/share/mysql/english";
  47. } elsif ($dir =~ /^(?:types|convert)$/) {
  48. push @dirs, "/etc/squeezecenter";
  49. } elsif ($dir eq 'prefs') {
  50. push @dirs, $::prefsdir || "/var/db/squeezecenter/prefs";
  51. } elsif ($dir eq 'log') {
  52. push @dirs, $::logdir || "/var/log/squeezecenter";
  53. } elsif ($dir eq 'cache') {
  54. push @dirs, $::cachedir || "/var/db/squeezecenter/cache";
  55. } elsif ($dir =~ /^(?:music|playlists)$/) {
  56. push @dirs, '';
  57. } else {
  58. warn "dirsFor: Didn't find a match request: [$dir]\n";
  59. }
  60. return wantarray() ? @dirs : $dirs[0];
  61. }
  62. sub scanner {
  63. return '${LOCALBASE}/bin/scanner.pl';
  64. }
  65. 1;