From 9f7ba3d40791ca81ebd47e3278f02d4a61e38179 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 4 May 2014 12:59:08 +1000 Subject: Use -fstack-protector-strong Signed-off-by: Allan McRae Signed-off-by: Pierre Schmitz --- makepkg-i686.conf | 4 ++-- makepkg-x86_64.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/makepkg-i686.conf b/makepkg-i686.conf index fcb131f..da249f6 100644 --- a/makepkg-i686.conf +++ b/makepkg-i686.conf @@ -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" diff --git a/makepkg-x86_64.conf b/makepkg-x86_64.conf index 330c242..33dbe99 100644 --- a/makepkg-x86_64.conf +++ b/makepkg-x86_64.conf @@ -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" -- cgit v1.1-4-g5e80 From fdd079f3d542dbce6898512298b4271eb9e7d0d9 Mon Sep 17 00:00:00 2001 From: Joel Teichroeb Date: Sun, 4 May 2014 09:31:53 -0700 Subject: Remove broken unknown arguments check and fix usage If getopts comes across an unknown argument, $arg it set to '?' and $OPTARG is unset. Therefore the getopts line detecting unknown arguments doesn't work. Arguments to pass to makepkg are already handled by passing all the aguments after the end-of-options marker (--), but this wasn't documented in the usage text. Signed-off-by: Pierre Schmitz --- makechrootpkg.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index d03b703..9db0ddd 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -35,8 +35,8 @@ src_owner=${SUDO_USER:-$USER} usage() { echo "Usage: ${0##*/} [options] -r [--] [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 ' /{root, copy} but only "root" is required' @@ -78,7 +78,6 @@ 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 -- cgit v1.1-4-g5e80 From 0b2ae245f1d18e4b0702b5ca1cec323308daef0c Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sun, 4 May 2014 05:07:46 +0200 Subject: Update mtime of chroot when building Makes the chroot mtime a useful indicator of last usage. Signed-off-by: Pierre Schmitz --- makechrootpkg.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makechrootpkg.in b/makechrootpkg.in index 9db0ddd..47c6ac9 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -157,6 +157,9 @@ create_chroot() { # Drop the read lock again exec 8>&- fi + + # Update mtime + touch "$copydir" } clean_temporary() { -- cgit v1.1-4-g5e80 From 4ee45fe6d4e5b317700ca0ac20a800af0b3cef69 Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Sun, 16 Feb 2014 09:55:58 +0100 Subject: abort and die are serious errors so throw 255 out Signed-off-by: BlackEagle Signed-off-by: Pierre Schmitz --- lib/common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index cb9db76..04a282b 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -69,8 +69,8 @@ cleanup() { } 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 -- cgit v1.1-4-g5e80 From 6db31cc16a8044272170204975378ece8eb94e2a Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Sun, 16 Feb 2014 09:55:59 +0100 Subject: when cleanup is called without code exit with 0 Signed-off-by: BlackEagle Signed-off-by: Pierre Schmitz --- lib/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common.sh b/lib/common.sh index 04a282b..1009e90 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -65,7 +65,7 @@ setup_workdir() { cleanup() { [[ -n $WORKDIR ]] && rm -rf "$WORKDIR" - [[ $1 ]] && exit $1 + exit ${1:-0} } abort() { -- cgit v1.1-4-g5e80 From 7aac293d76e4bdf6ceee1cfe5d888060c24f1822 Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Sun, 16 Feb 2014 09:56:00 +0100 Subject: get_full_version :: remove duplicated epoch check Signed-off-by: BlackEagle Signed-off-by: Pierre Schmitz --- lib/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common.sh b/lib/common.sh index 1009e90..c9ff1b8 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -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 -- cgit v1.1-4-g5e80 From 03611dc63e3e44d0504f0d05c3129fbc0b2d1510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Wed, 8 Jan 2014 01:15:37 +0100 Subject: Switch to root when started as regular user In collaborative builder machine, these scripts are often allowed to become root via sudo. This patch avoid to prefix them by sudo each time or call su. Signed-off-by: Pierre Schmitz --- arch-nspawn.in | 2 +- archbuild.in | 4 +--- lib/common.sh | 13 +++++++++++++ makechrootpkg.in | 2 +- mkarchroot.in | 3 ++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/arch-nspawn.in b/arch-nspawn.in index 6900382..4436a0e 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -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 diff --git a/archbuild.in b/archbuild.in index b1c96f9..ae2f511 100644 --- a/archbuild.in +++ b/archbuild.in @@ -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})..." diff --git a/lib/common.sh b/lib/common.sh index c9ff1b8..b885080 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -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.' +} diff --git a/makechrootpkg.in b/makechrootpkg.in index 47c6ac9..97c7780 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -81,7 +81,7 @@ while getopts 'hcur:I:l:nTD:d:' arg; do 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.' diff --git a/mkarchroot.in b/mkarchroot.in index 7cdb274..fb472bc 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -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 -- cgit v1.1-4-g5e80 From 905198295dcb4fffcd16edff3fd7052a4cfc5788 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 10 May 2014 08:09:49 +0200 Subject: Prepare release --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1f3c74d..82a7362 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -V=20131107 +V=20140510 PREFIX = /usr/local -- cgit v1.1-4-g5e80