Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
5076c48001 | |||
7df29661c3 |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2024 CapCreeperGR
|
Copyright (c) 2024 EnumDev
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -27,7 +27,7 @@ if ! [ -f "$PACKAGE" ]; then
|
|||||||
echo "$PACKAGE is not a path to a file"
|
echo "$PACKAGE is not a path to a file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! file "$PACKAGE" | grep -q 'gzip compressed data'; then
|
if ! file "$PACKAGE" | grep -q 'POSIX tar archive'; then
|
||||||
echo "$PACKAGE is not a BPM package"
|
echo "$PACKAGE is not a BPM package"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -126,6 +126,8 @@ function SetVariables() {
|
|||||||
export BPM_PKG_NAME="${PKGINFO[name]}"
|
export BPM_PKG_NAME="${PKGINFO[name]}"
|
||||||
export BPM_PKG_DESC="${PKGINFO[description]}"
|
export BPM_PKG_DESC="${PKGINFO[description]}"
|
||||||
export BPM_PKG_VERSION="${PKGINFO[version]}"
|
export BPM_PKG_VERSION="${PKGINFO[version]}"
|
||||||
|
export BPM_PKG_REVISION="${PKGINFO[revision]}"
|
||||||
|
[ -z "$BPM_PKG_REVISION" ] && export BPM_PKG_REVISION=1
|
||||||
export BPM_PKG_URL="${PKGINFO[url]}"
|
export BPM_PKG_URL="${PKGINFO[url]}"
|
||||||
export BPM_PKG_ARCH="${PKGINFO[architecture]}"
|
export BPM_PKG_ARCH="${PKGINFO[architecture]}"
|
||||||
IFS=',' read -r -a BPM_PKG_DEPENDS <<< "${PKGINFO[depends]}"
|
IFS=',' read -r -a BPM_PKG_DEPENDS <<< "${PKGINFO[depends]}"
|
||||||
@ -200,8 +202,9 @@ for func in $(typeset -F | awk '{print $3}' | grep '^package'); do
|
|||||||
echo "${PKGINFO_FILE}" > pkg.info
|
echo "${PKGINFO_FILE}" > pkg.info
|
||||||
sed -i "s/architecture:.*/architecture: ${ARCH}/g" pkg.info
|
sed -i "s/architecture:.*/architecture: ${ARCH}/g" pkg.info
|
||||||
sed -i 's/type:.*/type: binary/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 ${PACKAGE_SCRIPTS[@]} output --transform 's/output/files/'
|
fakeroot -i "$TEMPDIR"/fakeroot_file_"$pkgname" find "$TEMPDIR"/output -mindepth 1 -printf "%P %#m %U %G %s\n" > "$TEMPDIR"/pkg.files
|
||||||
mv "$pkgname".tar.gz "$DIR"/"$pkgname"-"$BPM_PKG_VERSION"-"$ARCH".bpm
|
find output -printf "%P\n" | fakeroot -i "$TEMPDIR"/fakeroot_file_"$pkgname" tar -czf files.tar.gz --no-recursion -C output -T -
|
||||||
|
tar -cf "$DIR"/"$pkgname"-"$BPM_PKG_VERSION"-"$BPM_PKG_REVISION"-"$ARCH".bpm --owner=0 --group=0 -C "$TEMPDIR" pkg.info pkg.files ${PACKAGE_SCRIPTS[@]} files.tar.gz
|
||||||
echo "Packaged ${pkgname} successfully!"
|
echo "Packaged ${pkgname} successfully!"
|
||||||
rm "$TEMPDIR"/fakeroot_file_"$pkgname"
|
rm "$TEMPDIR"/fakeroot_file_"$pkgname"
|
||||||
rm -r output/
|
rm -r output/
|
||||||
|
@ -88,7 +88,7 @@ for pkginfo in ./pkg.inf*; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Creating $type package as $output"
|
echo "Creating $type package as $output"
|
||||||
tar -c --owner=0 --group=0 --no-same-owner -zf "$output" "${toCompress[@]}"
|
tar -c --owner=0 --group=0 --no-same-owner -f "$output" "${toCompress[@]}"
|
||||||
|
|
||||||
if [ ! -z "$CONVERT" ] && "$CONVERT" && [[ "$type" == "source" ]]; then
|
if [ ! -z "$CONVERT" ] && "$CONVERT" && [[ "$type" == "source" ]]; then
|
||||||
args=()
|
args=()
|
||||||
|
@ -17,7 +17,7 @@ while getopts "d" flag; do
|
|||||||
case "$flag" in
|
case "$flag" in
|
||||||
d) DEEP=true
|
d) DEEP=true
|
||||||
shopt -s globstar;;
|
shopt -s globstar;;
|
||||||
*) echo "Unknown flag ${flag}"
|
*) >&2 echo "Unknown flag ${flag}"
|
||||||
exit 2;;
|
exit 2;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -27,7 +27,7 @@ if [ -z "${@:$OPTIND:1}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! [ -d "${@:$OPTIND:1}" ]; then
|
if ! [ -d "${@:$OPTIND:1}" ]; then
|
||||||
echo "The given path is not a directory"
|
>&2 echo "The given path is not a directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -48,13 +48,19 @@ create_entry() {
|
|||||||
info="info:"$'\n'
|
info="info:"$'\n'
|
||||||
info+=$(tar -xf "$pkg" pkg.info -O | sed 's/^/ /g')
|
info+=$(tar -xf "$pkg" pkg.info -O | sed 's/^/ /g')
|
||||||
package=$(echo "$info" | grep 'name: ' | xargs | awk '{print $2}')
|
package=$(echo "$info" | grep 'name: ' | xargs | awk '{print $2}')
|
||||||
|
if ! echo "$info" | grep -q '^ type: binary'; then
|
||||||
|
>&2 echo "The following package is not a binary package: ${package}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if containsElement "$package" "${PKGS[@]}"; then
|
if containsElement "$package" "${PKGS[@]}"; then
|
||||||
echo "The following package was found in more than 1 package archives: ${package}"
|
>&2 echo "The following package was found in more than 1 package archives: ${package}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PKGS+=("$package")
|
PKGS+=("$package")
|
||||||
file="$(realpath -s --relative-to="$REPO" "$pkg")"
|
file="$(realpath -s --relative-to="$REPO" "$pkg")"
|
||||||
info+=$'\n'"download: ${file}"
|
info+=$'\n'"download: ${file}"
|
||||||
|
info+=$'\n'"download_size: "$(cat "$pkg" | wc -c)
|
||||||
|
info+=$'\n'"installed_size: "$(tar -xf "$pkg" files.tar.gz -O | zcat | wc -c)
|
||||||
info+=$'\n---'
|
info+=$'\n---'
|
||||||
echo "$info"
|
echo "$info"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user