| ... | ... |
@@ -10,9 +10,6 @@ GUI="$OPENVPN_GUI_DIR/$OPENVPN_GUI" |
| 10 | 10 |
if [ -f "$GUI" ]; then |
| 11 | 11 |
mkdir -p $GENOUT/bin &>/dev/null |
| 12 | 12 |
cp $GUI $GENOUT/bin |
| 13 |
- if [ -d "$SIGNTOOL" ]; then |
|
| 14 |
- TARGET_EXE="$GENOUT/bin/$OPENVPN_GUI" $SIGNTOOL/signexe |
|
| 15 |
- fi |
|
| 16 | 13 |
fi |
| 17 | 14 |
|
| 18 | 15 |
if [ -f "$GENOUT/bin/$OPENVPN_GUI" ]; then |
| ... | ... |
@@ -19,12 +19,6 @@ if [ -d "$OPENVPN_XGUI_DIR" ]; then |
| 19 | 19 |
done |
| 20 | 20 |
fi |
| 21 | 21 |
|
| 22 |
- for f in $SIGNED_EXES; do |
|
| 23 |
- if [ -d "$SIGNTOOL" ]; then |
|
| 24 |
- TARGET_EXE="$GENOUT/bin/`basename $f`" $SIGNTOOL/signexe |
|
| 25 |
- fi |
|
| 26 |
- done |
|
| 27 |
- |
|
| 28 | 22 |
rm -rf $GENOUT/htdocs |
| 29 | 23 |
cp -a $OPENVPN_XGUI_DIR/ajax/htdocs $GENOUT/htdocs |
| 30 | 24 |
|
| ... | ... |
@@ -1,101 +1,17 @@ |
| 1 | 1 |
#!/bin/sh |
| 2 | 2 |
|
| 3 |
-# Build the x86 and x64 versions of the TAP driver |
|
| 4 |
-# Requires the Windows DDK |
|
| 3 |
+# Get the x86 and x64 versions of the TAP driver |
|
| 5 | 4 |
|
| 6 | 5 |
# get version.nsi definitions |
| 7 | 6 |
. autodefs/defs.sh |
| 8 | 7 |
|
| 9 |
-if [ -n "$DDKVER" ] && [ -d "/c/WINDDK/$DDKVER" ] ; then |
|
| 10 |
- |
|
| 11 |
-# common declarations for all DDK build targets |
|
| 12 |
-. install-win32/ddk-common |
|
| 13 |
- |
|
| 14 |
-# configure tap driver sources |
|
| 15 |
-MACRO="perl install-win32/macro.pl autodefs/defs.in" |
|
| 16 |
-IFDEF="perl install-win32/ifdef.pl" |
|
| 17 |
-rm -rf tap-win32/amd64 |
|
| 18 |
-mkdir tap-win32/amd64 |
|
| 19 |
-$MACRO <tap-win32/SOURCES.in >tap-win32/SOURCES |
|
| 20 |
-$MACRO <tap-win32/i386/OemWin2k.inf.in | $IFDEF >tap-win32/i386/OemWin2k.inf |
|
| 21 |
-$MACRO <tap-win32/i386/OemWin2k.inf.in | $IFDEF -DAMD64 >tap-win32/amd64/OemWin2k.inf |
|
| 22 |
- |
|
| 23 |
-if [ -n "$PRODUCT_TAP_DEBUG" ] ; then |
|
| 24 |
- w2ktarget="w2k c" |
|
| 25 |
- amdtarget="chk $x64_tag WNET" |
|
| 26 |
-else |
|
| 27 |
- w2ktarget="w2k f" |
|
| 28 |
- amdtarget="fre $x64_tag WNET" |
|
| 29 |
-fi |
|
| 30 |
- |
|
| 31 |
-if [ -z "$DRVBINSRC" ] ; then |
|
| 32 |
- if [ -n "$TAP_BIN_AMD64" ]; then |
|
| 33 |
- amdtarget="" |
|
| 34 |
- fi |
|
| 35 |
- |
|
| 36 |
- cd tap-win32 |
|
| 37 |
- t=`pwd` |
|
| 38 |
- cd .. |
|
| 39 |
- |
|
| 40 |
- for mode in "$w2ktarget" "$amdtarget"; do |
|
| 41 |
- echo '**********' build TAP $mode |
|
| 42 |
- cmd //c "C:\\WINDDK\\$DDKVER\\bin\\setenv.bat C:\\WINDDK\\$DDKVER $mode && cd `perl install-win32/dosname.pl $t` && build -cef" |
|
| 43 |
- mv tap-win32/tapdrvr.cod "tap-win32/tapdrvr-$(echo $mode | tr ' ' '-').cod" |
|
| 8 |
+if [ -d "$TAPBINSRC" ]; then |
|
| 9 |
+ mkdir -p $GENOUT/driver/i386 &>/dev/null |
|
| 10 |
+ mkdir -p $GENOUT/driver/amd64 &>/dev/null |
|
| 11 |
+ for arch in i386 amd64; do |
|
| 12 |
+ s=$TAPBINSRC/$arch |
|
| 13 |
+ cp $s/*.sys $s/*.cat $s/*.inf $GENOUT/driver/$arch |
|
| 44 | 14 |
done |
| 45 |
- |
|
| 46 |
- title openvpn-build &>/dev/null |
|
| 47 |
- |
|
| 48 |
- if [ -n "$TAP_BIN_AMD64" ]; then |
|
| 49 |
- mkdir -p $t/amd64 |
|
| 50 |
- cp "$TAP_BIN_AMD64" $t/amd64 |
|
| 51 |
- fi |
|
| 52 |
- |
|
| 53 |
- # copy driver files into tap-win32/dist |
|
| 54 |
- cd tap-win32 |
|
| 55 |
- rm -rf dist |
|
| 56 |
- mkdir dist |
|
| 57 |
- cd dist |
|
| 58 |
- mkdir i386 |
|
| 59 |
- mkdir amd64 |
|
| 60 |
- cd i386 |
|
| 61 |
- x86=`pwd` |
|
| 62 |
- cd ../amd64 |
|
| 63 |
- x64=`pwd` |
|
| 64 |
- cd ../.. |
|
| 65 |
- cp i386/OemWin2k.inf $x86 |
|
| 66 |
- cp i386/*.sys $x86 |
|
| 67 |
- cp amd64/OemWin2k.inf $x64 |
|
| 68 |
- cp amd64/*.sys $x64 |
|
| 69 |
- out="TAP driver catalog file is undefined"; |
|
| 70 |
- echo "$out" >$x86/$PRODUCT_TAP_ID.cat |
|
| 71 |
- echo "$out" >$x64/$PRODUCT_TAP_ID.cat |
|
| 72 |
- cd .. |
|
| 73 |
-fi |
|
| 74 |
- |
|
| 75 |
-# $DRVBINSRC, if defined, points to prebuilt TAP driver and |
|
| 76 |
-# tapinstall.exe. |
|
| 77 |
-mkdir $GENOUT &>/dev/null |
|
| 78 |
-rm -rf $GENOUT/driver |
|
| 79 |
-if [ -z "$DRVBINSRC" ] ; then |
|
| 80 |
- # Get TAP drivers |
|
| 81 |
- cp -a tap-win32/dist $GENOUT/driver |
|
| 82 |
- |
|
| 83 |
- # Sign TAP drivers |
|
| 84 |
- if [ -d "$SIGNTOOL" ]; then |
|
| 85 |
- $SIGNTOOL/signtap |
|
| 86 |
- fi |
|
| 87 |
-else |
|
| 88 |
- cp -a $DRVBINSRC/driver $GENOUT/driver |
|
| 89 |
-fi |
|
| 90 |
- |
|
| 91 |
-# $DRVBINDEST, if defined, points to a destination directory |
|
| 92 |
-# where TAP driver and tapinstall.exe will be saved, to be used |
|
| 93 |
-# as a $DRVBINSRC in future builds. |
|
| 94 |
-if [ -n "$DRVBINDEST" ] ; then |
|
| 95 |
- mkdir $DRVBINDEST &>/dev/null |
|
| 96 |
- cp -a $GENOUT/driver $DRVBINDEST |
|
| 97 |
-fi |
|
| 98 |
- |
|
| 99 | 15 |
else |
| 100 |
- echo Not building TAP driver -- DDK version $DDKVER NOT FOUND |
|
| 16 |
+ echo Cannot find pre-built tap drivers |
|
| 101 | 17 |
fi |
| ... | ... |
@@ -1,77 +1,15 @@ |
| 1 | 1 |
#!/bin/sh |
| 2 | 2 |
|
| 3 |
-# Build the x86 and x64 versions of the tapinstall tool |
|
| 4 |
-# Requires the Windows DDK. |
|
| 5 |
-# TISRC should be set to directory containing |
|
| 6 |
-# tapinstall source code. |
|
| 3 |
+# Get the x86 and x64 versions of the tapinstall tool |
|
| 7 | 4 |
|
| 8 | 5 |
# get version.nsi definitions |
| 9 | 6 |
. autodefs/defs.sh |
| 10 | 7 |
|
| 11 |
-if [ -n "$DDKVER" ] && [ -d "/c/WINDDK/$DDKVER" ] ; then |
|
| 12 |
- |
|
| 13 |
-if ! [ -d "$TISRC" ] ; then |
|
| 14 |
- echo "$TISRC" NOT INSTALLED |
|
| 15 |
- exit 1 |
|
| 16 |
-fi |
|
| 17 |
- |
|
| 18 |
-# common declarations for all DDK build targets |
|
| 19 |
-. install-win32/ddk-common |
|
| 20 |
- |
|
| 21 |
-amdtarget="" |
|
| 22 |
-if [ -z "$TI_BIN_AMD64" ]; then |
|
| 23 |
- amdtarget="fre $x64_tag WNET" |
|
| 24 |
-fi |
|
| 25 |
- |
|
| 26 |
-if [ -z "$DRVBINSRC" ] ; then |
|
| 27 |
- rm -rf tapinstall |
|
| 28 |
- cp -a "$TISRC" tapinstall |
|
| 29 |
- |
|
| 30 |
- if [ -e tapinstall/sources.in ]; then |
|
| 31 |
- perl install-win32/ifdef.pl autodefs/defs.in <tapinstall/sources.in >tapinstall/sources |
|
| 32 |
- fi |
|
| 33 |
- |
|
| 34 |
- cd tapinstall |
|
| 35 |
- t=`pwd` |
|
| 36 |
- cd .. |
|
| 37 |
- |
|
| 38 |
- for mode in "w2k f" "$amdtarget"; do |
|
| 39 |
- if [ -n "$mode" ]; then |
|
| 40 |
- echo '**********' build TAPINSTALL $mode |
|
| 41 |
- cmd //c "C:\\WINDDK\\$DDKVER\\bin\\setenv.bat C:\\WINDDK\\$DDKVER $mode && cd `perl install-win32/dosname.pl $t` && build -cef" |
|
| 42 |
- fi |
|
| 43 |
- done |
|
| 44 |
-fi |
|
| 45 |
- |
|
| 46 |
-if [ -n "$TI_BIN_AMD64" ]; then |
|
| 47 |
- mkdir -p $t/objfre_wnet_amd64/amd64 |
|
| 48 |
- cp "$TI_BIN_AMD64" $t/objfre_wnet_amd64/amd64 |
|
| 49 |
-fi |
|
| 50 |
- |
|
| 51 |
-# $DRVBINSRC, if defined, points to prebuilt TAP driver and |
|
| 52 |
-# tapinstall.exe. |
|
| 53 |
-if [ -z "$DRVBINSRC" ] ; then |
|
| 54 |
- # Get tapinstall |
|
| 8 |
+if [ -d "$TAPBINSRC" ]; then |
|
| 55 | 9 |
mkdir -p $GENOUT/tapinstall/i386 &>/dev/null |
| 56 | 10 |
mkdir -p $GENOUT/tapinstall/amd64 &>/dev/null |
| 57 |
- cp tapinstall/objfre_w2k_x86/i386/tapinstall.exe $GENOUT/tapinstall/i386 |
|
| 58 |
- cp tapinstall/objfre_wnet_amd64/amd64/tapinstall.exe $GENOUT/tapinstall/amd64 |
|
| 59 |
-else |
|
| 60 |
- mkdir $GENOUT &>/dev/null |
|
| 61 |
- cp -a $DRVBINSRC/tapinstall $GENOUT/tapinstall |
|
| 62 |
-fi |
|
| 63 |
- |
|
| 64 |
-# $DRVBINDEST, if defined, points to a destination directory |
|
| 65 |
-# where TAP driver and tapinstall.exe will be saved, to be used |
|
| 66 |
-# as a $DRVBINSRC in future builds. |
|
| 67 |
-if [ -n "$DRVBINDEST" ] ; then |
|
| 68 |
- mkdir $DRVBINDEST &>/dev/null |
|
| 69 |
- cp -a $GENOUT/driver $DRVBINDEST |
|
| 70 |
- cp -a $GENOUT/tapinstall $DRVBINDEST |
|
| 71 |
-fi |
|
| 72 |
- |
|
| 73 |
-title openvpn-build &>/dev/null |
|
| 74 |
- |
|
| 11 |
+ cp $TAPBINSRC/i386/tapinstall.exe $GENOUT/tapinstall/i386 |
|
| 12 |
+ cp $TAPBINSRC/amd64/tapinstall.exe $GENOUT/tapinstall/amd64 |
|
| 75 | 13 |
else |
| 76 |
- echo Not building tapinstall -- DDK version $DDKVER NOT BUILT |
|
| 14 |
+ echo Cannot find pre-built tapinstall |
|
| 77 | 15 |
fi |
| ... | ... |
@@ -27,42 +27,19 @@ |
| 27 | 27 |
!define PKCS11_HELPER_DIR "../pkcs11-helper" |
| 28 | 28 |
;!define DMALLOC_DIR "../dmalloc-5.4.2" |
| 29 | 29 |
|
| 30 |
+# Prebuilt TAP drivers and tapinstall |
|
| 31 |
+!define TAPBINSRC "../tap_dist" |
|
| 32 |
+ |
|
| 33 |
+# Directory containing python script for signing .exe files |
|
| 34 |
+!define SIGNTOOL "../signtool" |
|
| 35 |
+ |
|
| 30 | 36 |
# Optional directory of prebuilt OpenVPN binary components, |
| 31 | 37 |
# to be used as a source when build-from-scratch prerequisites |
| 32 | 38 |
# are not met. |
| 33 | 39 |
;!define GENOUT_PREBUILT "../gen-prebuilt" |
| 34 | 40 |
|
| 35 |
-# tapinstall.exe source code. |
|
| 36 |
-# Not needed if DRVBINSRC is defined |
|
| 37 |
-# (or if using pre-built mode). |
|
| 38 |
-!define TISRC "../tapinstall/5600" |
|
| 39 |
- |
|
| 40 |
-# TAP Adapter parameters. Note that PRODUCT_TAP_ID is |
|
| 41 |
-# defined in version.m4. |
|
| 42 |
-!define PRODUCT_TAP_DEVICE_DESCRIPTION "TAP-Win32 Adapter V9" |
|
| 43 |
-!define PRODUCT_TAP_PROVIDER "TAP-Win32 Provider V9" |
|
| 44 |
-!define PRODUCT_TAP_MAJOR_VER 9 |
|
| 45 |
-!define PRODUCT_TAP_MINOR_VER 7 |
|
| 46 |
-!define PRODUCT_TAP_RELDATE "04/19/2010" |
|
| 47 |
- |
|
| 48 |
-# TAP adapter icon -- visible=0x81 or hidden=0x89 |
|
| 49 |
-!define PRODUCT_TAP_CHARACTERISTICS 0x81 |
|
| 50 |
- |
|
| 51 |
-# Build debugging version of TAP driver |
|
| 52 |
-;!define PRODUCT_TAP_DEBUG |
|
| 53 |
- |
|
| 54 |
-# DDK Version. |
|
| 55 |
-# DDK distribution is assumed to be in C:\WINDDK\${DDKVER}
|
|
| 56 |
-!define DDKVER 6001.18002 |
|
| 57 |
-!define DDKVER_MAJOR 6001 |
|
| 58 |
- |
|
| 59 |
-# Code Signing. |
|
| 60 |
-# If undefined, don't sign any files. |
|
| 61 |
-!define SIGNTOOL "../signtool.old" |
|
| 62 |
-!define PRODUCT_SIGN_CN "openvpn" |
|
| 63 |
- |
|
| 64 | 41 |
# -j parameter passed to make |
| 65 |
-!define MAKE_JOBS 2 |
|
| 42 |
+!define MAKE_JOBS 1 |
|
| 66 | 43 |
|
| 67 | 44 |
# output directory for built binaries |
| 68 | 45 |
# and other generated files |
| ... | ... |
@@ -2,9 +2,13 @@ import os |
| 2 | 2 |
from wb import system, home_fn, choose_arch |
| 3 | 3 |
|
| 4 | 4 |
def build_ddk(config, dir, x64): |
| 5 |
- setenv_bat = os.path.realpath(os.path.join(config['DDK_PATH'], 'bin/setenv.bat')) |
|
| 5 |
+ ddk_path = config['DDK_PATH'] |
|
| 6 | 6 |
ddk_major = int(config['DDKVER_MAJOR']) |
| 7 | 7 |
debug = 'PRODUCT_TAP_DEBUG' in config |
| 8 |
+ return build_tap(ddk_path, ddk_major, debug, dir, x64) |
|
| 9 |
+ |
|
| 10 |
+def build_tap(ddk_path, ddk_major, debug, dir, x64): |
|
| 11 |
+ setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat')) |
|
| 8 | 12 |
target = 'chk' if debug else 'fre' |
| 9 | 13 |
if x64: |
| 10 | 14 |
target += ' x64' |
| ... | ... |
@@ -23,7 +27,7 @@ def build_ddk(config, dir, x64): |
| 23 | 23 |
|
| 24 | 24 |
system('cmd /c "%s %s %s && cd %s && build -cef"' % (
|
| 25 | 25 |
setenv_bat, |
| 26 |
- os.path.realpath(config['DDK_PATH']), |
|
| 26 |
+ os.path.realpath(ddk_path), |
|
| 27 | 27 |
target, |
| 28 | 28 |
dir |
| 29 | 29 |
)) |
| 53 | 56 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,129 @@ |
| 0 |
+import sys, os, shutil |
|
| 1 |
+from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp |
|
| 2 |
+if 'SIGNTOOL' in config: |
|
| 3 |
+ sys.path.append(home_fn(config['SIGNTOOL'])) |
|
| 4 |
+from signtool import SignTool |
|
| 5 |
+from build_ddk import build_tap |
|
| 6 |
+ |
|
| 7 |
+ti_dir = "c:/src/tapinstall" |
|
| 8 |
+hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64"))
|
|
| 9 |
+low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",))
|
|
| 10 |
+dest_top = home_fn('tap_build')
|
|
| 11 |
+dist = home_fn(config['TAP_DIST']) |
|
| 12 |
+ |
|
| 13 |
+def copy_tap(src, dest, x64): |
|
| 14 |
+ dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64])
|
|
| 15 |
+ mkdir_silent(dest) |
|
| 16 |
+ for dirpath, dirnames, filenames in os.walk(dir): |
|
| 17 |
+ for f in filenames: |
|
| 18 |
+ root, ext = os.path.splitext(f) |
|
| 19 |
+ if ext in ('.inf', '.cat', '.sys'):
|
|
| 20 |
+ cp(os.path.join(dir, f), dest) |
|
| 21 |
+ break |
|
| 22 |
+ |
|
| 23 |
+def copy_tapinstall(src, dest, x64): |
|
| 24 |
+ base = { False : 'i386', True: 'amd64' }[x64]
|
|
| 25 |
+ mkdir_silent(dest) |
|
| 26 |
+ for dirpath, dirnames, filenames in os.walk(home_fn(src)): |
|
| 27 |
+ for f in filenames: |
|
| 28 |
+ if f == 'tapinstall.exe': |
|
| 29 |
+ dir_name = os.path.basename(dirpath) |
|
| 30 |
+ s = os.path.join(dirpath, f) |
|
| 31 |
+ if dir_name == base: |
|
| 32 |
+ cp(s, dest) |
|
| 33 |
+ |
|
| 34 |
+def main(): |
|
| 35 |
+ rm_rf(dest_top) |
|
| 36 |
+ os.mkdir(dest_top) |
|
| 37 |
+ |
|
| 38 |
+ rm_rf(dist) |
|
| 39 |
+ os.mkdir(dist) |
|
| 40 |
+ |
|
| 41 |
+ for ver in hi, low: |
|
| 42 |
+ top = os.path.join(dest_top, str(ver[1])) |
|
| 43 |
+ os.mkdir(top) |
|
| 44 |
+ tap_dest = os.path.join(top, "tap-win32") |
|
| 45 |
+ ti_dest = os.path.join(top, "tapinstall") |
|
| 46 |
+ ti_src = os.path.join(ti_dir, str(ver[2])) |
|
| 47 |
+ shutil.copytree(home_fn("tap-win32"), tap_dest)
|
|
| 48 |
+ shutil.copytree(ti_src, ti_dest) |
|
| 49 |
+ |
|
| 50 |
+ i386 = os.path.join(tap_dest, "i386") |
|
| 51 |
+ amd64 = os.path.join(tap_dest, "amd64") |
|
| 52 |
+ |
|
| 53 |
+ build_amd64 = (len(ver[3]) >= 2) |
|
| 54 |
+ |
|
| 55 |
+ build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h'))
|
|
| 56 |
+ |
|
| 57 |
+ st = SignTool(config, tap_dest) |
|
| 58 |
+ |
|
| 59 |
+ preprocess(config, |
|
| 60 |
+ in_fn=os.path.join(tap_dest, 'SOURCES.in'), |
|
| 61 |
+ out_fn=os.path.join(tap_dest, 'SOURCES'), |
|
| 62 |
+ quote_begin='@@', |
|
| 63 |
+ quote_end='@@', |
|
| 64 |
+ head_comment='# %s\n\n' % autogen) |
|
| 65 |
+ |
|
| 66 |
+ preprocess(config, |
|
| 67 |
+ in_fn=os.path.join(i386, 'OemWin2k.inf.in'), |
|
| 68 |
+ out_fn=os.path.join(i386, 'OemWin2k.inf'), |
|
| 69 |
+ quote_begin='@@', |
|
| 70 |
+ quote_end='@@', |
|
| 71 |
+ if_prefix='!', |
|
| 72 |
+ head_comment='; %s\n\n' % autogen) |
|
| 73 |
+ |
|
| 74 |
+ preprocess(config, |
|
| 75 |
+ in_fn=os.path.join(ti_dest, 'sources.in'), |
|
| 76 |
+ out_fn=os.path.join(ti_dest, 'sources'), |
|
| 77 |
+ if_prefix='!', |
|
| 78 |
+ head_comment='# %s\n\n' % autogen) |
|
| 79 |
+ |
|
| 80 |
+ build_tap(ddk_path=ver[0], |
|
| 81 |
+ ddk_major=ver[1], |
|
| 82 |
+ debug=False, |
|
| 83 |
+ dir=tap_dest, |
|
| 84 |
+ x64=False) |
|
| 85 |
+ |
|
| 86 |
+ st.sign_verify(x64=False) |
|
| 87 |
+ |
|
| 88 |
+ build_tap(ddk_path=ver[0], |
|
| 89 |
+ ddk_major=ver[1], |
|
| 90 |
+ debug=False, |
|
| 91 |
+ dir=ti_dest, |
|
| 92 |
+ x64=False) |
|
| 93 |
+ |
|
| 94 |
+ tap_dist = os.path.join(dist, ver[3][0]) |
|
| 95 |
+ |
|
| 96 |
+ copy_tap(tap_dest, tap_dist, x64=False) |
|
| 97 |
+ copy_tapinstall(ti_dest, tap_dist, x64=False) |
|
| 98 |
+ |
|
| 99 |
+ if build_amd64: |
|
| 100 |
+ os.mkdir(amd64) |
|
| 101 |
+ preprocess(dict_def(config, [('AMD64', '1')]),
|
|
| 102 |
+ in_fn=os.path.join(i386, 'OemWin2k.inf.in'), |
|
| 103 |
+ out_fn=os.path.join(amd64, 'OemWin2k.inf'), |
|
| 104 |
+ quote_begin='@@', |
|
| 105 |
+ quote_end='@@', |
|
| 106 |
+ if_prefix='!', |
|
| 107 |
+ head_comment='; %s\n\n' % autogen) |
|
| 108 |
+ |
|
| 109 |
+ build_tap(ddk_path=ver[0], |
|
| 110 |
+ ddk_major=ver[1], |
|
| 111 |
+ debug=False, |
|
| 112 |
+ dir=tap_dest, |
|
| 113 |
+ x64=True) |
|
| 114 |
+ |
|
| 115 |
+ build_tap(ddk_path=ver[0], |
|
| 116 |
+ ddk_major=ver[1], |
|
| 117 |
+ debug=False, |
|
| 118 |
+ dir=ti_dest, |
|
| 119 |
+ x64=True) |
|
| 120 |
+ |
|
| 121 |
+ st.sign_verify(x64=True) |
|
| 122 |
+ |
|
| 123 |
+ tap_dist_x64 = os.path.join(dist, ver[3][1]) |
|
| 124 |
+ |
|
| 125 |
+ copy_tap(tap_dest, tap_dist_x64, x64=True) |
|
| 126 |
+ copy_tapinstall(ti_dest, tap_dist_x64, x64=True) |
|
| 127 |
+ |
|
| 128 |
+main() |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
# Python module containing general build functions |
| 2 | 2 |
# for OpenVPN on Windows |
| 3 | 3 |
|
| 4 |
-import os, re, shutil |
|
| 4 |
+import os, re, shutil, stat |
|
| 5 | 5 |
|
| 6 | 6 |
autogen = "Automatically generated by OpenVPN Windows build system" |
| 7 | 7 |
|
| ... | ... |
@@ -182,4 +182,34 @@ def cp(src, dest, dest_is_dir=True): |
| 182 | 182 |
print "COPY %s %s" % (src, dest) |
| 183 | 183 |
shutil.copyfile(src, dest) |
| 184 | 184 |
|
| 185 |
+def rm_rf(path): |
|
| 186 |
+ try: |
|
| 187 |
+ shutil.rmtree(path, onerror=onerror) |
|
| 188 |
+ except: |
|
| 189 |
+ pass |
|
| 190 |
+ |
|
| 191 |
+def onerror(func, path, exc_info): |
|
| 192 |
+ """ |
|
| 193 |
+ Error handler for ``shutil.rmtree``. |
|
| 194 |
+ |
|
| 195 |
+ If the error is due to an access error (read only file) |
|
| 196 |
+ it attempts to add write permission and then retries. |
|
| 197 |
+ |
|
| 198 |
+ If the error is for another reason it re-raises the error. |
|
| 199 |
+ |
|
| 200 |
+ Usage : ``shutil.rmtree(path, onerror=onerror)`` |
|
| 201 |
+ """ |
|
| 202 |
+ if not os.access(path, os.W_OK): |
|
| 203 |
+ # Is the error an access error ? |
|
| 204 |
+ os.chmod(path, stat.S_IWUSR) |
|
| 205 |
+ func(path) |
|
| 206 |
+ else: |
|
| 207 |
+ raise |
|
| 208 |
+ |
|
| 209 |
+def mkdir_silent(dir): |
|
| 210 |
+ try: |
|
| 211 |
+ os.mkdir(dir) |
|
| 212 |
+ except: |
|
| 213 |
+ pass |
|
| 214 |
+ |
|
| 185 | 215 |
config = get_config() |