11#! /bin/bash
22
33# Easy-RSA 3 distribution packager:
4- # creates ready-to-use tarball files for Unixes
4+ # creates ready-to-use tarball files for Unixes and a zip file for windows
55
66# operational defaults (CLI processing overrides)
77VERSION=" git-development"
@@ -45,7 +45,8 @@ main() {
4545 PV=" $PRODUCT -$VERSION "
4646
4747 dist_clean
48- stage_files
48+ stage_unix
49+ stage_win
4950 make_tar
5051 make_zip
5152}
@@ -60,26 +61,71 @@ dist_clean() {
6061 mkdir -p " $DIST_ROOT " || die " dist_clean failed to mkdir"
6162}
6263
63- # file stager
64- stage_files () {
64+ # stage unix files
65+ stage_unix () {
66+ # make our unix stage if it doesn't exist
67+ mkdir -p " $DIST_ROOT /unix/$PV "
68+
6569 # Copy files into $PV, starting with easyrsa3 as the initial root dir
66- src_files=" easyrsa3/ Licensing/ doc/ COPYING ChangeLog README.quickstart.md"
70+ src_files=" easyrsa3/ Licensing/ COPYING ChangeLog README.quickstart.md"
6771 for f in $src_files
6872 do
69- cp -a " $SRC_ROOT /$f " " $DIST_ROOT /$PV " || die " failed to copy $f "
73+ cp -a " $SRC_ROOT /$f " " $DIST_ROOT /unix/ $PV " || die " failed to copy $f "
7074 done
75+
76+ cp -R $SRC_ROOT /doc $DIST_ROOT /unix/$PV / || die " failed to copy unix doc"
7177
7278 # files not included
73- rm -rf " $DIST_ROOT /$PV /doc/TODO" || die " failed rm TODO"
79+ rm -rf " $DIST_ROOT /unix/$PV /doc/TODO" || die " failed rm TODO"
80+ }
81+
82+ stage_win () {
83+ # make our windows stage if it doesn't exist
84+ mkdir -p " $DIST_ROOT /windows/$PV "
85+
86+ # make doc dir
87+ mkdir -p " $DIST_ROOT /windows/$PV /doc"
88+
89+ for f in ` ls $SRC_ROOT /doc/* .md` ;
90+ do
91+ fname=` basename -s .md $f `
92+ python -m markdown $f > $DIST_ROOT /windows/$PV /doc/$fname .html
93+ done
94+
95+ python -m markdown $SRC_ROOT /README.quickstart.md > $DIST_ROOT /windows/$PV /README.quickstart.html
96+ # Copy files into $PV, starting with easyrsa3 as the initial root dir
97+ src_files=" easyrsa3/ COPYING ChangeLog"
98+ for f in $src_files
99+ do
100+ cp -a " $SRC_ROOT /$f " " $DIST_ROOT /windows/$PV " || die " failed to copy $f "
101+ done
102+
103+ src_files=" Licensing distro/windows/Licensing"
104+ for f in $src_files
105+ do
106+ cp -R " $SRC_ROOT /$f " " $DIST_ROOT /windows/$PV " || die " failed to copy $f "
107+ done
108+ src_files=" README-Windows.txt EasyRSA-Start.bat"
109+ for f in $src_files
110+ do
111+ cp -a " $SRC_ROOT /distro/windows/$f " " $DIST_ROOT /windows/$PV " || die " failed to copy $f "
112+ done
113+
114+ # create bin dir with windows binaries
115+ cp -R " $SRC_ROOT /distro/windows/bin" " $DIST_ROOT /windows/$PV /" || die " failed to copy bin"
116+
117+ # files not included
118+ rm -rf " $DIST_ROOT /windows/$PV /doc/TODO" || die " failed rm TODO"
119+
74120}
75121
76122make_tar () {
77- (cd " $DIST_ROOT " ; tar cz " $PV " ) > " $BIN_DEST /${PV} .tgz" || die " tar failed"
123+ (cd " $DIST_ROOT /unix/ " ; tar cz " $PV " ) > " $BIN_DEST /${PV} .tgz" || die " tar failed"
78124 note " tarball created at: $BIN_DEST /${PV} .tgz"
79125}
80126
81127make_zip () {
82- (cd " $DIST_ROOT " ; zip -qr " ../$BIN_DEST /${PV} .zip" " $PV " ) || die " zip failed"
128+ (cd " $DIST_ROOT /windows/ " ; zip -qr " ../$BIN_DEST /${PV} .zip" " $PV " ) || die " zip failed"
83129 note " zip file created at: $BIN_DEST /${PV} .zip"
84130}
85131
0 commit comments