lbry-sdk/packaging/ubuntu/ubuntu_package_setup.sh

62 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
# Tested on fresh Ubuntu 14.04 install.
# wget https://raw.githubusercontent.com/lbryio/lbry/master/packaging/ubuntu/ubuntu_package_setup.sh
# bash ubuntu_package_setup.sh master
set -euo pipefail
BRANCH=${1:-master}
# 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
# 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
}
PACKAGING_DIR='lbry/packaging/ubuntu'
addfile "$PACKAGING_DIR/lbry-uri-handler" usr/share/python/lbrynet/bin/lbry-uri-handler
addfile "$PACKAGING_DIR/lbry.desktop" usr/share/applications/lbry.desktop
#addfile lbry/packaging/ubuntu/lbry-init.conf etc/init/lbry.conf
# repackage .deb
tar -cvzf control.tar.gz -C control .
tar -cvJf data.tar.xz -C data .
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