0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-09 23:55:29 +00:00
Files
termux-packages/scripts/build/termux_step_create_debscripts.sh
agnostic-apollo 72d03486e5 enhance(build-package.sh): extract termux_step_create_debscripts() function to file and provide termux_step_create_debscripts__copy_from_dir() for packages to copy debscripts from a custom directory into the current DEBIAN working directory
For example:

```shell
termux_step_create_debscripts() {
	termux_step_create_debscripts__copy_from_dir "$TERMUX_PKG_SRCDIR/build/output/packaging/debian" .
}
```
2025-03-22 05:45:48 +05:00

33 lines
796 B
Bash

termux_step_create_debscripts() {
return 0
}
termux_step_create_debscripts__copy_from_dir() {
local return_value
local src_dir="${1:-}"
local dest_dir="${2:-}"
if [[ ! -d "$src_dir" ]]; then
echo "Failed to find source directory '$src_dir' to copy debscripts from" 1>&2
return 1
fi
return_value=0
mkdir -p "$dest_dir" || return_value=$?
if [ $return_value -ne 0 ]; then
echo "Failed to create destination directory '$dest_dir' to copy debscripts to" 1>&2
return 1
fi
(
find "$src_dir" -mindepth 1 -maxdepth 1 -type f \
-regextype posix-extended -regex "^.*/(postinst|postrm|preinst|prerm|config|conffiles|templates|triggers|clilibs|fortran_mod|runit|shlibs|starlibs|symbols)$" \
-print0 | xargs -0 -n1 sh -c \
'cp -a "$0" '"'${dest_dir//\'/\'\\\'\'}/'"
)
}