check if process exists; add icons to build
This commit is contained in:
parent
09b9bacc35
commit
19192b6300
12 changed files with 64 additions and 17 deletions
25
build.sh
25
build.sh
|
@ -4,6 +4,12 @@ set -o xtrace
|
|||
set -eu
|
||||
|
||||
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
ICON="$ROOT/package/osx/app.icns"
|
||||
else
|
||||
ICON="$ROOT/package/icons/lbry48.png"
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
||||
# install dependencies
|
||||
|
@ -17,6 +23,7 @@ if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
|||
set +u
|
||||
source "$VENV/bin/activate"
|
||||
set -u
|
||||
pip install -U pip setuptools
|
||||
fi
|
||||
|
||||
|
||||
|
@ -27,17 +34,13 @@ fi
|
|||
|
||||
(
|
||||
cd "$ROOT/lbry"
|
||||
git fetch
|
||||
git reset --hard origin/master
|
||||
git cherry-pick bd75e88ebebb67897c62a1ee1d3228fd269677dc
|
||||
pip install -r requirements.txt
|
||||
pip install .
|
||||
git reset --hard origin/master
|
||||
)
|
||||
|
||||
(
|
||||
cd "$ROOT/lbrynet"
|
||||
pyinstaller lbry.py -y --windowed --onefile --icon="$ROOT/lbry/packaging/osx/lbry-osx-app/app.icns"
|
||||
pyinstaller lbry.py -y --windowed --onefile --icon="${ICON}"
|
||||
)
|
||||
|
||||
(
|
||||
|
@ -52,21 +55,25 @@ cp -R "$ROOT/lbry-web-ui/dist" "$ROOT/electron/"
|
|||
mv "$ROOT/lbrynet/dist/lbry" "$ROOT/electron/dist"
|
||||
|
||||
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
||||
electron-packager --electron-version=1.4.14 --overwrite "$ROOT/electron" LBRY
|
||||
electron-packager --electron-version=1.4.14 --overwrite "$ROOT/electron" LBRY --icon="${ICON}"
|
||||
# TODO: sign the app
|
||||
|
||||
(
|
||||
cd "$ROOT/lbry"
|
||||
VERSION=$(python setup.py -V)
|
||||
cd "$ROOT"
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
OS="osx"
|
||||
PLATFORM="darwin"
|
||||
mv "LBRY-${PLATFORM}-x64/LBRY.app" "$ROOT/lbry/package/osx/lbry-osx-app/LBRY.app"
|
||||
cd "$ROOT/lbry/packaging/osx/lbry-osx-app"
|
||||
dmgbuild -s dmg_settings.py "LBRY" "lbry-${VERSION}.dmg"
|
||||
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
||||
OS="linux"
|
||||
PLATFORM="linux"
|
||||
tar cvzf "lbry-${OS}.tgz" "LBRY-${PLATFORM}-x64/"
|
||||
else
|
||||
OS="unknown"
|
||||
fi
|
||||
|
||||
tar cvzf "lbry-${OS}.tgz" "LBRY-${PLATFORM}-x64/"
|
||||
)
|
||||
|
||||
echo 'Build and packaging complete.'
|
||||
|
|
|
@ -8,6 +8,8 @@ var client = jayson.client.http('http://localhost:5279/lbryapi');
|
|||
let win
|
||||
// Also keep the daemon subprocess alive
|
||||
let subpy
|
||||
// set to true when the quitting sequence has started
|
||||
let quitting = false;
|
||||
|
||||
function createWindow () {
|
||||
// Create the browser window.
|
||||
|
@ -30,12 +32,19 @@ function createWindow () {
|
|||
};
|
||||
|
||||
function lauchDaemon() {
|
||||
// TODO: check if the daemon is already running
|
||||
if (subpy) {
|
||||
return;
|
||||
}
|
||||
subpy = require('child_process').spawn(`${__dirname}/dist/lbry`, ['--no-launch', '--log-to-console'], {stdio: ['ignore', process.stdout, process.stderr]})
|
||||
subpy.on('exit', () => {
|
||||
console.log('The daemon has exited. Quitting the app');
|
||||
subpy = null;
|
||||
app.quit();
|
||||
if (quitting) {
|
||||
app.quit();
|
||||
} else {
|
||||
win.loadURL(`file://${__dirname}/dist/warning.html`);
|
||||
setTimeout(5000, app.quit)
|
||||
}
|
||||
});
|
||||
console.log('lbrynet daemon has launched')
|
||||
}
|
||||
|
@ -44,9 +53,19 @@ function lauchDaemon() {
|
|||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', function(){
|
||||
lauchDaemon();
|
||||
createWindow();
|
||||
})
|
||||
// Check if the daemon is already running. If we get
|
||||
// an error its because its not running
|
||||
client.request(
|
||||
'status', [],
|
||||
function (err, res) {
|
||||
// Did it all work ?
|
||||
if (err) {
|
||||
lauchDaemon();
|
||||
}
|
||||
}
|
||||
);
|
||||
createWindow();
|
||||
});
|
||||
|
||||
|
||||
// Quit when all windows are closed.
|
||||
|
@ -61,6 +80,10 @@ app.on('window-all-closed', () => {
|
|||
app.on('before-quit', (event) => {
|
||||
if (subpy != null) {
|
||||
event.preventDefault()
|
||||
if (win) {
|
||||
win.loadURL(`file://${__dirname}/dist/quit.html`);
|
||||
}
|
||||
quitting = true;
|
||||
subpy.kill('SIGINT');
|
||||
}
|
||||
})
|
||||
|
|
2
lbry
2
lbry
|
@ -1 +1 @@
|
|||
Subproject commit 91d673a539f5943cc219d9bec270fa840fa0895c
|
||||
Subproject commit 3e37765c1bdd7007c5c66c97fe9857104d595396
|
|
@ -1 +1 @@
|
|||
Subproject commit 8452dd8bd56653d8072b04ec592d9c944a8b9843
|
||||
Subproject commit 114d7868ac28b3c7e9ca9798aab129624b0c8a48
|
BIN
package/icons/lbry128.png
Normal file
BIN
package/icons/lbry128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
BIN
package/icons/lbry256.png
Normal file
BIN
package/icons/lbry256.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
package/icons/lbry32.png
Normal file
BIN
package/icons/lbry32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
package/icons/lbry48.png
Normal file
BIN
package/icons/lbry48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
package/icons/lbry96.png
Normal file
BIN
package/icons/lbry96.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
BIN
package/osx/app.icns
Normal file
BIN
package/osx/app.icns
Normal file
Binary file not shown.
12
package/osx/dmg_settings.py
Normal file
12
package/osx/dmg_settings.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
badge_icon = 'app.icns'
|
||||
icon_locations = {
|
||||
'LBRY.app': (115, 164),
|
||||
'Applications': (387, 164)
|
||||
}
|
||||
background='dmg_background.png'
|
||||
default_view='icon-view'
|
||||
symlinks = { 'Applications': '/Applications' }
|
||||
window_rect=((200, 200), (500, 320))
|
||||
files = [ 'LBRY.app' ]
|
||||
icon_size=128
|
||||
size = '200M'
|
|
@ -27,7 +27,7 @@ cmd_exists() {
|
|||
return $?
|
||||
}
|
||||
|
||||
|
||||
set +eu
|
||||
GITUSERNAME=$(git config --global --get user.name)
|
||||
GITEMAIL=$(git config --global --get user.email)
|
||||
if [ -z "$GITUSERNAME" ]; then
|
||||
|
@ -36,6 +36,7 @@ fi
|
|||
if [ -z "$GITEMAIL" ]; then
|
||||
git config --global user.email "$(whoami)@lbry.io"
|
||||
fi
|
||||
set -eu
|
||||
|
||||
|
||||
if $LINUX; then
|
||||
|
@ -95,3 +96,7 @@ fi
|
|||
if ! cmd_exists electron-packager; then
|
||||
$SUDO npm install --global electron-packager
|
||||
fi
|
||||
|
||||
if $OSX && ! cmd_exists dmgbuild; then
|
||||
$SUDO pip install dmgbuild
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue