chore: adopt new build script command convention in GNU/Linux (#899)

The GNU/Linux build script (as the rest of the OSes will in the near
future), now accepts the following command:

- `develop-electron`
- `develop-cli`
- `installer-cli`
- `installer-appimage`
- `installer-debian`

Each of the commands is now completely independent from the others.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit is contained in:
Juan Cruz Viotti 2016-11-27 22:29:23 -04:00 committed by GitHub
parent 553f7f3f4b
commit 19b3bc56c2
6 changed files with 61 additions and 35 deletions

View File

@ -45,7 +45,7 @@ install:
- npm install -g bower
- npm install -g electron-installer-debian
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
./scripts/build/linux.sh install x64;
./scripts/build/linux.sh develop-electron x64;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew install afsctool;

View File

@ -44,7 +44,8 @@ $ ./scripts/build/darwin.sh all
Run the following command:
```sh
$ ./scripts/build/linux.sh all <x64|x86>
$ ./scripts/build/linux.sh installer-appimage <x64|x86>
$ ./scripts/build/linux.sh installer-debian <x64|x86>
```
### Windows

View File

@ -56,7 +56,7 @@ the application might not run successfully.
### GNU/Linux
```sh
./scripts/build/linux.sh install <x64|x86>
./scripts/build/linux.sh develop-electron <x64|x86>
```
### Windows

View File

@ -33,31 +33,42 @@ if [ "$#" -ne 2 ]; then
fi
COMMAND=$1
if [ "$COMMAND" != "install" ] && [ "$COMMAND" != "package" ] && [ "$COMMAND" != "debian" ] && [ "$COMMAND" != "appimage" ] && [ "$COMMAND" != "cli" ] && [ "$COMMAND" != "all" ]; then
echo "Unknown command: $COMMAND" 1>&2
exit 1
fi
if [ "$COMMAND" == "appimage" ] || [ "$COMMAND" == "all" ]; then
if ! command -v upx 2>/dev/null; then
echo "Dependency missing: upx" 1>&2
exit 1
fi
fi
ARCH=$2
if [ "$ARCH" != "x64" ] && [ "$ARCH" != "x86" ]; then
if [ "$ARCH" != "x64" ] &&
[ "$ARCH" != "x86" ];
then
echo "Unknown architecture: $ARCH" 1>&2
exit 1
fi
ELECTRON_VERSION=`node -e "console.log(require('./package.json').devDependencies['electron-prebuilt'])"`
NODE_VERSION="6.2.2"
APPLICATION_NAME=`node -e "console.log(require('./package.json').displayName)"`
APPLICATION_DESCRIPTION=`node -e "console.log(require('./package.json').description)"`
APPLICATION_VERSION=`node -e "console.log(require('./package.json').version)"`
if [ "$COMMAND" == "cli" ]; then
./scripts/unix/dependencies.sh -r "$ARCH" -v 6.2.2 -t node -f -p
if [ "$COMMAND" == "develop-electron" ]; then
./scripts/unix/dependencies.sh \
-r "$ARCH" \
-v "$ELECTRON_VERSION" \
-t electron
exit 0
fi
if [ "$COMMAND" == "develop-cli" ]; then
./scripts/unix/dependencies.sh \
-r "$ARCH" \
-v "$NODE_VERSION" \
-t node
exit 0
fi
if [ "$COMMAND" == "installer-cli" ]; then
./scripts/unix/dependencies.sh -f -p \
-r "$ARCH" \
-v "$NODE_VERSION" \
-t node
./scripts/unix/package-cli.sh \
-n etcher \
-e bin/etcher \
@ -67,19 +78,11 @@ if [ "$COMMAND" == "cli" ]; then
exit 0
fi
if [ "$COMMAND" == "install" ] || [ "$COMMAND" == "all" ]; then
./scripts/unix/dependencies.sh \
if [ "$COMMAND" == "installer-debian" ]; then
./scripts/unix/dependencies.sh -p \
-r "$ARCH" \
-v "$ELECTRON_VERSION" \
-t electron
fi
if [ "$COMMAND" == "package" ] || [ "$COMMAND" == "all" ]; then
./scripts/unix/dependencies.sh \
-r "$ARCH" \
-v "$ELECTRON_VERSION" \
-t electron \
-p
./scripts/linux/package.sh \
-n "$APPLICATION_NAME" \
@ -89,29 +92,48 @@ if [ "$COMMAND" == "package" ] || [ "$COMMAND" == "all" ]; then
-f "package.json,lib,node_modules,bower_components,build,assets" \
-e "$ELECTRON_VERSION" \
-o etcher-release/$APPLICATION_NAME-linux-$ARCH
fi
if [ "$COMMAND" == "debian" ] || [ "$COMMAND" == "all" ]; then
./scripts/linux/installer-deb.sh \
-p etcher-release/$APPLICATION_NAME-linux-$ARCH \
-r "$ARCH" \
-c scripts/build/debian/config.json \
-o etcher-release/installers
exit 0
fi
if [ "$COMMAND" == "appimage" ] || [ "$COMMAND" == "all" ]; then
if [ "$COMMAND" == "installer-appimage" ]; then
./scripts/unix/dependencies.sh -p \
-r "$ARCH" \
-v "$ELECTRON_VERSION" \
-t electron
./scripts/linux/package.sh \
-n "$APPLICATION_NAME" \
-r "$ARCH" \
-v "$APPLICATION_VERSION" \
-l LICENSE \
-f "package.json,lib,node_modules,bower_components,build,assets" \
-e "$ELECTRON_VERSION" \
-o etcher-release/$APPLICATION_NAME-linux-$ARCH
./scripts/linux/installer-appimage.sh \
-n "$APPLICATION_NAME" \
-d "$APPLICATION_DESCRIPTION" \
-p etcher-release/Etcher-linux-$ARCH \
-p etcher-release/$APPLICATION_NAME-linux-$ARCH \
-r $ARCH \
-b etcher \
-i assets/icon.png \
-o etcher-release/$APPLICATION_NAME-linux-$ARCH.AppImage
pushd etcher-release
zip Etcher-$APPLICATION_VERSION-linux-$ARCH.zip Etcher-linux-$ARCH.AppImage
zip $APPLICATION_NAME-$APPLICATION_VERSION-linux-$ARCH.zip $APPLICATION_NAME-linux-$ARCH.AppImage
mkdir -p installers
mv Etcher-$APPLICATION_VERSION-linux-$ARCH.zip installers
mv $APPLICATION_NAME-$APPLICATION_VERSION-linux-$ARCH.zip installers
popd
exit 0
fi
echo "Unknown command: $COMMAND" 1>&2
exit 1

View File

@ -130,6 +130,9 @@ download_executable \
# Compress binaries
upx -9 "$APPDIR_PATH/usr/bin/$ARGV_BINARY"
# upx fails with an error if .so are not executables
chmod +x "$APPDIR_PATH"/usr/bin/*.so*
# UPX fails for some reason with some other so libraries
# other than libnode.so in the x86 build
if [ "$ARGV_ARCHITECTURE" == "x86" ]; then

View File

@ -18,7 +18,6 @@
set -u
set -e
set -x
OS=$(uname)
if [[ "$OS" != "Linux" ]]; then
@ -84,6 +83,7 @@ then
fi
OUTPUT_DIRNAME=$(dirname "$ARGV_OUTPUT")
rm -rf "$ARGV_OUTPUT"
mkdir -p "$OUTPUT_DIRNAME"
ELECTRON_ARCHITECTURE=$ARGV_ARCHITECTURE