70 lines
1.4 KiB
Bash
Executable File
70 lines
1.4 KiB
Bash
Executable File
#!/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}
|
|
}
|
|
|
|
git_pull(){
|
|
if [ -d .git ];then
|
|
git stash
|
|
git pull origin master
|
|
fi
|
|
}
|
|
|
|
main(){
|
|
if [ ! -d ${BIN_DIR} ];then
|
|
mkdir -pv ${BIN_DIR}
|
|
fi
|
|
|
|
|
|
|
|
case $1 in
|
|
all | -a) git_pull && build_rpm && build_deb
|
|
;;
|
|
|
|
deb | -d) git_pull && build_deb
|
|
;;
|
|
|
|
rpm | -r) git_pull && 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\n"
|
|
printf " -r | rpm build only RPM package format\n\n"
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
main ${1}
|
|
|