You are not logged in.

#1 2010-09-19 14:50:53

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

[Solved] I need help with this check function (catalyst)

Hi,

The problem is in my check function, this check must be done because of kernel's new security patches. It's working fine with fresh patched kernels but it's stopping if they weren't patched.

if [ "${CARCH}" = "x86_64" ]; then
    fix=$(grep arch_compat_alloc_user_space /lib/modules/${_kernver}/build/arch/x86/include/asm/compat.h )
    if [ "$fix" = "static inline void __user *arch_compat_alloc_user_space(long len)" ]; then
        cd "${srcdir}/archive_files/"
        patch -Np1 -i ../arch_compat.patch || return 1
    fi
fi

I've checked also other variants:

check=$(grep arch_compat_alloc_user_space /lib/modules/${_kernver}/build/arch/x86/include/asm/compat.h)
fix="static inline void __user *arch_compat_alloc_user_space(long len)"
    if [ "${CARCH}" = "x86_64" ] && [ "${check}" = "${fix}" ]; then
      cd "${srcdir}/archive_files/"
      patch -Np1 -i ../arch_compat.patch || return 1
    fi
check=$(grep arch_compat_alloc_user_spac /lib/modules/${_kernver}/build/arch/x86/include/asm/compat.h)
    if [ "${check}" = "" ]; then
    return 0
      else
        cd "${srcdir}/archive_files/"
        patch -Np1 -i ../arch_compat.patch || return 1
    fi

It's working fine in bash, but fails in makepkg, so i guess it's problem with syntax.

Full PKGBUILD is here: http://aur.archlinux.org/packages.php?ID=29111

Edit: nevermind, looks like i solved it with:

if [ "${BUILDARCH}" = "x86_64" ]; then
    if [[ $(cat /lib/modules/${_kernver}/build/arch/x86/include/asm/compat.h | grep arch_compat_alloc_user_space) = "" ]]; then echo ""
        else
        cd "${srcdir}/archive_files/"
        patch -Np1 -i ../arch_compat.patch || return 1
    fi
fi

Last edited by Vi0L0 (2010-09-19 19:54:44)

Offline

Board footer

Powered by FluxBB