#!/bin/bash CURRENT_USER="mollusk" DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//) BIN_DIR="/home/${CURRENT_USER}/wire-packages" PACKAGE_DEFAULT_DIR="$(pwd)/wrap/dist" build_deb(){ ARCH="x64" TARGET="deb" npm install npm update npm install -g grunt grunt 'clean:linux' 'update-keys' 'release-prod' grunt --arch=${ARCH} --target=${TARGET} 'electronbuilder:linux_other' mv -v ${PACKAGE_DEFAULT_DIR}/*.deb ${BIN_DIR} } build_rpm(){ ARCH="x64" TARGET="rpm" npm install npm update npm install -g grunt grunt 'clean:linux' 'update-keys' 'release-prod' dnf install rpm-build rpmdevtools grunt --arch=${ARCH} --target=${TARGET} 'electronbuilder:linux_other' mv -v ${PACKAGE_DEFAULT_DIR}/*.rpm ${BIN_DIR} } main(){ if [ ! -d ${BIN_DIR} ];then mkdir -pv ${BIN_DIR} fi case $1 in all | -a) build_rpm && build_deb ;; deb | -d) build_deb ;; rpm | -r) build_rpm ;; *) printf "\n\n" printf "Usage: $0 [-a/all | -d/deb | -r/rpm ]\n\n" printf " -a | all build all package formats\n" printf " -d | deb build only DEB package format\m" printf " -r | rpm build only RPM package format\n\n" ;; esac } main ${1}