index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Allan McRae <allan@archlinux.org> | 2011-06-21 13:02:07 +1000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-22 10:49:33 -0500 |
commit | 74689562363b3dec2a97ce095295a5222562061d (patch) | |
tree | cb4a0ab99a49533bd585c7163cfd5794805dca73 /scripts/makepkg.sh.in | |
parent | e97541c2083205a81f46225c367a9f470c702dd1 (diff) |
-rw-r--r-- | scripts/makepkg.sh.in | 59 |
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c1834a42..4f995439 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -622,11 +622,6 @@ generate_checksums() { check_checksums() { (( ! ${#source[@]} )) && return 0 - if ! type -p openssl >/dev/null; then - error "$(gettext "Cannot find openssl.")" - exit 1 # $E_MISSING_PROGRAM - fi - local correlation=0 local integ required for integ in md5 sha1 sha256 sha384 sha512; do @@ -1213,10 +1208,6 @@ create_signature() { local ret=0 local filename="$1" msg "$(gettext "Signing package...")" - if ! type -p gpg >/dev/null; then - error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" - exit 1 # $E_MISSING_PROGRAM - fi local SIGNWITHKEY="" if [[ -n $GPGKEY ]]; then @@ -1458,6 +1449,45 @@ check_sanity() { return $ret } +check_software() { + # check for needed software + local ret=0 + + # fakeroot - building as non-root user + if [[ $(check_buildenv fakeroot) = "y" ]] && (( EUID > 0 )); then + if ! type -p fakeroot >/dev/null; then + error "$(gettext "Cannot find the %s binary required for building as non-root user.")" "fakeroot" + ret=1 + fi + fi + + # gpg - package signing + if [[ $SIGNPKG == 'y' || (-z "$SIGNPKG" && $(check_buildenv sign) == 'y') ]]; then + if ! type -p gpg >/dev/null; then + error "$(gettext "Cannot find the %s binary required for signing packages.")" "gpg" + ret=1 + fi + fi + + # openssl - checksum operations + if (( ! SKIPINTEG )); then + if ! type -p openssl >/dev/null; then + error "$(gettext "Cannot find the %s binary required for validating sourcefile checksums.")" "openssl" + ret=1 + fi + fi + + # upx - binary compression + if [[ $(check_option upx) == 'y' ]]; then + if ! type -p upx >/dev/null; then + error "$(gettext "Cannot find the %s binary required for compressing binaries.")" "upx" + ret=1 + fi + fi + + return $ret +} + devel_check() { newpkgver="" @@ -1860,13 +1890,7 @@ if (( ! INFAKEROOT )); then error "$(gettext "The --asroot option is meant for the root user only.")" plain "$(gettext "Please rerun makepkg without the --asroot flag.")" exit 1 # $E_USER_ABORT - elif [[ $(check_buildenv fakeroot) = "y" ]] && (( EUID > 0 )); then - if ! type -p fakeroot >/dev/null; then - error "$(gettext "Fakeroot must be installed if using the 'fakeroot' option")" - plain "$(gettext "in the BUILDENV array in %s.")" "$MAKEPKG_CONF" - exit 1 - fi - elif (( EUID > 0 )); then + elif (( EUID > 0 )) && [[ $(check_buildenv fakeroot) != "y" ]]; then warning "$(gettext "Running makepkg as an unprivileged user will result in non-root")" plain "$(gettext "ownership of the packaged files. Try using the fakeroot environment by")" plain "$(gettext "placing 'fakeroot' in the BUILDENV array in %s.")" "$MAKEPKG_CONF" @@ -1929,6 +1953,9 @@ fi # check the PKGBUILD for some basic requirements check_sanity || exit 1 +# check we have the software required to process the PKGBUILD +check_sofware || exit 1 + # We need to run devel_update regardless of whether we are in the fakeroot # build process so that if the user runs makepkg --forcever manually, we # 1) output the correct pkgver, and 2) use the correct filename when |