mirror of
https://github.com/EnumeratedDev/bpm-utils.git
synced 2026-09-16 11:06:11 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2de62c343 | ||
|
|
e4a9622ff2 | ||
|
|
39b56204ae |
+14
-2
@@ -1,5 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f .compilation-options ]; then
|
||||
source ./.compilation-options
|
||||
fi
|
||||
|
||||
echo "$ARCH"
|
||||
|
||||
while getopts "ksa:" o; do
|
||||
case "${o}" in
|
||||
a) ARCH="$OPTARG";;
|
||||
@@ -68,7 +74,11 @@ if tar -xf "$PACKAGE" -C "$TEMPDIR" source-files &> /dev/null; then
|
||||
mv "$TEMPDIR"/source-files/* "$TEMPDIR"/
|
||||
rm -d "$TEMPDIR"/source-files
|
||||
fi
|
||||
|
||||
PACKAGE_SCRIPTS=()
|
||||
while read line; do
|
||||
PACKAGE_SCRIPTS+=("$line")
|
||||
done < <(tar -tf "$PACKAGE" | grep -v -E 'source.sh|pkg.info|source-files')
|
||||
tar -xf "$PACKAGE" -C "$TEMPDIR" ${PACKAGE_SCRIPTS[@]} &> /dev/null
|
||||
cd "$TEMPDIR"
|
||||
|
||||
# Declare and run Set Variables function
|
||||
@@ -118,7 +128,9 @@ cd "$BPM_SOURCE"
|
||||
RunPkgFunction build
|
||||
|
||||
cd "$BPM_SOURCE"
|
||||
if [ -z "$SKIPCHECK" ]; then
|
||||
RunPkgFunction check
|
||||
fi
|
||||
|
||||
# Packaging all packages
|
||||
for func in $(typeset -F | awk '{print $3}' | grep '^package'); do
|
||||
@@ -148,7 +160,7 @@ for func in $(typeset -F | awk '{print $3}' | grep '^package'); do
|
||||
echo "${PKGINFO_FILE}" > pkg.info
|
||||
sed -i "s/architecture:.*/architecture: ${ARCH}/g" pkg.info
|
||||
sed -i 's/type:.*/type: binary/g' pkg.info
|
||||
fakeroot -i "$TEMPDIR"/fakeroot_file_"$pkgname" tar -czpf "$pkgname".tar.gz pkg.info output --transform 's/output/files/'
|
||||
fakeroot -i "$TEMPDIR"/fakeroot_file_"$pkgname" tar -czpf "$pkgname".tar.gz pkg.info ${PACKAGE_SCRIPTS[@]} output --transform 's/output/files/'
|
||||
mv "$pkgname".tar.gz "$DIR"/"$pkgname"-"$BPM_PKG_VERSION"-"$ARCH".bpm
|
||||
echo "Packaged ${pkgname} successfully!"
|
||||
rm "$TEMPDIR"/fakeroot_file_"$pkgname"
|
||||
|
||||
+7
-3
@@ -5,12 +5,16 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f .compilation-options ]; then
|
||||
source ./.compilation-options
|
||||
fi
|
||||
|
||||
while getopts "cska:" flag; do
|
||||
case "$flag" in
|
||||
c) CONVERT=true;;
|
||||
k) KEEP=true;;
|
||||
s) SKIPCHECK=true;;
|
||||
a) ARCHITECTURE="${OPTARG}";;
|
||||
a) ARCH="${OPTARG}";;
|
||||
*) exit 1;;
|
||||
esac
|
||||
done
|
||||
@@ -86,10 +90,10 @@ tar -c --owner=0 --group=0 --no-same-owner -zf "$output" "${toCompress[@]}"
|
||||
if [ ! -z "$CONVERT" ] && "$CONVERT" && [[ "$type" == "source" ]]; then
|
||||
args=()
|
||||
if ! [ -z "$KEEP" ]; then
|
||||
args+=("-a" "$ARCHITECTURE")
|
||||
args+=("-a" "$ARCH")
|
||||
fi
|
||||
if ! [ -z "$SKIPCHECK" ]; then
|
||||
args+=("-s")
|
||||
fi
|
||||
bpm-convert "${args[@]}" -a "$ARCHITECTURE" "$output"
|
||||
bpm-convert "${args[@]}" -a "$ARCH" "$output"
|
||||
fi
|
||||
|
||||
+28
-17
@@ -1,5 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
containsElement () {
|
||||
local e match="$1"
|
||||
shift
|
||||
for e; do [[ "$e" == "$match" ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
SCRIPT_PATH=$(realpath "$0")
|
||||
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
|
||||
|
||||
@@ -30,34 +37,38 @@ fi
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
if ! $DEEP; then
|
||||
for arch in "$REPO"/*/; do
|
||||
for pkg in "$arch"/*.bpm; do
|
||||
info=$(tar -xf "$pkg" pkg.info -O)
|
||||
package=$(echo "$info" | grep 'name: ' | awk '{print $2}')
|
||||
if [[ ${PKGS[@]} =~ "$package" ]]; then
|
||||
create_entry() {
|
||||
if [ $# -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
if ! [ -f "$1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
info="info:"$'\n'
|
||||
info+=$(tar -xf "$pkg" pkg.info -O | sed 's/^/ /g')
|
||||
package=$(echo "$info" | grep 'name: ' | xargs | awk '{print $2}')
|
||||
if containsElement "$package" "${PKGS[@]}"; then
|
||||
echo "The following package was found in more than 1 package archives: ${package}"
|
||||
exit 1
|
||||
fi
|
||||
PKGS+=("$package")
|
||||
file="$(realpath -s --relative-to="$REPO" "$pkg")"
|
||||
info+=$'\n'"file: ${file}"
|
||||
info+=$'\n'"download: ${file}"
|
||||
info+=$'\n---'
|
||||
echo "$info"
|
||||
}
|
||||
|
||||
if ! $DEEP; then
|
||||
for arch in "$REPO"/*/; do
|
||||
for pkg in "$arch"/*.bpm; do
|
||||
create_entry "$pkg"
|
||||
done
|
||||
done
|
||||
else
|
||||
for arch in "$REPO"/*/; do
|
||||
for pkg in "$arch"/**/*.bpm; do
|
||||
info=$(tar -xf "$pkg" pkg.info -O)
|
||||
package=$(echo "$info" | grep 'name: ' | awk '{print $2}')
|
||||
if [[ ${PKGS[@]} =~ "$package" ]]; then
|
||||
echo "The following package was found in more than 1 package archives: ${package}"
|
||||
fi
|
||||
PKGS+=("$package")
|
||||
file="$(realpath -s --relative-to="$REPO" "$pkg")"
|
||||
info+=$'\n'"file: ${file}"
|
||||
info+=$'\n---'
|
||||
echo "$info"
|
||||
create_entry "$pkg"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user