Added '-a <architecture>' flag to to bpm-package

This commit is contained in:
CapCreeperGR 2024-05-30 15:55:47 +03:00
parent a3a97efd59
commit 3ea431b98d
2 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,10 @@
#!/bin/bash
DIR="$PWD"
ARCH="$2"
if [ -z "$ARCH" ]; then
ARCH=$(uname -m)
fi
if ! [ -f "$1" ]; then
echo "$1 is not a path to a file"
@ -92,10 +96,10 @@ cd "$BPM_WORKDIR"
mv output/ files/
touch pkg.info
echo "${PKGINFO_FILE}" > pkg.info
sed -i "s/architecture:.*/architecture: $(uname -m)/g" pkg.info
sed -i "s/architecture:.*/architecture: ${ARCH}/g" pkg.info
sed -i 's/type:.*/type: binary/g' pkg.info
tar -czpf "$BPM_PKG_NAME".tar.gz files pkg.info
mv "$BPM_PKG_NAME".tar.gz "$DIR"/"$BPM_PKG_NAME"-"$(uname -m)".bpm
mv "$BPM_PKG_NAME".tar.gz "$DIR"/"$BPM_PKG_NAME"-"$ARCH".bpm
echo "Package conversion complete!"
rm -rf "$TEMPDIR" root

View File

@ -5,9 +5,10 @@ then
exit 1
fi
while getopts "c" flag; do
while getopts "ca:" flag; do
case "$flag" in
c) CONVERT=true;;
a) ARCHITECTURE="${OPTARG}";;
*) exit 1;;
esac
done
@ -75,6 +76,6 @@ echo "Creating $type package as $output"
tar -czf "$output" "${toCompress[@]}"
if "$CONVERT" && [[ "$type" == "source" ]]; then
bpm-convert "$output"
if [ ! -z "$CONVERT" ] && "$CONVERT" && [[ "$type" == "source" ]]; then
bpm-convert "$output" "$ARCHITECTURE"
fi