avoid injecting code into the format string
Now that die() properly forwards arguments to error(), we can expect that the first arg is a format string and not the entirety of the output. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
This commit is contained in:
parent
fb30cabe61
commit
be3c71fa81
|
@ -88,9 +88,9 @@ umask 0022
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [[ ! -f "$working_dir/.arch-chroot" ]]; then
|
if [[ ! -f "$working_dir/.arch-chroot" ]]; then
|
||||||
die "'$working_dir' does not appear to be a Arch chroot."
|
die "'%s' does not appear to be a Arch chroot." "$working_dir"
|
||||||
elif [[ $(cat "$working_dir/.arch-chroot") != $CHROOT_VERSION ]]; then
|
elif [[ $(cat "$working_dir/.arch-chroot") != $CHROOT_VERSION ]]; then
|
||||||
die "chroot '$working_dir' is not at version $CHROOT_VERSION. Please rebuild."
|
die "chroot '%s' is not at version %s. Please rebuild." "$working_dir" "$CHROOT_VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_mount_args
|
build_mount_args
|
||||||
|
|
|
@ -15,7 +15,7 @@ case $scriptname in
|
||||||
communityco)
|
communityco)
|
||||||
SVNURL="svn+ssh://svn-community@nymeria.archlinux.org/srv/repos/svn-community/svn";;
|
SVNURL="svn+ssh://svn-community@nymeria.archlinux.org/srv/repos/svn-community/svn";;
|
||||||
*)
|
*)
|
||||||
die "Couldn't find svn url for $scriptname"
|
die "Couldn't find svn url for %s" "$scriptname"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ FORCE=
|
||||||
while getopts ':f' flag; do
|
while getopts ':f' flag; do
|
||||||
case $flag in
|
case $flag in
|
||||||
f) FORCE=1 ;;
|
f) FORCE=1 ;;
|
||||||
:) die "Option requires an argument -- '$OPTARG'" ;;
|
:) die "Option requires an argument -- '%s'" "$OPTARG" ;;
|
||||||
\?) die "Invalid option -- '$OPTARG'" ;;
|
\?) die "Invalid option -- '%s'" "$OPTARG" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
@ -23,7 +23,7 @@ fi
|
||||||
if [[ -z $FORCE ]]; then
|
if [[ -z $FORCE ]]; then
|
||||||
for tag in "$@"; do
|
for tag in "$@"; do
|
||||||
if ! in_array "$tag" "${_tags[@]}"; then
|
if ! in_array "$tag" "${_tags[@]}"; then
|
||||||
die 'archrelease: Invalid tag: "'$tag'" (use -f to force release)'
|
die "archrelease: Invalid tag: '%s' (use -f to force release)" "$tag"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -41,13 +41,13 @@ for _pkgname in "${pkgname[@]}"; do
|
||||||
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
die "Couldn't download previous package for $_pkgname."
|
die "Couldn't download previous package for %s." "$_pkgname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
oldpkg=${pkgurl##*://*/}
|
oldpkg=${pkgurl##*://*/}
|
||||||
|
|
||||||
if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
|
if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
|
||||||
die "The built package ($_pkgname) is the one in the repo right now!"
|
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $oldpkg ]]; then
|
if [[ ! -f $oldpkg ]]; then
|
||||||
|
|
10
commitpkg.in
10
commitpkg.in
|
@ -58,7 +58,7 @@ esac
|
||||||
# check if all local source files are under version control
|
# check if all local source files are under version control
|
||||||
for s in "${source[@]}"; do
|
for s in "${source[@]}"; do
|
||||||
if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then
|
if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then
|
||||||
die "$s is not under version control"
|
die "%s is not under version control" "$s"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ for i in 'changelog' 'install'; do
|
||||||
# evaluate any bash variables used
|
# evaluate any bash variables used
|
||||||
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
||||||
if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then
|
if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then
|
||||||
die "${file} is not under version control"
|
die "%s is not under version control" "$file"
|
||||||
fi
|
fi
|
||||||
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
||||||
done
|
done
|
||||||
|
@ -81,8 +81,8 @@ while getopts ':l:a:s:f' flag; do
|
||||||
s) server=$OPTARG ;;
|
s) server=$OPTARG ;;
|
||||||
l) rsyncopts+=("--bwlimit=$OPTARG") ;;
|
l) rsyncopts+=("--bwlimit=$OPTARG") ;;
|
||||||
a) commit_arch=$OPTARG ;;
|
a) commit_arch=$OPTARG ;;
|
||||||
:) die "Option requires an argument -- '$OPTARG'" ;;
|
:) die "Option requires an argument -- '%s'" "$OPTARG" ;;
|
||||||
\?) die "Invalid option -- '$OPTARG'" ;;
|
\?) die "Invalid option -- '%s'" "$OPTARG" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
@ -164,7 +164,7 @@ for _arch in ${arch[@]}; do
|
||||||
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
|
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
|
||||||
fi
|
fi
|
||||||
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
|
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
|
||||||
die "Signature ${pkgfile}.sig is incorrect!"
|
die "Signature %s.sig is incorrect!" "$pkgfile"
|
||||||
fi
|
fi
|
||||||
uploads+=("$sigfile")
|
uploads+=("$sigfile")
|
||||||
done
|
done
|
||||||
|
|
|
@ -25,7 +25,7 @@ case $scriptname in
|
||||||
target_repo='extra'
|
target_repo='extra'
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "Couldn't find configuration for $scriptname"
|
die "Couldn't find configuration for %s" "$scriptname"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ script_mode=${0##*/find-lib}
|
||||||
|
|
||||||
case $script_mode in
|
case $script_mode in
|
||||||
deps|provides) true;;
|
deps|provides) true;;
|
||||||
*) die "Unknown mode $script_mode" ;;
|
*) die "Unknown mode %s" "$script_mode" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
|
|
|
@ -81,8 +81,8 @@ done
|
||||||
|
|
||||||
# Canonicalize chrootdir, getting rid of trailing /
|
# Canonicalize chrootdir, getting rid of trailing /
|
||||||
chrootdir=$(readlink -e "$passeddir")
|
chrootdir=$(readlink -e "$passeddir")
|
||||||
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '$passeddir'"
|
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
|
||||||
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot $chrootdir/root base-devel"
|
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"
|
||||||
|
|
||||||
# Detect chrootdir filesystem type
|
# Detect chrootdir filesystem type
|
||||||
chroottype=$(stat -f -c %T "$chrootdir")
|
chroottype=$(stat -f -c %T "$chrootdir")
|
||||||
|
@ -136,10 +136,10 @@ create_chroot() {
|
||||||
if [[ "$chroottype" == btrfs ]]; then
|
if [[ "$chroottype" == btrfs ]]; then
|
||||||
if [[ -d $copydir ]]; then
|
if [[ -d $copydir ]]; then
|
||||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||||
die "Unable to delete subvolume $copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
fi
|
fi
|
||||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||||
die "Unable to create subvolume $copydir"
|
die "Unable to create subvolume %s" "$copydir"
|
||||||
else
|
else
|
||||||
mkdir -p "$copydir"
|
mkdir -p "$copydir"
|
||||||
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||||
|
@ -155,11 +155,11 @@ clean_temporary() {
|
||||||
stat_busy "Removing temporary copy [$copy]"
|
stat_busy "Removing temporary copy [$copy]"
|
||||||
if [[ "$chroottype" == btrfs ]]; then
|
if [[ "$chroottype" == btrfs ]]; then
|
||||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||||
die "Unable to delete subvolume $copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
else
|
else
|
||||||
# avoid change of filesystem in case of an umount failure
|
# avoid change of filesystem in case of an umount failure
|
||||||
rm --recursive --force --one-file-system "$copydir" ||
|
rm --recursive --force --one-file-system "$copydir" ||
|
||||||
die "Unable to delete $copydir"
|
die "Unable to delete %s" "$copydir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove lock file
|
# remove lock file
|
||||||
|
@ -362,7 +362,7 @@ if (( ret != 0 )); then
|
||||||
if $temp_chroot; then
|
if $temp_chroot; then
|
||||||
die "Build failed"
|
die "Build failed"
|
||||||
else
|
else
|
||||||
die "Build failed, check $copydir/build"
|
die "Build failed, check %s/build" "$copydir"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
|
|
@ -51,7 +51,7 @@ fi
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
[[ -e $working_dir ]] && die "Working directory '$working_dir' already exists"
|
[[ -e $working_dir ]] && die "Working directory '%s' already exists" "$working_dir"
|
||||||
|
|
||||||
mkdir -p "$working_dir"
|
mkdir -p "$working_dir"
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ lock 9 "${working_dir}.lock" "Locking chroot"
|
||||||
if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then
|
if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then
|
||||||
rmdir "$working_dir"
|
rmdir "$working_dir"
|
||||||
if ! btrfs subvolume create "$working_dir"; then
|
if ! btrfs subvolume create "$working_dir"; then
|
||||||
die "Couldn't create subvolume for '$working_dir'"
|
die "Couldn't create subvolume for '%s'" "$working_dir"
|
||||||
fi
|
fi
|
||||||
chmod 0755 "$working_dir"
|
chmod 0755 "$working_dir"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue