Last active
October 17, 2017 15:52
-
-
Save ffflorian/b5e684b5aa449f9338c58ed46b6a5ee5 to your computer and use it in GitHub Desktop.
Wire Desktop Build for Debian x64 and i386
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wire build and installation for Debian x64 | |
# Created by @ffflorian (https://github.com/ffflorian) | |
# Licensed under the MIT license. | |
# Prerequisites: | |
# * You need npm, git, g++ and dpkg. | |
# * You need to clone https://github.com/wireapp/wire-desktop. | |
# Usage: Run it in the folder of the wire-desktop repo. | |
#!/usr/bin/env bash | |
# Change to script's directory to ensure we're in the correct folder. | |
# http://stackoverflow.com/questions/3349105/how-to-set-current-working-directory-to-the-directory-of-the-script | |
cd "${0%/*}" | |
NEEDED_SYSTEM_TOOLS="git npm g++ dpkg" | |
NPM_SETTINGS="./package.json" | |
ELECTRON_SETTINGS="./electron/package.json" | |
ARCHITECTURE="$(uname -m)" | |
for TOOL in ${NEEDED_SYSTEM_TOOLS}; do | |
if ! command -v "${TOOL}" > /dev/null; then | |
echo "Could not find ${TOOL}! Exiting." | |
exit 1 | |
fi | |
done | |
git checkout HEAD -- "${ELECTRON_SETTINGS}" | |
git checkout master | |
git pull | |
if [ -r "${NPM_SETTINGS}" ]; then | |
OUTPUT_FOLDER="$(sed -n 's/.*"output": "\([^\"]*\).*/\1/p' "${NPM_SETTINGS}")" | |
else | |
echo "Could not find npm's package.json! Exiting." | |
exit 1 | |
fi | |
if [ -r "${ELECTRON_SETTINGS}" ]; then | |
VERSION="$(sed -n 's/.*"version": "\([^\"]*\).*/\1/p' "${ELECTRON_SETTINGS}")" | |
else | |
echo "Could not find Electron's package.json! Exiting." | |
exit 1 | |
fi | |
if [ "${ARCHITECTURE}" == "x86_64" ]; then | |
BUILD_FILE="${OUTPUT_FOLDER}/wire_${VERSION}_amd64.deb" | |
else | |
BUILD_FILE="${OUTPUT_FOLDER}/wire_${VERSION}_i386.deb" | |
fi | |
if [ -r "${BUILD_FILE}" ]; then | |
read -r -p "Newest version is already built. Rebuild now? [Y/n] " RESPONSE | |
case ${RESPONSE} in | |
[nN][oO]|[nN] ) exit 0 ;; | |
esac | |
fi | |
npm install | |
npm run preinstall | |
echo -e "\033[1mBuilding Wire Linux version ${VERSION} ...\033[0m" | |
npx grunt linux-prod | |
if [ -r "${BUILD_FILE}" ]; then | |
read -r -p "Install now (needs root)? [Y/n] " RESPONSE | |
case ${RESPONSE} in | |
[nN][oO]|[nN] ) exit 0 ;; | |
* ) sudo dpkg -i "${OUTPUT_FOLDER}/wire_${VERSION}_amd64.deb" ;; | |
esac | |
else | |
echo "Build failed!" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment