diff options
author | Kali Kaneko <kali@leap.se> | 2018-02-15 20:30:59 +0100 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2018-02-15 22:55:49 +0100 |
commit | bb00a1dfa75f1a9a0a9ff55afc0da3d6510ab613 (patch) | |
tree | b3a03f46fbaa9ce338d0d25e60ddad3fdd1f91b2 /pkg | |
parent | d798346948aff01051c59261f739cb720c18f0a6 (diff) |
[pkg] life is better among hunter-gatherers
aka, get *all* of the dynamic libraries into the bundle.
This probably won't work like this, but I think it's more comfortable to
strip libraries from the list rather than hunting for them one by one.
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/bundle_riseupvpn_from_docker | 21 | ||||
-rwxr-xr-x | pkg/hunter/gatherer | 36 |
2 files changed, 48 insertions, 9 deletions
diff --git a/pkg/bundle_riseupvpn_from_docker b/pkg/bundle_riseupvpn_from_docker index 4bac916e..8aec50c3 100644 --- a/pkg/bundle_riseupvpn_from_docker +++ b/pkg/bundle_riseupvpn_from_docker @@ -12,10 +12,13 @@ export SYSTRAY_SRC=/srv/go/src/0xacab.org/leap/bitmask-systray/ export GOPATH=/srv/go export CGO_CPPFLAGS="-I/usr/include" export CGO_LDFLAGS="-L/usr/lib -L/usr/lib/z86_64-linux-gnu -lzmq -lpthread -lsodium -lrt -lstdc++ -lm -lc -lgcc" +export BITMASK_HOME=${HOME}/bitmaskbuild echo "[+] building systray" cd ${SYSTRAY_SRC} git pull +# XXX FIXME ----- master is broken. +git checkout 352b8df go build . cd $HOME @@ -23,9 +26,12 @@ echo "[+] CLONING REPO from $REPO [$BRANCH]" rm -rf bitmaskbuild git clone --depth 1 --single-branch --branch $BRANCH $REPO bitmaskbuild cd bitmaskbuild -RELEASE=RiseupVPN-`cat pkg/next-version` -echo "[+] RELEASE: $RELEASE" git fetch --tags + +RELEASE=anonvpn-`cat pkg/next-version` +BRANDED=RiseupVPN-`cat pkg/next-version` + +echo "[+] RELEASE: $RELEASE" # uninstall bitmask-dev from base image and install bitmask-vpn pip uninstall --yes leap.bitmask pip install -e '.[vpn]' @@ -40,18 +46,14 @@ VIRTUAL_ENV=/usr/local make bundle_anonvpn_linux # copy systray binary and libs echo "[+] Copy systray binary" cp ${SYSTRAY_SRC}/bitmask-systray dist/${RELEASE}/lib/ -cp /usr/lib/x86_64-linux-gnu/libsodium.so.18 dist/${RELEASE}/lib/ -cp /usr/lib/x86_64-linux-gnu/libzmq.so.5.1.1 dist/${RELEASE}/lib/libzmq.so.5 -cp /usr/lib/x86_64-linux-gnu/libappindicator3.so.1 dist/${RELEASE}/lib/ -cp /usr/lib/x86_64-linux-gnu/libpng16.so.16 dist/${RELEASE}/lib/libpng.so.16 -cp /usr/lib/x86_64-linux-gnu/libz.so dist/${RELEASE}/lib/libz.so +# really, get all the things, and the kitchen sink... time to trim later on. +pkg/hunter/gatherer dist/${RELEASE}/lib/bitmask-systray dist/${RELEASE}/lib/ # copy assets -cp /src/leap/bitmask-systray/riseupvpn.svg dist/${RELEASE}/lib/riseupvpn.svg +cp ${SYSTRAY_SRC}/riseupvpn.svg dist/${RELEASE}/lib/riseupvpn.svg # trim some bytes rm dist/${RELEASE}/lib/pysqlcipher._sqlite.so -rm dist/${RELEASE}/lib/libzmq-0576c57a.so.5.0.2 rm dist/${RELEASE}/lib/libsqlite3.so.0 # rename entrypoint and put wrapper in place @@ -60,6 +62,7 @@ cd $HOME/bitmaskbuild/pkg/launcher && make cd $HOME/bitmaskbuild cp pkg/launcher/bitmask dist/${RELEASE}/RiseupVPN mv dist/${RELEASE}/lib/anonvpn dist/${RELEASE}/lib/bitmask +mv dist/${RELEASE} dist/${BRANDED} cp -r dist/* /dist echo "[+] DONE" diff --git a/pkg/hunter/gatherer b/pkg/hunter/gatherer new file mode 100755 index 00000000..5412748e --- /dev/null +++ b/pkg/hunter/gatherer @@ -0,0 +1,36 @@ +#!/bin/bash +# Author : Hemanth.HM +# Email : hemanth[dot]hm[at]gmail[dot]com +# License : GNU GPLv3 +# + +function useage() +{ + cat << EOU +Useage: bash $0 <path to the binary> <path to copy the dependencies> +EOU +exit 1 +} + +#Validate the inputs +[[ $# < 2 ]] && useage + +#Check if the paths are vaild +[[ ! -e $1 ]] && echo "Not a vaild input $1" && exit 1 +[[ -d $2 ]] || echo "No such directory $2 creating..."&& mkdir -p "$2" + +#Get the library dependencies +echo "Collecting the shared library dependencies for $1..." +deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1\ +~/^\//{print $1}$3~/^\//{print $3}'\ + | sed 's/,$/\n/') +echo "Copying the dependencies to $2" + +#Copy the deps +for dep in $deps +do + echo "Copying $dep to $2" + cp "$dep" "$2" +done + +echo "Done!" |