mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 01:46:19 +02:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
905198295d | ||
![]() |
03611dc63e | ||
![]() |
7aac293d76 | ||
![]() |
6db31cc16a | ||
![]() |
4ee45fe6d4 | ||
![]() |
0b2ae245f1 | ||
![]() |
fdd079f3d5 | ||
![]() |
9f7ba3d407 |
@@ -37,8 +37,8 @@ while getopts 'hC:M:c:' arg; do
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
(( $EUID != 0 )) && die 'This script must be run as root.'
|
||||
(( $# < 1 )) && die 'You must specify a directory.'
|
||||
check_root "$0" "$@"
|
||||
|
||||
working_dir=$(readlink -f "$1")
|
||||
shift 1
|
||||
|
@@ -40,9 +40,7 @@ done
|
||||
# Pass all arguments after -- right to makepkg
|
||||
makechrootpkg_args+=("${@:$OPTIND}")
|
||||
|
||||
if (( EUID )); then
|
||||
die 'This script must be run as root.'
|
||||
fi
|
||||
check_root "$0" "$@"
|
||||
|
||||
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||
msg "Creating chroot for [${repo}] (${arch})..."
|
||||
|
@@ -65,12 +65,12 @@ setup_workdir() {
|
||||
|
||||
cleanup() {
|
||||
[[ -n $WORKDIR ]] && rm -rf "$WORKDIR"
|
||||
[[ $1 ]] && exit $1
|
||||
exit ${1:-0}
|
||||
}
|
||||
|
||||
abort() {
|
||||
msg 'Aborting...'
|
||||
cleanup 0
|
||||
error 'Aborting...'
|
||||
cleanup 255
|
||||
}
|
||||
|
||||
trap_abort() {
|
||||
@@ -85,7 +85,7 @@ trap_exit() {
|
||||
|
||||
die() {
|
||||
(( $# )) && error "$@"
|
||||
cleanup 1
|
||||
cleanup 255
|
||||
}
|
||||
|
||||
trap 'trap_abort' INT QUIT TERM HUP
|
||||
@@ -114,7 +114,7 @@ get_full_version() {
|
||||
pkgbase=${pkgbase:-${pkgname[0]}}
|
||||
epoch=${epoch:-0}
|
||||
if [[ -z $1 ]]; then
|
||||
if [[ $epoch ]] && (( ! $epoch )); then
|
||||
if (( ! epoch )); then
|
||||
echo $pkgver-$pkgrel
|
||||
else
|
||||
echo $epoch:$pkgver-$pkgrel
|
||||
@@ -228,3 +228,16 @@ find_cached_package() {
|
||||
return 1
|
||||
esac
|
||||
}
|
||||
|
||||
##
|
||||
# usage : check_root ("$0" "$@")
|
||||
##
|
||||
check_root() {
|
||||
(( EUID == 0 )) && return
|
||||
if type -P sudo >/dev/null; then
|
||||
exec sudo -- "$@"
|
||||
else
|
||||
exec su root -c "$(printf '%q' "$@")"
|
||||
fi
|
||||
die 'This script must be run as root.'
|
||||
}
|
||||
|
@@ -35,8 +35,8 @@ src_owner=${SUDO_USER:-$USER}
|
||||
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. All unrecognized arguments passed to this script'
|
||||
echo ' will be passed to makepkg.'
|
||||
echo ' clean chroot. Arguments passed to this script after the'
|
||||
echo ' 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'
|
||||
@@ -78,11 +78,10 @@ while getopts 'hcur:I:l:nTD:d:' arg; do
|
||||
l) copy="$OPTARG" ;;
|
||||
n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
|
||||
T) temp_chroot=true; copy+="-$$" ;;
|
||||
*) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
(( EUID != 0 )) && die 'This script must be run as root.'
|
||||
check_root "$0" "$@"
|
||||
|
||||
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
||||
|
||||
@@ -158,6 +157,9 @@ create_chroot() {
|
||||
# Drop the read lock again
|
||||
exec 8>&-
|
||||
fi
|
||||
|
||||
# Update mtime
|
||||
touch "$copydir"
|
||||
}
|
||||
|
||||
clean_temporary() {
|
||||
|
@@ -30,8 +30,8 @@ CHOST="i686-pc-linux-gnu"
|
||||
# -march (or -mcpu) builds exclusively for an architecture
|
||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||
CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
||||
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
||||
CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
||||
#-- Make Flags: change this for DistCC/SMP systems
|
||||
#MAKEFLAGS="-j2"
|
||||
|
@@ -30,8 +30,8 @@ CHOST="x86_64-unknown-linux-gnu"
|
||||
# -march (or -mcpu) builds exclusively for an architecture
|
||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
||||
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
||||
#-- Make Flags: change this for DistCC/SMP systems
|
||||
#MAKEFLAGS="-j2"
|
||||
|
@@ -35,9 +35,10 @@ while getopts 'hC:M:c:' arg; do
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
(( $EUID != 0 )) && die 'This script must be run as root.'
|
||||
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
||||
|
||||
check_root "$0" "$@"
|
||||
|
||||
working_dir="$(readlink -f $1)"
|
||||
shift 1
|
||||
|
||||
|
Reference in New Issue
Block a user