重新打包OpenVPN为Windows安装文件

本文出处:

http://openvpn.se/files/howto/openvpn-howto_roll_your_own_installation_package-Rev1.1.html

简单的翻译给大家,很简单,不管是从技术上还是从字面上来说,都值得学习!

Introduction

The installation package used to install OpenVPN on Windows is created with NSIS (Nullsoft Scriptable Install System), an open source tool. The build process is controlled by a simple text file, a NSIS script. Since the OpenVPN 2.0-rc14 release, the latest version of NSIS (v2.05 at the time of writing) can be used to build the installation package. Privious versions required NSIS 2.0beta3. The installation package used to install OpenVPN GUI is based on the original OpenVPN installation package with OpenVPN GUI and My Certificate Wizard added to it.

介绍

在windows下openvpn安装程序是由NSIS(写Winamp的那家Nullsoft公司开发的,全称Nullsoft Scriptable Install System),是一个开源程序。是由NSIS脚本来控制NSIS生成进程的,这些脚本其实就是一些简单的文本文件,当从openvpn 2.0-rc14发布以来,最新的NSIS(本文完成的时候最新版本是v2.05)都能来生成OpenVPN安装包,之前的版本需要NSIS 2.0beta3。该安装包用来安装OpenVPN gui,基于OpenVPN gui安装包,并添加了个人验证向导。

Required software

NSIS v2.05 – The Nullsoft Scriptable Install System

Available from either OpenVPN GUI’s homepage:

http://www.openvpn.se/files/nsis/nsis205.exe

or from the NSIS homepage:

http://nsis.sourceforge.net/download

需要的软件

NSIS V2.05 – 各位到网上搜索即可

可以从OpenVPN GUI主页下载:

http://www.openvpn.se/files/nsis/nsis205.exe

也可以到NSIS的开源主页下载:

http://nsis.sourceforge.net/download

All files to include in the installation package and referred to by the NSIS script

I’ve created a ZIP file containing all files required to build the installation package including the actual NSIS script. I intend to create a new zip file for every new stable release of OpenVPN and OpenVPN GUI. I might create zip’s for some beta releases also. If the version you wish to use is not available, you can always use the closest matching version of this zip, and then just replace openvpn.exe and/or openvpn-gui.exe.

This package is available here:

http://www.openvpn.se/files/install_packages_source

安装包包含的所有的文件都会被NSIS脚本调用

我已经创建了包含NSIS实例脚本和所有安装文件的压缩zip包.我打算在OpenVPN及图形化管理界面发布新的标准版的时候都创建新的压缩包.也许我也会创建一些测试版的压缩包.如果你希望使用的该版本不正确,你也可以使用最近版本的zip包,只不过是替换掉openvpn.exe及openvpn-gui.exe.

所有的打包都在这里:

http://www.openvpn.se/files/install_packages_source

Preparations

Download and install NSIS v2.05.

Download and extract the installation package source zip file referred to above.

Building the Installation Package

To build the installation package, simply right-click the NSIS script (openvpn-gui.nsi) and chose Compile NSI.

Modifying the script for your own needs

How do I include my own openvpn configuration file?

Create your own config file and name it as you want the connection named when using the GUI. For example Office.ovpn.

Put Office.ovpn in the openvpnconfig folder.

Under the OpenVPN GUI section in the NSIS script uncomment the following line:

File “${HOME}configOffice.ovpn”

准备

下载和安装NSIS V2.05(飞翔注:各位也可以下载最新的版本,不过得对脚本做一些修改).

下载并解压上面提到的安装源文件压缩包

建立安装包

要建立安装包,请检查NSIS脚本(openvpn-gui.nsi)是否正确,并选择编译NSI

修改你自己需要的安装脚本

怎么建立自己的OpenVPN设置文件呢?

创建你自己的config文件,命名是你用图形化管理界面连接的名字,例如:Office.ovpn.

将Office.ovpn放在Openvpnconfig目录下.

在NSIS脚本中去掉下面行的注解:

How do I include an other version of OpenVPN or OpenVPN GUI than the one included in the ZIP file?

Replace openvpn.exe and/or openvpn-gui.exe in the openvpn folder with the version you want.

Put the source code zip-file for the corresponding openvpn and/or openvpn-gui version in the openvpn folder. In the beginning of the NSIS script modify the following lines to match the versions you use:

!define OPENVPN_VERSION “2.0_rcXX”

!define GUI_VERSION “1.0-rcXX”

我怎么才能更换压缩包里的openvpn和 OpenVPN GUI版本?

用你喜欢的版本文件替换掉目录下的openvpn.exe及openvpn-giu.exe即可
将相应的openvpn源代码放在openvpn文件夹里,,在NSIS脚本开始部分,修改以下行的内容:

How do I make the installation package install the TAP driver as “Hidden” per default?

Comment out the following line with a semicolon under the Function .onInit section:

SectionSetFlags ${SecTAPHidden} 0

How do I make the installation package install My Certificate Wizard per default?

Comment out the following line with a semicolon under the Function .onInit section:

SectionSetFlags ${SecMYCERT} 0

怎样才能将安装文件包里设置安装网卡设置为”隐藏”?
去掉.onInit功能块中下列行的注解即可:

怎样才能将安装文件包里设置默认勾选”个人验证向导”?
去掉.onInit功能块中下列行的注解即可:

相关推荐

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址