diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2020-08-19 14:17:54 -0400 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2022-08-30 21:29:18 -0400 |
commit | e9ad93ac412a0fb2d99ef739db50a4b9c503a059 (patch) | |
tree | d5d7237e2a5950c0b061fcbc01069cc728c56a25 | |
parent | cdc9f18d5f8c591eff6d49d02a7ec0e7511e60b8 (diff) |
use translatable libretools messages for usage() and parabola additions
-rw-r--r-- | chroot-run.in | 33 | ||||
-rw-r--r-- | makechrootpkg.in | 106 | ||||
-rw-r--r-- | mkarchroot.in | 19 |
3 files changed, 86 insertions, 72 deletions
diff --git a/chroot-run.in b/chroot-run.in index 4d832ec..5534684 100644 --- a/chroot-run.in +++ b/chroot-run.in @@ -13,6 +13,7 @@ m4_include(lib/common.sh) m4_include(lib/archroot.sh) m4_include(lib/mount.sh) +m4_include(lib/messages.sh) # $1: chroot kill_chroot_process(){ @@ -43,21 +44,25 @@ mount_args=("-B:/etc/hosts:/etc/hosts") unshare_args=("-Cfimu") usage() { - echo "Usage: ${0##*/} [options] working-dir [chroot arguments]" - echo "A wrapper around chroot. Provides support for pacman." + print "Usage: %s [options] working-dir [systemd-nspawn arguments]" "${0##*/}" echo - echo ' options:' - echo ' -C <file> Location of a pacman config file' - echo ' -M <file> Location of a makepkg config file' - echo ' -c <dir> Set pacman cache' - echo ' -f <file> Copy file from the host to the chroot' - echo ' This option may be given multiple times' - echo ' -s Do not run setarch' - echo ' -b <args> Bind mountargs' - echo " <args> format: 'mntarg:srcdir:destdir'" - echo ' This option may be given multiple times' - echo ' -N Disable networking' - echo ' -h This message' + prose 'A wrapper around systemd-nspawn (for systemd systems), + and chroot-nspawn (for nonsystemd systemd), + to provide support for pacman.' + echo + flag "Options:" \ + "-C <$(_ FILE)>" 'Location of a pacman config file' \ + "-M <$(_ FILE)>" 'Location of a makepkg config file' \ + "-c <$(_ PATH)>" 'Set pacman cache directory' \ + "-f <$(_ FILE)>" 'Copy <FILE> from the host to the chroot + This option may be given multiple times' \ + '-s' 'Do not run setarch' \ + "-b <$(_ ARGS)>" "Bind mountargs. + <ARGS> format: '[mntarg:srcdir:destdir' + This option may be given multiple times" \ + '-N' 'Disable networking' \ + '-h' 'Show this message' + exit 1 } diff --git a/makechrootpkg.in b/makechrootpkg.in index cd58fb1..61091c8 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -10,59 +10,65 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -m4_include(lib/common.sh) m4_include(lib/archroot.sh) +m4_include(lib/common.sh) +m4_include(lib/messages.sh) shopt -s nullglob usage() { - echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]" - echo ' Run this script in a PKGBUILD dir to build a package inside a' - echo ' clean chroot. Arguments passed to this script after the' - echo ' end-of-options marker (--) will be passed to makepkg.' + print "Usage: %s [options] -r <chrootdir> [--] [makepkg args]" "${0##*/}" + echo '' + prose 'Builds a package inside a clean chroot, assuming that a PKGBUILD + exists in the present working directory. Arguments passed to this + script after the end-of-options marker (--) will be passed to makepkg.' echo '' - echo ' The chroot dir consists of the following directories:' - echo ' <chrootdir>/{root, copy} but only "root" is required' - echo ' by default. The working copy will be created as needed' + prose 'The chroot dir consists of the following directories: + <chrootdir>/{root, copy}; but only "root" is required + by default. The working copy will be created as needed.' echo '' - echo 'The chroot "root" directory must be created via the following' - echo 'command:' - echo ' mkarchroot <chrootdir>/root base-devel' + prose 'The chroot "root" directory must be created via the following + command:' + echo ' mkarchroot <chrootdir>/root base-devel' echo '' - echo 'Note that this script is not normally initiated by the user,' - echo 'but is used internally by `libremakepkg`. `libremakepkg` is the' - echo 'preferred tool for building "release-ready" Parabola packages.' - echo 'When using `libremakepkg`, create the chroot with `librechroot`.' + prose 'Note that this script is not normally initiated by the user, + but is used internally by `libremakepkg`. `libremakepkg` is the + preferred tool for building "release-ready" Parabola packages. + When using `libremakepkg`, create the chroot with `librechroot`.' echo '' - echo 'This script reads {SRC,SRCPKG,PKG,LOG}DEST, MAKEFLAGS and PACKAGER' - echo 'from makepkg.conf(5), if those variables are not part of the' - echo 'environment.' + prose 'This script reads {SRC,SRCPKG,PKG,LOG}DEST, MAKEFLAGS and PACKAGER + from makepkg.conf(5), if those variables are not part of the + environment.' echo '' - echo 'Note that, when run on a PKGBUILD which includes a mksource() function,' - echo 'and if a new libre source-ball was created as a result,' - echo 'or if the libre sources do not match the checksums in the PKGBUILD,' - echo 'this script will inject the correct checksums into the PKGBUILD,' - echo 'fork a new instance of the calling process to handle it' - echo '(usually libremakepkg), and exit immediately' - echo '' - echo "Default makepkg args: ${default_makepkg_args[*]}" + prose 'Note that, when run on a PKGBUILD which includes a mksource() function, + and if a new libre source-ball was created as a result, + or if the libre sources do not match the checksums in the PKGBUILD, + this script will inject the correct checksums into the PKGBUILD, + fork a new instance of the calling process to handle it + (usually libremakepkg), and exit immediately' echo '' - echo 'Flags:' - echo '-h This help' - echo '-c Clean the chroot before building' - echo '-d <dir> Bind directory into build chroot as read-write' - echo '-D <dir> Bind directory into build chroot as read-only' - echo '-u Update the working copy of the chroot before building' - echo ' This is useful for rebuilds without dirtying the pristine' - echo ' chroot' - echo '-r <dir> The chroot dir to use' - echo '-I <pkg> Install a package into the working copy of the chroot' - echo '-l <copy> The directory to use as the working copy of the chroot' - echo ' Useful for maintaining multiple copies' - echo " Default: $copy" - echo '-n Run namcap on the package' - echo '-T Build in a temporary directory' - echo '-U Run makepkg as a specified user' + print "Default makepkg args: %s" "${default_makepkg_args[*]}" + print "Default working copy name: %s" "${copy}" + echo '' + flag 'Options:' \ + '-h' 'This help' \ + '-c' 'Clean the chroot before building' \ + "-d <$(_ DIR)>" 'Bind a directory into build chroot as read-write + This option may be given multiple times' \ + "-D <$(_ DIR)>" 'Bind a directory into build chroot as read-only + This option may be given multiple times' \ + '-u' 'Update the working copy of the chroot before building + This is useful for rebuilds without dirtying the + pristine chroot' \ + "-r <$(_ DIR)>" 'The base dir of the chroot-set to use' \ + "-I <$(_ PKG)>" 'Install a package into the working copy of the chroot + This option may be given multiple times' \ + "-l <$(_ COPY)>" 'The directory to use as the working copy of the chroot + Useful for maintaining multiple copies.' \ + '-n' 'Run namcap on the package' \ + '-T' 'Build in a temporary directory' \ + '-U' 'Run makepkg as a specified user' + exit 1 } @@ -337,25 +343,25 @@ download_sources() { n_libre_sources_out=$(VerifyLibreSources) n_libre_sources_required=${n_libre_sources_out% *} n_libre_sources_exist=${n_libre_sources_out#* } - sums_msg="Running \`updpkgsums\` to account for the newly created libre source-ball(s)" - done_msg="MkSource completed successfully" - restart_msg="Restarting libremakepkg to complete the build" - rerun_msg="Run libremakepkg again to complete the build" - fail_msg="Could not download upstream sources" + sums_msg="$(_ "Running \`updpkgsums\` to account for the newly created libre source-ball(s)")" + done_msg="$(_ "MkSource completed successfully")" + restart_msg="$(_ "Restarting libremakepkg to complete the build")" + rerun_msg="$(_ "Run libremakepkg again to complete the build")" + fail_msg="$(_ "Could not download upstream sources")" this_cmd=( $(ps --pid=$$ --format=args --no-headers) ) h_rule="--$(dd if=/dev/zero bs=${#restart_msg} count=1 2> /dev/null | tr '\0' '-')--" if [[ "$n_libre_sources_out" != "$n_libre_sources_in" ]] && (( n_libre_sources_exist + n_libre_sources_required )) && (( n_libre_sources_exist == n_libre_sources_required )) - then echo "${sums_msg}" + then msg "${sums_msg}" sudo -u "$makepkg_user" updpkgsums - echo "${done_msg}" + msg "${done_msg}" if [[ "${this_cmd[@]}" =~ ([^\ ]*libremakepkg)(\ .*)? ]] then this_cmd=(${BASH_REMATCH[@]:1}) - echo -e "\n${h_rule}\n| ${restart_msg} |\n${h_rule}\n" + printf "\n${h_rule}\n| ${restart_msg} |\n${h_rule}\n" sleep 5 && ${this_cmd[@]} & die_msg='<EMPTY>' diff --git a/mkarchroot.in b/mkarchroot.in index 0f6c408..8b68e86 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -12,20 +12,23 @@ m4_include(lib/common.sh) m4_include(lib/archroot.sh) +m4_include(lib/messages.sh) working_dir='' files=() usage() { - echo "Usage: ${0##*/} [options] working-dir package-list..." - echo ' options:' - echo ' -C <file> Location of a pacman config file' - echo ' -M <file> Location of a makepkg config file' - echo ' -c <dir> Set pacman cache' - echo ' -f <file> Copy file from the host to the chroot' - echo ' -s Do not run setarch' - echo ' -h This message' + print "Usage: %s [options] working-dir package-list..." "${0##*/}" + echo + flag 'Options:' \ + "-C <$(_ FILE)>" 'Location of a pacman config file' \ + "-M <$(_ FILE)>" 'Location of a makepkg config file' \ + "-c <$(_ DIR)>" 'Set pacman cache' \ + "-f <$(_ FILE)>" 'Copy file from the host to the chroot' \ + '-s' 'Do not run setarch' \ + '-h' 'Show this message' + exit 1 } |