Linux-DVB-DVBT-Apps-QuartzPVR

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

[ "ADSKIP", 			0,				"1", 										"Advert removal (1=remove adverts, 0=do not remove adverts)"],
[ "DATE_TZ", 			0,				"Europe/London",							"Your timezone (as defined for the PHP Date object)"],
[ "PHP_SEARCH",			0,				"0",										"Allow use of other installed PHP (may cause name clashes)"],
[ "PHP_LOG", 			1,				"", 										"Debug: Log file to use for PHP application"],
[ "SERVER_DEBUG",		0,				"1", 										"Debug: Level of server debug logging"],
	) ;
	
	
	$settings_href->{'PERL_BIN'} = $^X ;
	$settings_href->{'PVR_HOME'} = "/var/lib/$settings_href->{'PVR_USER'}" ;
	
#print Data::Dumper->Dump(["Settings", \%settings]) ;	
	
	 
	## get any new settings
	_get_settings($settings_href, \@settings, 1) ;
	
	## Ask if user wants to amend the extra settings
	my $get_extra = 0 ;
	print "\nWould you like to use defaults for the next set of settings [yes]: " ;
	my $ans = <STDIN> ;
	if ($ans =~ /no/i)
	{
		$get_extra = 1 ;
	}

	## get any default settings
	_get_settings($settings_href, \@extra_settings, $get_extra) ;
	
	## Get the list of all variables
	my $vars_list = "" ;
	foreach my $aref (@settings)
	{
		my ($var, $null_valid, $default, $desc) = @$aref ;
		$vars_list .= "$var " ;
	}
	foreach my $aref (@extra_settings)
	{
		my ($var, $null_valid, $default, $desc) = @$aref ;
		$vars_list .= "$var " ;
	}
	
	# list of fixed settings
	$vars_list .= "   " ;
	foreach my $var (qw/
		RECPROG IPLAYPROG 
		PERL_SCRIPTS PERL_LIB PERL_BIN
		TBL_LISTINGS TBL_RECORD TBL_CHANNELS TBL_RECORDING TBL_RECORDED TBL_SCHEDULE TBL_MULTIREC TBL_IPLAY
		PVR_HOME
	/)
	{
		$vars_list .= "$var " ;
	}
	
	$settings_href->{'_VARS_LIST_'} = $vars_list ;
	
}


#----------------------------------------------------------------------
sub update_install_script
{
	my ($tpl_install_script, $install_script, $settings_href) = @_ ;

	## Read in file
	my @lines ;
	{
	    local( $/ ) ;
    	open( my $fh, $tpl_install_script ) or die "Error: reading install script file $tpl_install_script : $!" ;
		my $lines = <$fh> ;
		close $fh ;

		@lines = split(/\n/, $lines) ;
	}

	## Amend config data section
	my $config_line = 0 ;
	for ($config_line = 0 ; $config_line < @lines; ++$config_line)
	{
#		print "$config_line :: $lines[$config_line]\n" ;
		if ($lines[$config_line] =~ /^\s*__DATA__\s+config/)
		{
#			print " >>>> Found config!\n" ;
			last ;
		}
	}
	$#lines = ++$config_line ;
	
	foreach my $var (sort keys %$settings_href)
	{
		my $val = $settings_href->{$var} ;
		
		# use % instead of $ to ensure App does not attempt to expand variables
		$val =~ s/\$/%/g ; 
		
		push @lines, "$var = $val" ;
	}
	
	
	## Write file
   	open( my $fh, ">$install_script" ) or die "Error: writing install script file $install_script : $!" ;
	foreach (@lines)
	{
		print $fh "$_\n" ;
	}
	close $fh ;

	## Protect file
	chmod 0700, $install_script ;

}


#----------------------------------------------------------------------
sub read_install_script
{
	my ($install_script, $settings_href) = @_ ;

	return if (! -f $install_script) ;

	## Read in file



( run in 0.638 second using v1.01-cache-2.11-cpan-39bf76dae61 )