Mailspring/script/mkrpm
2016-02-15 20:26:00 -05:00

34 lines
807 B
Bash
Executable file

#!/bin/bash
set -e
SPEC_FILE="$1"
DESKTOP_FILE="$2"
BUILD_DIRECTORY="$3"
CONTENTS_DIR="$4"
APP_FILE_NAME="$5"
RPM_BUILD_ROOT=~/rpmbuild
ARCH=`uname -m`
# Work around for `uname -m` returning i686 when rpmbuild uses i386 instead
if [ "$ARCH" = "i686" ]; then
ARCH="i386"
fi
# rpmdev-setuptree
mkdir -p $RPM_BUILD_ROOT/BUILD
mkdir -p $RPM_BUILD_ROOT/SPECS
mkdir -p $RPM_BUILD_ROOT/RPMS
cp -r "$CONTENTS_DIR/"* "$RPM_BUILD_ROOT/BUILD"
cp -r "$BUILD_DIRECTORY/icons" "$RPM_BUILD_ROOT/BUILD"
cp "$SPEC_FILE" "$RPM_BUILD_ROOT/SPECS"
cp ./N1.sh "$RPM_BUILD_ROOT/BUILD"
cp "$RPM_BUILD_ROOT/BUILD/N1.sh" "$RPM_BUILD_ROOT/BUILD/$APP_FILE_NAME"
cp "$DESKTOP_FILE" "$RPM_BUILD_ROOT/BUILD"
rpmbuild -ba "$SPEC_FILE"
cp $RPM_BUILD_ROOT/RPMS/$ARCH/$APP_FILE_NAME-*.rpm "$BUILD_DIRECTORY"
rm -rf "$RPM_BUILD_ROOT"