2016-04-11 04:33:44 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tested on fresh Ubuntu 14.04 install.
|
|
|
|
|
|
|
|
# wget https://raw.githubusercontent.com/lbryio/lbry/master/packaging/ubuntu/ubuntu_package_setup.sh
|
2016-05-06 20:30:00 +02:00
|
|
|
# bash ubuntu_package_setup.sh [BRANCH] [WEB-UI-BRANCH]
|
2016-04-11 04:33:44 +02:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
BRANCH=${1:-master}
|
2016-05-20 18:13:58 +02:00
|
|
|
WEB_UI_BRANCH=${2:-master}
|
2016-04-11 04:33:44 +02:00
|
|
|
|
2016-04-13 00:50:47 +02:00
|
|
|
BUILD_DIR="lbry-build-$(date +%Y%m%d-%H%M%S)"
|
|
|
|
mkdir "$BUILD_DIR"
|
|
|
|
cd "$BUILD_DIR"
|
|
|
|
|
2016-04-11 04:33:44 +02:00
|
|
|
# get the required OS packages
|
|
|
|
sudo add-apt-repository -y ppa:spotify-jyrki/dh-virtualenv
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y build-essential git python-dev libffi-dev libssl-dev libgmp3-dev dh-virtualenv debhelper
|
|
|
|
|
|
|
|
# need a modern version of pip (more modern than ubuntu default)
|
|
|
|
wget https://bootstrap.pypa.io/get-pip.py
|
|
|
|
sudo python get-pip.py
|
|
|
|
rm get-pip.py
|
|
|
|
sudo pip install make-deb
|
|
|
|
|
|
|
|
# check out LBRY
|
|
|
|
git clone https://github.com/lbryio/lbry.git --branch "$BRANCH"
|
|
|
|
|
|
|
|
# build packages
|
|
|
|
(
|
|
|
|
cd lbry
|
|
|
|
make-deb
|
|
|
|
dpkg-buildpackage -us -uc
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
### insert our extra files
|
|
|
|
|
|
|
|
# extract .deb
|
|
|
|
PACKAGE="$(ls | grep '.deb')"
|
|
|
|
ar vx "$PACKAGE"
|
|
|
|
mkdir control data
|
|
|
|
tar -xvzf control.tar.gz --directory control
|
|
|
|
tar -xvJf data.tar.xz --directory data
|
|
|
|
|
2016-05-06 20:30:00 +02:00
|
|
|
PACKAGING_DIR='lbry/packaging/ubuntu'
|
|
|
|
|
|
|
|
# set web ui branch
|
2016-05-20 18:13:58 +02:00
|
|
|
sed -i "s/^WEB_UI_BRANCH='[^']\+'/WEB_UI_BRANCH='$WEB_UI_BRANCH'/" "$PACKAGING_DIR/lbry"
|
2016-05-06 20:30:00 +02:00
|
|
|
|
2016-04-11 04:33:44 +02:00
|
|
|
# add files
|
|
|
|
function addfile() {
|
|
|
|
FILE="$1"
|
|
|
|
TARGET="$2"
|
|
|
|
mkdir -p "$(dirname "data/$TARGET")"
|
|
|
|
cp "$FILE" "data/$TARGET"
|
|
|
|
echo "$(md5sum "data/$TARGET" | cut -d' ' -f1) $TARGET" >> control/md5sums
|
|
|
|
}
|
2016-04-13 00:50:47 +02:00
|
|
|
addfile "$PACKAGING_DIR/lbry" usr/share/python/lbrynet/bin/lbry
|
2016-04-11 04:33:44 +02:00
|
|
|
addfile "$PACKAGING_DIR/lbry.desktop" usr/share/applications/lbry.desktop
|
|
|
|
#addfile lbry/packaging/ubuntu/lbry-init.conf etc/init/lbry.conf
|
|
|
|
|
|
|
|
# repackage .deb
|
2016-04-13 00:50:47 +02:00
|
|
|
sudo chown -R root:root control data
|
2016-04-11 04:33:44 +02:00
|
|
|
tar -cvzf control.tar.gz -C control .
|
|
|
|
tar -cvJf data.tar.xz -C data .
|
2016-04-13 00:50:47 +02:00
|
|
|
sudo chown root:root debian-binary control.tar.gz data.tar.xz
|
2016-04-11 04:33:44 +02:00
|
|
|
ar r "$PACKAGE" debian-binary control.tar.gz data.tar.xz
|
|
|
|
|
|
|
|
# TODO: we can append to data.tar instead of extracting it all and recompressing
|