Monday, January 23, 2012

Packaging Mozilla Firefox

Most people dread while packaging Mozilla Firefox application and mostly try to make a silent installation of it. I was recently given task to package the latest Mozilla Firefox application.
The same procedure can be used for version 10.0.1, 11, 12 and 13, 14 and 15 as well as I have tried and it works fine for all of these.
I would like to share here how I could easily package it. Also by this method you will be able to do Proxy server settings.
First step is to do a Setup capture of the source exe which can be downloaded from Mozilla’s website. Take care that you do not have to launch the application after the installation is completed.
Second Step is to copy 3 files as stated below. You can add these files in your .wsi directly after the setup capture. These 3 files will solve all your issues.

1. Mozilla.cfg: This file needs to be added to "%programfiles%\Mozilla Firefox\" folder and should have this content:

//Firefox Default Settings
// set Firefox Default homepage
pref("browser.startup.homepage","http://your.intranet.com");
// disable default browser check
pref("browser.shell.checkDefaultBrowser", false);
// disable application updates
pref("app.update.enabled", false)
// disables the 'know your rights' button from displaying on first run
pref("browser.rights.3.shown", true);
// disables the request to send performance data from displaying
pref("toolkit.telemetry.prompted", 2);
pref("toolkit.telemetry.rejected", true);
//Firefox Default Settings
//set proxy server settings, choose whatever is required by your organization
pref("network.proxy.ftp", "your.proxy.server");
pref("network.proxy.ftp_port", 8080);
pref("network.proxy.gopher", " your.proxy.server ");
pref("network.proxy.gopher_port", 8080);
pref("network.proxy.http", " your.proxy.server ");
pref("network.proxy.http_port", 8080);
pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1, *.server.local");
pref("network.proxy.type", 1);
pref("network.proxy.share_proxy_settings", true); // use the same proxy settings for all protocols


2. local-settings.js: This file needs to be added to "%programfiles%\Mozilla Firefox\defaults\pref" folder and should have this content:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

3. override.ini : This file needs to be added to “%programfiles%\Mozilla Firefox\” folder and should have this content:

[XRE]
EnableProfileMigrator=false


It is just this simple you can now just remove the Desktop shortcut in your .wsi file and compile it to .msi file.

Wednesday, January 11, 2012

My First Powershell script

Seems that Powershell is the way to go forward as it is well supported with Windows 7 and Microsoft. It is a powerful script. I think it will revolutionize the way we script today.
I just wrote my first powershell script and thought it would be good to share with all. I am not going to give any tutorial for Powershell as there are a lot of them available.
There are a few things which are worth noting in this script:

1) You can get the script directory from the below script in Get-ScriptDirectory function.
2) You can suppress the remote exe installation prompt by command: $env:SEE_MASK_NOZONECHECKS = 1
code
Remove-Item env:\SEE_MASK_NOZONECHECKS
3) Installation of setup.exe with parameters can be seen in function InstallPackage
4) Permissions can be set in Powershell script using the GivePermissions function below.


Here is the code:
------------------------------------------------------

function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$env:SEE_MASK_NOZONECHECKS = 1
$val1 = Get-ScriptDirectory
$CurrentPath = $val1.ToString()
$Setup = $CurrentPath + "\setup.exe"
$Config = " " 
function InstallPackage
{
# Write-host $Setup
# Write-host $Config
    $process = [Diagnostics.Process]::Start($Setup,$Config)
    $process.WaitForExit()
}
function GivePermissions
{
$acl = Get-Acl "C:\Program Files\PLSQL"
$acl.SetAccessRuleProtection($True, $True)
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Users","Modify", "ContainerInherit, ObjectInherit", "None", "Allow")
$acl.AddAccessRule($rule)
Set-Acl "C:\Program Files\PLSQL" $acl
}
# -Main ----------------------------------
InstallPackage
GivePermissions
Remove-Item env:\SEE_MASK_NOZONECHECKS