Merge branch 'fix_build.sh' of https://github.com/luizluca/easy-rsa into luizluca-fix_build.sh
This commit is contained in:
commit
d888dd1b23
@ -19,6 +19,9 @@ build-dist options:
|
|||||||
--dist-root=X set DIST_ROOT, default=dist-staging
|
--dist-root=X set DIST_ROOT, default=dist-staging
|
||||||
--src-root=X set SRC_ROOT for git src dir, default=.
|
--src-root=X set SRC_ROOT for git src dir, default=.
|
||||||
--bin-dest=X set BIN_DEST where to put tar/zip, default=.
|
--bin-dest=X set BIN_DEST where to put tar/zip, default=.
|
||||||
|
--no-windows do not build for win32
|
||||||
|
--no-unix do not build for UNIX
|
||||||
|
--no-compress do not create zip/tar
|
||||||
|
|
||||||
--dist-clean rm -rf the DIST_ROOT w/out prompts
|
--dist-clean rm -rf the DIST_ROOT w/out prompts
|
||||||
__EOF__
|
__EOF__
|
||||||
@ -37,8 +40,7 @@ note() { echo "build-dist NOTE: $1"; }
|
|||||||
# ask before dangerous things
|
# ask before dangerous things
|
||||||
confirm() {
|
confirm() {
|
||||||
[ "$2" ] && return
|
[ "$2" ] && return
|
||||||
echo "$1"
|
printf "%s y/n: " "$1"
|
||||||
printf " y/n: "
|
|
||||||
read r
|
read r
|
||||||
[ "$r" = "y" ] || die "user abort"
|
[ "$r" = "y" ] || die "user abort"
|
||||||
}
|
}
|
||||||
@ -48,10 +50,10 @@ main() {
|
|||||||
PV="$PRODUCT-$VERSION"
|
PV="$PRODUCT-$VERSION"
|
||||||
|
|
||||||
dist_clean
|
dist_clean
|
||||||
stage_unix
|
$SKIP_UNIX || stage_unix
|
||||||
stage_win
|
$SKIP_WIN || stage_win
|
||||||
make_tar
|
$SKIP_TAR || make_tar
|
||||||
make_zip
|
$SKIP_ZIP || make_zip
|
||||||
}
|
}
|
||||||
|
|
||||||
# prep DIST_ROOT
|
# prep DIST_ROOT
|
||||||
@ -70,15 +72,15 @@ stage_unix() {
|
|||||||
mkdir -p "$DIST_ROOT/unix/$PV"
|
mkdir -p "$DIST_ROOT/unix/$PV"
|
||||||
|
|
||||||
# Copy files into $PV, starting with easyrsa3 as the initial root dir
|
# Copy files into $PV, starting with easyrsa3 as the initial root dir
|
||||||
src_files="easyrsa3/ Licensing/ COPYING.md ChangeLog README.md README.quickstart.md"
|
src_files="easyrsa3/. Licensing/. COPYING.md ChangeLog README.md README.quickstart.md doc"
|
||||||
for f in $src_files
|
for f in $src_files
|
||||||
do
|
do
|
||||||
cp -a "$SRC_ROOT/$f" "$DIST_ROOT/unix/$PV" || die "failed to copy $f"
|
cp -R "$SRC_ROOT/$f" "$DIST_ROOT/unix/$PV/" || die "failed to copy $f"
|
||||||
done
|
done
|
||||||
|
|
||||||
cp -R "$SRC_ROOT/doc" "$DIST_ROOT/unix/$PV/" || die "failed to copy unix doc"
|
# FreeBSD does not accept -i without argument in a way also acceptable by GNU sed
|
||||||
|
sed -i.tmp -e "s/~VER~/$VERSION/" "$DIST_ROOT/unix/$PV/easyrsa" || die "Cannot update easyrsa version"
|
||||||
sed -i "" -e "s/~VER~/$VERSION/" "$DIST_ROOT/unix/$PV/easyrsa"
|
rm -f "$DIST_ROOT/unix/$PV/easyrsa.tmp"
|
||||||
|
|
||||||
# files not included
|
# files not included
|
||||||
rm -rf "$DIST_ROOT/unix/$PV/doc/TODO" || die "failed rm TODO"
|
rm -rf "$DIST_ROOT/unix/$PV/doc/TODO" || die "failed rm TODO"
|
||||||
@ -91,39 +93,28 @@ stage_win() {
|
|||||||
# make doc dir
|
# make doc dir
|
||||||
mkdir -p "$DIST_ROOT/windows/$PV/doc"
|
mkdir -p "$DIST_ROOT/windows/$PV/doc"
|
||||||
|
|
||||||
for f in $SRC_ROOT/doc/*.md;
|
for f in doc/*.md README.md README.quickstart.md COPYING.md;
|
||||||
do
|
do
|
||||||
fname=$(basename "$f" .md)
|
# FreeBSD does not accept -i without argument in a way also acceptable by GNU sed
|
||||||
sed -i "" -e "s/~~~/$VERSION/" "$SRC_ROOT/$f"
|
sed -i.tmp -e "s/~~~/$VERSION/" "$SRC_ROOT/$f" || die "Cannot update easyrsa version"
|
||||||
python -m markdown "$f" > "$DIST_ROOT/windows/$PV/doc/$fname.html"
|
rm -f "$SRC_ROOT/$f.tmp"
|
||||||
|
python -m markdown "$SRC_ROOT/$f" > "$DIST_ROOT/windows/$PV/${f%.md}.html" || die "Failed to convert markdown to HTML"
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in "README" "README.quickstart" "COPYING"
|
|
||||||
do
|
|
||||||
python -m markdown $SRC_ROOT/$f.md > $DIST_ROOT/windows/$PV/$f.html
|
|
||||||
done
|
|
||||||
# Copy files into $PV, starting with easyrsa3 as the initial root dir
|
# Copy files into $PV, starting with easyrsa3 as the initial root dir
|
||||||
src_files="easyrsa3/ ChangeLog COPYING.md"
|
src_files="easyrsa3/. ChangeLog COPYING.md Licensing distro/windows/Licensing distro/windows/bin"
|
||||||
for f in $src_files
|
for f in $src_files
|
||||||
do
|
do
|
||||||
cp -a "$SRC_ROOT/$f" "$DIST_ROOT/windows/$PV" || die "failed to copy $f"
|
cp -R "$SRC_ROOT/$f" "$DIST_ROOT/windows/$PV/" || die "failed to copy $f"
|
||||||
done
|
done
|
||||||
|
|
||||||
src_files="Licensing distro/windows/Licensing"
|
|
||||||
for f in $src_files
|
|
||||||
do
|
|
||||||
cp -R "$SRC_ROOT/$f" "$DIST_ROOT/windows/$PV" || die "failed to copy $f"
|
|
||||||
done
|
|
||||||
src_files="README-Windows.txt EasyRSA-Start.bat"
|
src_files="README-Windows.txt EasyRSA-Start.bat"
|
||||||
for f in $src_files
|
for f in $src_files
|
||||||
do
|
do
|
||||||
cp -a "$SRC_ROOT/distro/windows/$f" "$DIST_ROOT/windows/$PV" || die "failed to copy $f"
|
cp -R "$SRC_ROOT/distro/windows/$f" "$DIST_ROOT/windows/$PV/" || die "failed to copy $f"
|
||||||
unix2dos "$DIST_ROOT/windows/$PV/$f" || die "unix2dos conversion failed for $f"
|
unix2dos "$DIST_ROOT/windows/$PV/$f" || die "unix2dos conversion failed for $f"
|
||||||
done
|
done
|
||||||
|
|
||||||
# create bin dir with windows binaries
|
|
||||||
cp -v -R "$SRC_ROOT/distro/windows/bin" "$DIST_ROOT/windows/$PV/" || die "failed to copy bin"
|
|
||||||
|
|
||||||
# files not included
|
# files not included
|
||||||
rm -rf "$DIST_ROOT/windows/$PV/doc/TODO" || die "failed rm TODO"
|
rm -rf "$DIST_ROOT/windows/$PV/doc/TODO" || die "failed rm TODO"
|
||||||
|
|
||||||
@ -135,10 +126,14 @@ make_tar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_zip() {
|
make_zip() {
|
||||||
(cd "$DIST_ROOT/windows/"; zip -qr "../../$BIN_DEST/${PV}.zip" "$PV") || die "zip failed"
|
(cd "$DIST_ROOT/windows/"; zip -qr "$BIN_DEST/${PV}.zip" "$PV") || die "zip failed"
|
||||||
note "zip file created at: $BIN_DEST/${PV}.zip"
|
note "zip file created at: $BIN_DEST/${PV}.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SKIP_WIN=false
|
||||||
|
SKIP_UNIX=false
|
||||||
|
SKIP_ZIP=false
|
||||||
|
SKIP_TAR=false
|
||||||
# parse CLI options:
|
# parse CLI options:
|
||||||
while [ -n "$1" ]
|
while [ -n "$1" ]
|
||||||
do
|
do
|
||||||
@ -165,6 +160,18 @@ do
|
|||||||
--dist-clean)
|
--dist-clean)
|
||||||
DISTCLEAN=1
|
DISTCLEAN=1
|
||||||
;;
|
;;
|
||||||
|
--no-windows)
|
||||||
|
SKIP_WIN=true
|
||||||
|
SKIP_ZIP=true
|
||||||
|
;;
|
||||||
|
--no-unix)
|
||||||
|
SKIP_UNIX=true
|
||||||
|
SKIP_TAR=true
|
||||||
|
;;
|
||||||
|
--no-compress)
|
||||||
|
SKIP_ZIP=true
|
||||||
|
SKIP_TAR=true
|
||||||
|
;;
|
||||||
help|-h|--help|-help)
|
help|-h|--help|-help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user