package Slim::Utils::OS::Custom; use strict; use base qw(Slim::Utils::OS::Unix); use File::Spec::Functions qw(:ALL); use FindBin qw($Bin); use Cwd (); # this is where SlimNAS is installed my $basePath = Cwd::realpath(catdir($Bin, updir())); sub initDetails { my $class = shift; $class->{osDetails}->{'os'} = 'Linux'; $class->{osDetails}->{osName} = 'FreeNAS/SlimNAS'; if ( open(VERSION, catdir($basePath, 'usr', 'www', 'lang.inc')) ) { while () { if (/_SRVSLIM_VERSION_NR, '(.+)'/) { $class->{osDetails}->{osName} .= " $1"; last; } } close VERSION; } $ENV{PERL5LIB} = ""; return $class->{osDetails}; } sub dirsFor { my ($class, $dir) = @_; my @dirs; # some defaults if ($dir eq 'log') { push @dirs, $::logdir || catdir($basePath, 'var', 'squeezecenter', 'Logs'); } elsif ($dir eq 'cache') { push @dirs, $::cachedir || catdir($basePath, 'var', 'squeezecenter', 'Cache'); } elsif ($dir eq 'prefs') { push @dirs, $::prefsdir || catdir($basePath, 'etc', 'squeezecenter'); } elsif ($dir eq 'libpath') { push @dirs, $Bin; } else { @dirs = $class->SUPER::dirsFor($dir); } return wantarray() ? @dirs : $dirs[0]; } sub ignoredItems { return ( 'bin' => '/', 'boot' => '/', 'cf' => '/', 'conf' => '/', 'conf.default' => '/', 'dev' => '/', 'etc' => '/', 'ftmp' => '/', 'home' => '/', 'lib' => '/', 'libexec' => '/', 'root' => '/', 'sbin' => '/', 'tmp' => '/', 'usr' => '/', 'var' => '/', 'lost+found'=> 1, ); } # force utf8 on SlimNAS sub localeDetails { my $class = shift; my @locale = $class->SUPER::localeDetails(); shift @locale; return ('utf8', @locale); } sub canRestartServer { 0 } 1;