#!/hint/bash # Copyright (C) 2024 Umorpha Systems # SPDX-License-Identifier: AGPL-3.0-or-later source "${install_prefix}/lib/mk/shellcheck.sh" formats+=('tar') format_is_block['tar']='false' # Option parsing ##################################################### format_options['tar']='' format_checkconf:erofs() { shellcheck:format_checkconf if $arg_edit; then argparse:error '--conf=format=tar does not support --edit' fi if [[ ${arg_conf[bootloader]} != none ]]; then argparse:error '--conf=format=tar requires --conf=bootloader=none' fi } # format_is_block[…]='false' settings ################################ format_wants_tmpfs['tar']='true' format_after_clamps_mtime['tar']='false' format_before:tar() { : } format_after:tar() ( shellcheck:format_after local tmpdir tmpdir=$(mktemp -dt -- "${0##*/}.tar.XXXXXXXXXX") trap "rm -f -- ${tmpdir@Q}/file.tar; rmdir -- ${tmpdir@Q}" EXIT # This mimics the bsdtar flags of makepkg(8). (cd "$mount_dev" && osi.sh:sudo find . -print0) | LC_COLLATE=C sort -z | osi.sh:sudo \ bsdtar -C "$mount_dev" \ --no-fflags --no-read-sparse \ --norecurse --null --files-from - \ --create --file "$tmpdir/file.tar" cp -T "$tmpdir/file.tar" "$arg_file" ) shellcheck:format