summaryrefslogtreecommitdiff
path: root/src/chroot-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/chroot-tools')
-rwxr-xr-xsrc/chroot-tools/librechroot28
-rwxr-xr-xsrc/chroot-tools/libremakepkg16
2 files changed, 22 insertions, 22 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
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index 02b31a8..841f533 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -83,9 +83,9 @@ run_hook() {
if [[ ${#fails[@]} -gt 0 ]]; then
error "Failure(s) in %s: %s" "$hookname" "${fails[*]}"
- return 1
+ return $EXIT_FAILURE
else
- return 0
+ return $EXIT_SUCCESS
fi
}
@@ -176,7 +176,7 @@ usage() {
err_chflag() {
local flag=$1
error 'The -%s flag does not make sense inside of a chroot' "$flag"
- return 1
+ exit $EXIT_INVALIDARGUMENT
}
main() {
@@ -197,14 +197,14 @@ main() {
librechroot_flags+=(-$flag "$OPTARG"); fi;;
N) NONET=false;;
R) repack=true; makepkg_args+=(-R);;
- h) usage; return 0;;
- *) usage >&2; return 1;;
+ h) usage; exit $EXIT_SUCCESS;;
+ *) usage >&2; exit $EXIT_INVALIDARGUMENT;;
esac
done
shift $((OPTIND - 1))
if [[ $# != 0 ]]; then
error 'Extra arguments: %s' "$*"
- return 1
+ exit $EXIT_INVALIDARGUMENT
fi
# Resolve the chroot path ##############################################
@@ -236,13 +236,13 @@ main() {
if (( EUID )); then
error "This program must be run as root"
- exit 1
+ exit $EXIT_NOPERMISSION
fi
if [[ ! -f PKGBUILD ]]; then
# This is the message used by makepkg
error "PKGBUILD does not exist."
- exit 1
+ exit $EXIT_FAILURE
fi
# Make sure that the various *DEST directories exist