Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/base64
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env perl

use strict;
use warnings;

use MIME::Base64 qw(encode_base64);

local($/) = undef;
print encode_base64(<STDIN>, ""), "\n";
21 changes: 16 additions & 5 deletions bin/create-tool
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#! /usr/bin/env bash
#set -x

version=0.3.5
Expand Down Expand Up @@ -27,6 +27,9 @@ case `uname -s` in
Darwin)
OS_TYPE=Darwin ## Apple OS X
;;
OpenBSD)
OS_TYPE=OpenBSD
;;
AIX)
OS_TYPE=AIX
;;
Expand Down Expand Up @@ -65,7 +68,11 @@ fill_tool_var () {
if (OS == "Darwin") {
"base64 -b 0 < " tmpl | getline b64;
} else {
"base64 -w 0 < " tmpl | getline b64;
if (OS == "OpenBSD") {
"./bin/base64 < " tmpl | getline b64;
} else {
"base64 -w 0 < " tmpl | getline b64;
}
}
printf("%s\"\n", b64)
} else { print } }' $dest > $temp
Expand Down Expand Up @@ -99,7 +106,7 @@ add_warning () {
}

compress_tool () {
echo "#! /bin/bash" > $temp
echo "#! /usr/bin/env bash" > $temp
echo "#set -x" >> $temp
echo >> $temp
add_warning >> $temp
Expand All @@ -113,7 +120,11 @@ compress_tool () {
if [ $OS_TYPE = Darwin ]; then
gzip --best --stdout $dest | base64 -b 0 >> $temp
else
gzip --best --stdout $dest | base64 -w 0 >> $temp
if [ $OS_TYPE = OpenBSD ]; then
gzip --best --stdout $dest | ./bin/base64 -w 0 >> $temp
else
gzip --best --stdout $dest | base64 -w 0 >> $temp
fi
fi
#printf "\"\n" >> $temp

Expand Down Expand Up @@ -152,7 +163,7 @@ run () {
echo
echo "Extracting file ..."
tmp=/tmp/\`date "+%Y%d%m%H%M%S_lfetool"\`
echo "#! /bin/bash" > \$tmp
echo "#! /usr/bin/env bash" > \$tmp
echo "" >> \$tmp
add_warning >> \$tmp
echo "" >> \$tmp
Expand Down
Loading