diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-25 14:39:05 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-25 17:28:30 -0400 |
commit | 6092b9d93df1c3d5170a2b6aa0275aebef18bd37 (patch) | |
tree | 55627e026fa7f538f8085f0fb8ed1fffcce4fcbc /src/chroot-tools/librechroot | |
parent | aedbebb0ea3c7b40dda987b43ff21475ef67f423 (diff) |
start moving things to use the libremessages exit codes
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-x | src/chroot-tools/librechroot | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index db4c87b..19ae9ce 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -83,7 +83,7 @@ hack_arch_nspawn_flags() { package. If you have it installed, but still see this message, you may need to restart %s.' \ binfmt-qemu-static systemd-binfmt.service - return 1 + return $EXIT_NOTINSTALLED fi # Let qemu/binfmt_misc do its thing @@ -302,7 +302,7 @@ main() { if ! [[ -f "/usr/share/pacman/defaults/pacman.conf.$OPTARG" && -f "/usr/share/pacman/defaults/makepkg.conf.$OPTARG" ]]; then error 'Unsupported architecture: %s' "$OPTARG" plain 'See the files in %q for valid architectures.' /usr/share/pacman/defaults/ - return 1; + return $EXIT_INVALIDARGUMENT; fi trap 'rm -f -- "$tmppacmanconf"' EXIT tmppacmanconf="$(mktemp --tmpdir librechroot-pacman.conf.XXXXXXXXXX)" @@ -313,20 +313,20 @@ main() { );; w) sysd_nspawn_flags+=("--bind=$OPTARG");; r) sysd_nspawn_flags+=("--bind-ro=$OPTARG");; - *) usage >&2; return 1;; + *) usage >&2; return $EXIT_INVALIDARGUMENT;; esac done shift $((OPTIND - 1)) if [[ $# -lt 1 ]]; then error "Must specify a command" usage >&2 - return 1 + return $EXIT_INVALIDARGUMENT fi mode=$1 if ! in_array "$mode" "${commands[@]}"; then error "Unrecognized command: %s" "$mode" usage >&2 - return 1 + return $EXIT_INVALIDARGUMENT fi shift case "$mode" in @@ -334,14 +334,14 @@ main() { if [[ $# -gt 0 ]]; then error 'Command `%s` does not take any arguments: %s' "$mode" "$*" usage >&2 - return 1 + return $EXIT_INVALIDARGUMENT fi :;; install-file) if [[ $# -lt 1 ]]; then error 'Command `%s` requires at least one file' "$mode" usage >&2 - return 1 + return $EXIT_INVALIDARGUMENT else local missing=() local file @@ -352,7 +352,7 @@ main() { done if [[ ${#missing[@]} -gt 0 ]]; then error "%s: file(s) not found: %s" "$mode" "${missing[*]}" - return 1 + return $EXIT_INVALIDARGUMENT fi fi :;; @@ -360,14 +360,14 @@ main() { if [[ $# -lt 1 ]]; then error 'Command `%s` requires at least one package name' "$mode" usage >&2 - return 1 + return $EXIT_INVALIDARGUMENT fi :;; run) if [[ $# -lt 1 ]]; then error 'Command `%s` requires at least one argument' "$mode" usage >&2 - return 1 + return $EXIT_INVALIDARGUMENT fi :;; esac @@ -375,7 +375,7 @@ main() { if [[ $mode == help ]]; then usage - return 0 + return $EXIT_SUCCESS fi load_conf chroot.conf CHROOTDIR CHROOT @@ -390,7 +390,7 @@ main() { if (( EUID )); then error "This program must be run as root." - return 1 + return $EXIT_NOPERMISSION fi umask 0022 @@ -402,7 +402,7 @@ main() { plain "https://bugs.freedesktop.org/show_bug.cgi?id=70290" prose "Due to a bug in systemd-nspawn, redirecting stdin is not supported." >&2 - return 1 + return $EXIT_FAILURE fi # Keep this lock for as long as we are running @@ -413,7 +413,7 @@ main() { if [[ $mode != delete ]]; then if ! check_mountpoint "$copydir.lock"; then error "Chroot copy is mounted with nosuid or noexec options: [%s]" "$COPY" - return 1 + return $EXIT_FAILURE fi if [[ ! -d $rootdir ]]; then |