From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

Tor anonymizer network. More information on the Tor homepage.

Simple installer

Use the following XML file to install it silently:

<?xml version="1.0" encoding="utf-8" ?>

<package id='Tor' name='Tor' revision='1218' priority='50' reboot='false' >
  <check type='uninstall' condition='exists' path='Tor' />
  <install cmd='"%SOFTWARE%\Tor v.\vidalia-bundle-" /S' />
  <install cmd='"%SOFTWARE%\Tor v.\unattended-postinstall.cmd"' />
  <remove cmd='"%ProgramFiles%\Vidalia Bundle\Uninstall.exe" /S' />
  <upgrade cmd='"%SOFTWARE%\Tor v.\vidalia-bundle-" /S' />
  <upgrade cmd='"%SOFTWARE%\Tor v.\unattended-postinstall.cmd"' />


Advanced installer/upgrade

Unfortunately I found that upgrading Vidalia/Tor bundle is not as easy as expected. If there is already an existing installation the installer will ask if the existing torrc configuration file should be overwritten with the included one. My solution to this is to simply delete any existing torrc file of the installing user before updating. Of course this is a bad solution if you run the installation with the same user you're going to use Tor later on since your custom configuration will be erased. I still consider this solution to be reasonable due to the following reasons:

  • Just a few users modify torrc anyway so it might in most cases not be a problem at all
  • If WPKG is run as a service (WPKG GUI) only the SYSTEM users torrc is replaced. Since Vidalia is run by any other user later on (never by the SYSTEM user) it will not affect any users configuration.

So here's my extended solution.

XML definition for WPKG (Tor.xml):

<?xml version="1.0" encoding="utf-8" ?>

<package id='Tor' name='Tor' revision='1219' priority='50' reboot='false' >
  <!-- Version 1.2.19 -->
  <check type='uninstall' condition='exists' path='Tor' />
  <install cmd='"%SOFTWARE%\Tor v.\unattended.cmd"' />
  <remove cmd='"%SOFTWARE%\Tor v.\unattended-uninstall.cmd"' />
  <upgrade cmd='"%SOFTWARE%\Tor v.\unattended.cmd"' />


As you can see I am running my custom 'unattended.cmd' script. This script handles 32-bit as well as 64-bit installations. Here's the code (unattended.cmd):

@echo off

set CMD32=vidalia-bundle-
set CMD64=%CMD32%
set INSTALLER=install.cmd

echo Installing TOR

REM Delete configuration file
REM Without this the setup is not silent, it will ask to overwrite the configuration file
REM As the installation is done with a dedicated (admin)user this is not an issue
REM User configuration will not be affected
del /F /Q "%APPDATA%\Vidalia\torrc"
REM Delete old torrc (32-bit path on 64-bit windows)
if exist "%SYSTEMROOT%\SysWOW64\cmd.exe" "%SYSTEMROOT%\SysWOW64\cmd.exe" /c "del /F /Q "%APPDATA%\Vidalia\torrc"

start /wait "Tor" "%INSTALLER_LOC%%CMD32%" /S


REM call "%INSTALLER_LOC%unattended-postinstall.cmd"

REM Kill firefox and explorere instances
start /wait "Browserkill" "%INSTALLER_LOC%taskkill.exe" /F /T /IM firefox.exe
start /wait "Browserkill" "%INSTALLER_LOC%taskkill.exe" /F /T /IM iexplore.exe

exit /B %EXIT_CODE%

As you can see I am calling taskkill.exe after installation. This is due to the fact that the Vidalia installer opens up a web-browser window. You just need to place the taskkill.exe command into the same folder where the installer is located (download it from Microsoft, Resource Kit Tools).