diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..a8c2e8de6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "packaging/osx/lbry-osx-app"] + path = packaging/osx/lbry-osx-app + url = https://github.com/jobevers/lbry-osx-app.git diff --git a/INSTALL.md b/INSTALL.md index 6dc552bcf..23491e60c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,19 +1,35 @@ -#### Installing lbrynet on Linux +#### Installing the LBRY app -------------------------- -The following packages are necessary (the following are their names on Ubuntu): -libgmp3-dev build-essential python2.7 python2.7-dev python-pip +Installing LBRY is simple. You can get a dmg installer for OS X (Mavericks and up) or a .deb for linux [here](https://lbry.io/get). -To install them on Ubuntu: -sudo apt-get install libgmp3-dev build-essential python2.7 python2.7-dev python-pip +##### OS X +Just drag and drop LBRY.app into your applications folder (replacing any older versions). When it's running you'll have a LBRY icon in your status bar. -python setup.py build bdist_egg -sudo python setup.py install -``` +##### Linux +Double click the .deb file and follow the prompts. The app can be started by searching "LBRY", and it can be turned off by clicking the red 'x' in the browser interface. -this will install all of the libraries and a few applications +On both systems you can also open the UI while the app is running by going to lbry://lbry in Firefox or Safari, or localhost:5279 in Chrome. -For running the file sharing application, see [RUNNING](RUNNING.md) + + +#### Installing LBRY command line +-------------------------- + +##### OS X +You can install LBRY command line by running `curl -sL https://rawgit.com/lbryio/lbry-setup/master/lbry_setup_osx.sh | sudo bash` in a terminal. This script will install lbrynet and its dependancies, as well as the app. You can start LBRY by either starting the app or by running `lbrynet-daemon` from a terminal. + +##### Linux +On Ubuntu or Mint you can install the prerequisites and lbrynet by running + + ``` + sudo apt-get install libgmp3-dev build-essential python2.7 python2.7-dev python-pip + git clone https://github.com/lbryio/lbry.git + cd lbry + sudo python setup.py install + ``` + +To start LBRY, run `lbrynet-daemon` in a terminal. #### On windows: diff --git a/README.md b/README.md index dc8b5c81f..cd1693811 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ +[![Build Status](https://travis-ci.org/lbryio/lbry.svg?branch=master)](https://travis-ci.org/lbryio/lbry) + # LBRYnet LBRYnet is a fully decentralized network for distributing data. It consists of peers uploading and downloading data from other peers, possibly in exchange for payments, and a distributed hash table, used by peers to discover other peers. +## Installation + +Download the [latest release](https://github.com/lbryio/lbry/releases/latest) or see [INSTALL.md](INSTALL.md) for manual installation. + ## Overview On LBRYnet, data is broken into chunks, and each chunk is specified by its sha384 hash sum. This @@ -18,9 +24,9 @@ help peers find each other. For example, an application for which clients don't necessary chunks may use some identifier, chosen by the application, to find clients which do know all of the necessary chunks. -## Running +## For Developers -LBRYnet comes with an file sharing application, called 'lbrynet-console', which breaks +LBRY comes with an file sharing application, called 'lbrynet-console', which breaks files into chunks, encrypts them with a symmetric key, computes their sha384 hash sum, generates a special file called a 'stream descriptor' containing the hash sums and some other file metadata, and makes the chunks available for download by other peers. A peer wishing to download the file @@ -28,22 +34,19 @@ must first obtain the 'stream descriptor' and then may open it with his 'lbrynet download all of the chunks by locating peers with the chunks via the DHT, and then combine the chunks into the original file, according to the metadata included in the 'stream descriptor'. -To install and use this client, see [INSTALL](INSTALL.md) and [RUNNING](RUNNING.md) +For detailed instructions, see [INSTALL.md](INSTALL.md) and [RUNNING.md](RUNNING.md). -## Installation +Documentation: doc.lbry.io (may be out of date) -See [INSTALL](INSTALL.md) - -## Developers - -Documentation: doc.lbry.io Source code: https://github.com/lbryio/lbry -To contribute to the development of LBRYnet or lbrynet-console, contact jimmy@lbry.io +To contribute, [join us on Slack](https://lbry-slackin.herokuapp.com/) or contact josh@lbry.io. Pull requests are also welcome. ## Support -Send all support requests to jimmy@lbry.io +Please open an issue and describe your situation in detail. We will respond as soon as we can. + +For private issues, contact josh@lbry.io. ## License diff --git a/lbrynet/lbrynet_gui/lbry.png b/lbrynet/lbrynet_gui/lbry.png index 16c7c4683..659957406 100644 Binary files a/lbrynet/lbrynet_gui/lbry.png and b/lbrynet/lbrynet_gui/lbry.png differ diff --git a/packaging/osx/add-key.sh b/packaging/osx/add-key.sh new file mode 100755 index 000000000..ac06aa373 --- /dev/null +++ b/packaging/osx/add-key.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# http://stackoverflow.com/a/246128 +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# adapted from https://www.objc.io/issues/6-build-tools/travis-ci/#add-scripts + +KEYCHAIN_PASSWORD=travis + +# Create a custom keychain +security create-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain + +# Make the custom keychain default, so xcodebuild will use it for signing +security default-keychain -s osx-build.keychain + +# Unlock the keychain +security unlock-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain + +# Set keychain timeout to 1 hour for long builds +# see http://www.egeek.me/2013/02/23/jenkins-and-xcode-user-interaction-is-not-allowed/ +security set-keychain-settings -t 3600 -l ~/Library/Keychains/osx-build.keychain + +# Add certificates to keychain and allow codesign to access them +security import ${DIR}/certs/dist.cer -k ~/Library/Keychains/osx-build.keychain -T /usr/bin/codesign +security import ${DIR}/certs/dist.p12 -k ~/Library/Keychains/osx-build.keychain -P $KEY_PASSWORD -T /usr/bin/codesign + diff --git a/packaging/osx/lbry-osx-app b/packaging/osx/lbry-osx-app new file mode 160000 index 000000000..e5b465205 --- /dev/null +++ b/packaging/osx/lbry-osx-app @@ -0,0 +1 @@ +Subproject commit e5b465205469e8f14999b56138b3bea6666e006d diff --git a/packaging/ubuntu/lbry b/packaging/ubuntu/lbry index 3735a253a..d24574f32 100755 --- a/packaging/ubuntu/lbry +++ b/packaging/ubuntu/lbry @@ -2,6 +2,8 @@ set -euo pipefail +WEB_UI_BRANCH='master' + urlencode() { local LANG=C local length="${#1}" @@ -17,7 +19,7 @@ urlencode() { DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ -z "$(pgrep lbrynet-daemon)" ]; then echo "running lbrynet-daemon..." - $DIR/lbrynet-daemon & + $DIR/lbrynet-daemon --branch="$WEB_UI_BRANCH" & sleep 3 # let the daemon load before connecting fi diff --git a/packaging/ubuntu/postinst_append b/packaging/ubuntu/postinst_append new file mode 100755 index 000000000..2e040b492 --- /dev/null +++ b/packaging/ubuntu/postinst_append @@ -0,0 +1,28 @@ + +( + +sleep 4 + +zenity --question --text="LBRY Installed\n\nRun LBRY now?" --title="LBRY Installed" --ok-label=" Yes" \ + --cancel-label=" No" --icon-name="system-software-install" + +case $? in + 0) RUN=1 # yes + ;; + 1) RUN=0 # no + ;; + *) RUN=0 # timeout or escape or whatever + ;; +esac + +if [ $RUN = 1 ]; then + xdg-open "lbry://lbry" +else + zenity --info --text="LBRY Installed\n\nNo problem. You can run LBRY later by going to + +lbry://lbry + +in your browser." --title="LBRY Installed" --icon-name="system-software-install" +fi + +) & diff --git a/packaging/ubuntu/ubuntu_package_setup.sh b/packaging/ubuntu/ubuntu_package_setup.sh index 4be10c8a7..f35a78b72 100755 --- a/packaging/ubuntu/ubuntu_package_setup.sh +++ b/packaging/ubuntu/ubuntu_package_setup.sh @@ -1,37 +1,124 @@ #!/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} +function HELP { + echo "Build a debian package for lbry" + echo "-----" + echo "When run without any arguments, this script expects the current directory" + echo "to be the main lbry repo and it builds what is in that directory" + echo + echo "Optional arguments:" + echo + echo "-c: clone a fresh copy of the repo" + echo "-b : use the specified branch of the lbry repo" + echo "-w : set the webui branch" + echo "-d : specifiy the build directory" + echo "-h: show help" + echo "-t: turn trace on" + exit 1 +} -BUILD_DIR="lbry-build-$(date +%Y%m%d-%H%M%S)" -mkdir "$BUILD_DIR" +CLONE=false +BUILD_DIR="" +BRANCH="" +WEB_UI_BRANCH="master" + +while getopts :hctb:w:d: FLAG; do + case $FLAG in + c) + CLONE=true + ;; + b) + BRANCH=${OPTARG} + ;; + w) + WEB_UI_BRANCH=${OPTARG} + ;; + d) + BUILD_DIR=${OPTARG} + ;; + t) + set -o xtrace + ;; + h) + HELP + ;; + \?) #unrecognized option - show help + echo "Option -$OPTARG not allowed." + HELP + ;; + :) + echo "Option -$OPTARG requires an argument." + HELP + ;; + esac +done + +shift $((OPTIND-1)) + + +SUDO='' +if (( $EUID != 0 )); then + SUDO='sudo' +fi + +if [ "$CLONE" = false ]; then + if [ `basename $PWD` != "lbry" ]; then + echo "Not currently in the lbry directory. Cowardly refusing to go forward" + exit 1 + fi + SOURCE_DIR=$PWD +fi + +if [ -z "${BUILD_DIR}" ]; then + if [ "$CLONE" = true ]; then + # build in the current directory + BUILD_DIR="lbry-build-$(date +%Y%m%d-%H%M%S)" + else + BUILD_DIR="../lbry-build-$(date +%Y%m%d-%H%M%S)" + fi +fi + +mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" +if [ -z ${TRAVIS+x} ]; then + # if not on travis, its nice to see progress + QUIET="" +else + QUIET="-qq" +fi + # 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 +$SUDO apt-get ${QUIET} update +$SUDO apt-get ${QUIET} install -y --no-install-recommends software-properties-common +$SUDO add-apt-repository -y ppa:spotify-jyrki/dh-virtualenv +$SUDO apt-get ${QUIET} update +$SUDO apt-get ${QUIET} install -y --no-install-recommends \ + build-essential git python-dev libffi-dev libssl-dev \ + libgmp3-dev dh-virtualenv debhelper wget python-pip fakeroot # 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" +$SUDO pip install --upgrade pip +$SUDO pip install make-deb # build packages +# +# dpkg-buildpackage outputs its results into '..' so +# we need to move/clone lbry into the build directory +if [ "$CLONE" == true]; then + cp -a $SOURCE_DIR lbry +else + git clone https://github.com/lbryio/lbry.git +fi ( - cd lbry - make-deb - dpkg-buildpackage -us -uc + cd lbry + if [ -n "${BRANCH}" ]; then + git checkout "${BRANCH}" + fi + make-deb + dpkg-buildpackage -us -uc ) @@ -41,8 +128,20 @@ git clone https://github.com/lbryio/lbry.git --branch "$BRANCH" PACKAGE="$(ls | grep '.deb')" ar vx "$PACKAGE" mkdir control data -tar -xvzf control.tar.gz --directory control -tar -xvJf data.tar.xz --directory data +tar -xzf control.tar.gz --directory control + +# The output of the travis build is a +# tar.gz and the output locally is tar.xz. +# Instead of having tar detect the compression used, we +# could update the config to output the same in either spot. +# Unfortunately, doing so requires editting some auto-generated +# files: http://linux.spiney.org/forcing_gzip_compression_when_building_debian_packages +tar -xf data.tar.?z --directory data + +PACKAGING_DIR='lbry/packaging/ubuntu' + +# set web ui branch +sed -i "s/^WEB_UI_BRANCH='[^']\+'/WEB_UI_BRANCH='$WEB_UI_BRANCH'/" "$PACKAGING_DIR/lbry" # add files function addfile() { @@ -52,16 +151,16 @@ function addfile() { cp "$FILE" "data/$TARGET" echo "$(md5sum "data/$TARGET" | cut -d' ' -f1) $TARGET" >> control/md5sums } -PACKAGING_DIR='lbry/packaging/ubuntu' addfile "$PACKAGING_DIR/lbry" usr/share/python/lbrynet/bin/lbry addfile "$PACKAGING_DIR/lbry.desktop" usr/share/applications/lbry.desktop -#addfile lbry/packaging/ubuntu/lbry-init.conf etc/init/lbry.conf + +cat "$PACKAGING_DIR/postinst_append" >> control/postinst # repackage .deb -sudo chown -R root:root control data -tar -cvzf control.tar.gz -C control . -tar -cvJf data.tar.xz -C data . -sudo chown root:root debian-binary control.tar.gz data.tar.xz +$SUDO chown -R root:root control data +tar -czf control.tar.gz -C control . +tar -cJf data.tar.xz -C data . +$SUDO chown root:root debian-binary control.tar.gz data.tar.xz 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 diff --git a/setup.py b/setup.py index e4a9432f0..baf069fa7 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ gui_data_files = ['close2.gif', 'lbry-dark-242x80.gif', 'lbry-dark-icon.xbm', 'l gui_data_paths = [os.path.join(base_dir, 'lbrynet', 'lbrynet_gui', f) for f in gui_data_files] setup(name='lbrynet', - description='A fully decentralized network for distributing data', + description='A fully-decentralized content marketplace', version=__version__, maintainer='Jimmy Kiselak', maintainer_email='jimmy@lbry.io',