summaryrefslogtreecommitdiff
path: root/src/chroot-tools/librechroot
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-11 10:52:43 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-11 15:43:37 -0400
commit7f62d865ae7384f4c4bd489e2682ba52fabb7b62 (patch)
tree46d698d171d551ff412a0843d2ca90dfce7088e3 /src/chroot-tools/librechroot
parent834db9d400be1795426eb88cf25c9e817141d326 (diff)
chroot-tools: internationalize
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-xsrc/chroot-tools/librechroot155
1 files changed, 77 insertions, 78 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 91afe3e..e82b18c 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -44,82 +44,81 @@ make_empty_repo() {
ln -s "repo.db.tar.gz" "${copydir}/repo/repo.db"
}
-cmd=${0##*/}
usage() {
calculate_directories
- echo "Usage: $cmd [OPTIONS] COMMAND [ARGS...]"
- echo 'Interacts with an archroot (arch chroot).'
- echo ''
- echo 'This is configured with `chroot.conf`, either in'
- echo '`/etc/libretools.d/`, or `$XDG_CONFIG_HOME/libretools/`.'
- echo 'The variables you may set are $CHROOTDIR, $CHROOT, and'
- echo '$CHROOTEXTRAPKG'.
- echo ''
- echo 'There may be multiple chroots; they are stored in $CHROOTDIR.'
- echo ''
- echo 'Each chroot is named; the default is configured with $CHROOT.'
- echo ''
- echo "Each named chroot has a master clean copy (named 'root'), and any"
- echo 'number of other named copies; the copy used by default is the'
- echo "current username (or \$SUDO_USER, or 'copy' if root)."
- echo ''
- echo 'The full path to the chroot copy is "$CHROOTDIR/$CHROOT/$COPY",'
- echo 'unless the copy name is manually specified as an absolute path,'
- echo 'in which case, that path is used.'
- echo ''
- echo 'The current settings for the above varibles are:'
- echo " CHROOTDIR : ${CHROOTDIR:-ERROR: NO SETTING}"
- echo " CHROOT : ${CHROOT:-ERROR: NO SETTING}"
- echo " COPY : $COPY"
- echo " rootdir : ${rootdir:-ERROR}"
- echo " copydir : ${copydir:-ERROR}"
- echo ''
- echo 'If the chroot, or copy does not exist, it will be created'
- echo 'automatically. A chroot by default contains the packages in the'
- echo 'group "base-devel", and any packages named in $CHROOTEXTRAPKG.'
- echo 'Unless the `-C` or `-M` flags are used, the configuration files'
- echo 'that this program installs are the stock versions supplied in the'
- echo 'packages, not the versions from your host system. Other tools'
- echo '(such as libremakepkg) may alter the configuration.'
- echo ''
- echo 'This command will make the following configuration changes in'
- echo 'the chroot:'
- echo ' - overwrite `/etc/libretools.d/chroot.conf`'
- echo ' - overwrite `/etc/pacman.d/mirrorlist`'
- echo ' - set `CacheDir` in `/etc/pacman.conf`'
- echo 'If a new `pacman.conf` is inserted with the `-C` flag, the change'
- echo "is made after the file is copied in; the \`-C\` flag doesn't stop"
- echo 'the change from being effective.'
- echo ''
- echo 'Creating a copy, deleting a copy, or syncing a copy can be fairly'
- echo 'slow; but are very fast if $CHROOTDIR is on a btrfs partition.'
- echo ''
- echo 'Options:'
- echo ' -n <CHROOT> Name of the chroot to use'
- echo ' -l <COPY> Name of, or absolute path to, the copy to use'
- echo ' -N Disable networking in the chroot'
- echo ' -C <file> Copy this file to `$copydir/etc/pacman.conf`'
- echo ' -M <file> Copy this file to `$copydir/etc/makepkg.conf`'
- echo ''
- echo 'Commands:'
- echo ' Create/copy/delete:'
- echo ' noop|make Do not do anything, but still creates the'
- echo ' chroot copy if it does not exist'
- echo " sync Sync the copy with the clean ('root') copy"
- echo " delete delete the chroot copy"
- echo ' Dealing with packages:'
- echo ' install-file FILES... Like `pacman -U FILES...`'
- echo ' install-name NAMES... Like `pacman -S NAMES...`'
- echo ' update Like `pacman -Syu`'
- echo ' clean-pkgs Remove all packages from the chroot copy that'
- echo ' are not in base-devel, $CHROOTEXTRAPKG, or'
- echo ' named as a dependency in the file'
- echo ' `/build/PKGBUILD` in the chroot copy'
- echo ' Other:'
- echo ' run CMD... Run CMD in the chroot copy'
- echo ' enter Enter an interactive shell in the chroot copy'
- echo ' clean-repo Clean /repo in the chroot copy'
- echo ' help Show this message'
+ print "Usage: %s [OPTIONS] COMMAND [ARGS...]" "${0##*/}"
+ print 'Interacts with an archroot (arch chroot).'
+ echo
+ prose 'This is configured with `chroot.conf`, either in
+ `/etc/libretools.d/`, or `$XDG_CONFIG_HOME/libretools/`.
+ The variables you may set are $CHROOTDIR, $CHROOT, and
+ $CHROOTEXTRAPKG.'
+ echo
+ prose 'There may be multiple chroots; they are stored in $CHROOTDIR.'
+ echo
+ prose 'Each chroot is named; the default is configured with $CHROOT.'
+ echo
+ prose 'Each named chroot has a master clean copy (named `root`), and any
+ number of other named copies; the copy used by default is the
+ current username (or $SUDO_USER, or `copy` if root).'
+ echo
+ prose 'The full path to the chroot copy is "$CHROOTDIR/$CHROOT/$COPY",
+ unless the copy name is manually specified as an absolute path,
+ in which case, that path is used.'
+ echo
+ prose 'The current settings for the above varibles are:'
+ printf ' CHROOTDIR : %s\n' "${CHROOTDIR:-$(_ 'ERROR: NO SETTING')}"
+ printf ' CHROOT : %s\n' "${CHROOT:-$(_ 'ERROR: NO SETTING')}"
+ printf ' COPY : %s\n' "$COPY"
+ printf ' rootdir : %s\n' "${rootdir:-$(_ 'ERROR')}"
+ printf ' copydir : %s\n' "${copydir:-$(_ 'ERROR')}"
+ echo
+ prose 'If the chroot, or copy does not exist, it will be created
+ automatically. A chroot by default contains the packages in the
+ group "base-devel", and any packages named in $CHROOTEXTRAPKG.
+ Unless the `-C` or `-M` flags are used, the configuration files
+ that this program installs are the stock versions supplied in the
+ packages, not the versions from your host system. Other tools
+ (such as libremakepkg) may alter the configuration.'
+ echo
+ prose 'This command will make the following configuration changes in the
+ chroot:'
+ bullet 'overwrite `/etc/libretools.d/chroot.conf`'
+ bullet 'overwrite `/etc/pacman.d/mirrorlist`'
+ bullet 'set `CacheDir` in `/etc/pacman.conf`'
+ prose 'If a new `pacman.conf` is inserted with the `-C` flag, the change
+ is made after the file is copied in; the `-C` flag doesn'\''t
+ stop the change from being effective.'
+ echo
+ prose 'Creating a copy, deleting a copy, or syncing a copy can be fairly
+ slow; but are very fast if $CHROOTDIR is on a btrfs partition.'
+ echo
+ print 'Options:'
+ flag "-n <$(_ CHROOT)>" 'Name of the chroot to use'
+ flag "-l <$(_ COPY)>" 'Name of, or absolute path to, the copy to use'
+ flag '-N' 'Disable networking in the chroot'
+ flag "-C <$(_ FILE)>" 'Copy this file to `$copydir/etc/pacman.conf`'
+ flag "-M <$(_ FILE)>" 'Copy this file to `$copydir/etc/makepkg.conf`'
+ echo
+ print 'Commands:'
+ print ' Create/copy/delete:'
+ flag 'noop|make' 'Do not do anything, but still creates the chroot
+ copy if it does not exist'
+ flag 'sync' 'Sync the copy with the clean (`root`) copy'
+ flag 'delete' 'Delete the chroot copy'
+ print ' Dealing with packages:'
+ flag "install-file $(_ FILES...)" 'Like `pacman -U FILES...`'
+ flag "install-name $(_ NAMES...)" 'Like `pacman -S NAMES...`'
+ flag 'update' 'Like `pacman -Syu`'
+ flag 'clean-pkgs' 'Remove all packages from the chroot copy that
+ are not in base-devel, $CHROOTEXTRAPKG, or named
+ as a dependency in the file `/build/PKGBUILD` in
+ the chroot copy'
+ print ' Other:'
+ flag "run $(_ CMD...)" 'Run CMD in the chroot copy'
+ flag 'enter' 'Enter an interactive shell in the chroot copy'
+ flag 'clean-repo' 'Clean /repo in the chroot copy'
+ flag 'help' 'Show this message'
}
commands=(
noop make sync delete
@@ -177,7 +176,7 @@ main() {
fi
mode=$1
if ! in_array "$mode" "${commands[@]}"; then
- error "Unrecognized command: \`$mode'"
+ error "Unrecognized command: %s" "$mode"
usage >/dev/stderr
return 1
fi
@@ -203,10 +202,10 @@ main() {
# Keep this lock as long as we are running
# Note that '9' is the same FD number as in (mk)archroot
lock_open_write 9 "$copydir" \
- "Waiting for existing lock on chroot copy to be released: [$COPY]"
+ "Waiting for existing lock on chroot copy to be released: [%s]" "$COPY"
if [[ ! -d $rootdir ]]; then
- msg "Creating 'root' copy for chroot [$CHROOT]"
+ msg "Creating 'root' copy for chroot [%s]" "$CHROOT"
set +u # if archroot_args is empty, it counts as unbound
archroot "${archroot_args[@]}" -m "$rootdir" base-devel
set -u
@@ -214,7 +213,7 @@ main() {
fi
if [[ ! -d $copydir ]] || [[ $mode == sync ]]; then
- msg "Syncing copy [$COPY] with root copy"
+ msg "Syncing copy [%s] with root copy" "$COPY"
normshell chroot_sync "$CHROOTDIR/$CHROOT" "$COPY"
fi