/
brand
executable file
·87 lines (72 loc) · 2.93 KB
/
brand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/php
<?php
umask(002);
if( ! isset($argv[1]) )
die( "No vendor specified\n" );
if( ! isset($argv[2]) )
die( "No product specified\n" );
$vendor = $argv[1];
$product = $argv[2];
$iniFile = parse_ini_file('sitefusion-base/base_application.ini',TRUE);
$version = $iniFile["App"]["Version"];
echo "Version: $version\n";
echo "Will brand builds with:\nVendor: $vendor\nProduct: $product\n";
function brandFile( $path ) {
global $vendor, $product, $vendorURL, $version;
$newpath = dirname($path).'/'.substr(basename($path),5);
rename( $path, $newpath );
$cont = file_get_contents($newpath);
$cont = str_replace("%VENDOR%",$vendor,$cont);
$cont = str_replace("%APP%",$product,$cont);
$cont = str_replace("%VENDORNS%",str_replace(" ","",$vendor),$cont);
$cont = str_replace("%APPNS%",str_replace(" ","",$product),$cont);
$cont = str_replace("%VERSION%",$version,$cont);
file_put_contents( $newpath, $cont );
}
$paths = array(
'windows/base_application.ini',
'macosx/Contents/Resources/base_application.ini',
'linux/32bit/base_application.ini',
'linux/64bit/base_application.ini',
'windows/chrome/branding/en-US/base_brand.dtd',
'macosx/Contents/Resources/chrome/branding/en-US/base_brand.dtd',
'linux/32bit/chrome/branding/en-US/base_brand.dtd',
'linux/64bit/chrome/branding/en-US/base_brand.dtd',
'windows/chrome/branding/nl/base_brand.dtd',
'macosx/Contents/Resources/chrome/branding/nl/base_brand.dtd',
'linux/32bit/chrome/branding/nl/base_brand.dtd',
'linux/64bit/chrome/branding/nl/base_brand.dtd',
'windows/chrome/branding/en-US/base_about.dtd',
'macosx/Contents/Resources/chrome/branding/en-US/base_about.dtd',
'linux/32bit/chrome/branding/en-US/base_about.dtd',
'linux/64bit/chrome/branding/en-US/base_about.dtd',
'windows/chrome/branding/nl/base_about.dtd',
'macosx/Contents/Resources/chrome/branding/nl/base_about.dtd',
'linux/32bit/chrome/branding/nl/base_about.dtd',
'linux/64bit/chrome/branding/nl/base_about.dtd',
'windows/chrome/branding/en-US/base_brand.properties',
'macosx/Contents/Resources/chrome/branding/en-US/base_brand.properties',
'linux/32bit/chrome/branding/en-US/base_brand.properties',
'linux/64bit/chrome/branding/en-US/base_brand.properties',
'windows/chrome/branding/nl/base_brand.properties',
'macosx/Contents/Resources/chrome/branding/nl/base_brand.properties',
'linux/32bit/chrome/branding/nl/base_brand.properties',
'linux/64bit/chrome/branding/nl/base_brand.properties',
'macosx/Contents/base_Info.plist'
);
$platformRoots = array("windows", "macosx", "linux/32bit", "linux/64bit");
foreach ( $paths as $path ) {
$fullpath = 'builds/'.$path;
if(! file_exists($fullpath) )
continue;
echo "- Branding $path\n";
brandFile( $fullpath );
}
foreach ($platformRoots as $platformRoot) {
$fullpath = 'builds/'.$platformRoot;
if(! file_exists($fullpath) )
continue;
echo "Generating precomplete file for platform: $platformRoot\n";
exec("./generateprecomplete \"builds/$platformRoot\"");
}
echo "Done\n";