summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFigue2019-01-12 00:40:40 +0100
committerFigue2019-01-12 00:40:40 +0100
commit794ef1badb83e356a79de325dee788928d7ae150 (patch)
tree99ea29dcd0b7b944d025e9ea2efa8203713ae4a7
parentfffd658d6fb9113aade5c81cbcd9e05c45d8efd1 (diff)
downloadaur-794ef1badb83e356a79de325dee788928d7ae150.tar.gz
Switch to LTS branch 4.19: 4.19.14-xanmod8
-rw-r--r--.SRCINFO20
-rw-r--r--0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch103
-rw-r--r--PKGBUILD287
3 files changed, 260 insertions, 150 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 81ae2eef89a6..2a8bc9eff1a4 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = linux-xanmod-lts
- pkgver = 4.14.90
+ pkgver = 4.19.14
pkgrel = 1
url = http://www.xanmod.org/
arch = x86_64
@@ -12,20 +12,18 @@ pkgbase = linux-xanmod-lts
makedepends = python-sphinx
makedepends = graphviz
options = !strip
- source = https://github.com/xanmod/linux/archive/4.14.90-xanmod54.tar.gz
+ source = https://github.com/xanmod/linux/archive/4.19.14-xanmod8.tar.gz
source = 60-linux.hook
source = 90-linux.hook
source = linux-xanmod-lts.preset
source = choose-gcc-optimization.sh
- source = 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch::https://git.archlinux.org/svntogit/packages.git/plain/trunk/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch?h=packages/linux-lts&id=fb67d4a886adf352f0f1287a7bf7ba298b1d0606
- source = 0002-drm-i915-edp-Only-use-the-alternate-fixed-mode-if-it.patch::https://git.archlinux.org/svntogit/packages.git/plain/trunk/0002-drm-i915-edp-Only-use-the-alternate-fixed-mode-if-it.patch?h=packages/linux-lts&id=fb67d4a886adf352f0f1287a7bf7ba298b1d0606
- sha256sums = 0729e61a3a08041f3ba3ecb31339e3cd01c7c59bbf2a85494c25f0e804a2c008
+ source = 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
+ sha256sums = dabf9721630243e1f7faa4775676c34585e50a5e8c6eaf438699793bb5e7316f
sha256sums = ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21
sha256sums = 75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919
sha256sums = ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65
sha256sums = bae7b9253512ef5724629738bfd4460494a08566f8225b9d8ec544ea8cc2f3a5
sha256sums = 36b1118c8dedadc4851150ddd4eb07b1c58ac5bbf3022cc2501a27c2b476da98
- sha256sums = 6364edabad4182dcf148ae7c14d8f45d61037d4539e76486f978f1af3a090794
pkgname = linux-xanmod-lts
pkgdesc = The Linux kernel and modules with Xanmod patches
@@ -33,10 +31,18 @@ pkgname = linux-xanmod-lts
depends = coreutils
depends = linux-firmware
depends = kmod
- depends = mkinitcpio>=0.7
+ depends = mkinitcpio
optdepends = crda: to set the correct wireless channels of your country
+ provides = linux
+ provides = linux-xanmod-git
+ conflicts = linux-xanmod-git
+ replaces = linux-xanmod-git
backup = etc/mkinitcpio.d/linux-xanmod-lts.preset
pkgname = linux-xanmod-lts-headers
pkgdesc = Header files and scripts for building modules for Xanmod Linux kernel
+ provides = linux-headers
+ provides = linux-xanmod-git-headers
+ conflicts = linux-xanmod-git-headers
+ replaces = linux-xanmod-git-headers
diff --git a/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch b/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
new file mode 100644
index 000000000000..a989d666aa76
--- /dev/null
+++ b/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
@@ -0,0 +1,103 @@
+From 4e54373158caa50df5402fdd3db1794c5394026b Mon Sep 17 00:00:00 2001
+Message-Id: <4e54373158caa50df5402fdd3db1794c5394026b.1516188238.git.jan.steffens@gmail.com>
+From: Serge Hallyn <serge.hallyn@canonical.com>
+Date: Fri, 31 May 2013 19:12:12 +0100
+Subject: [PATCH 1/4] add sysctl to disallow unprivileged CLONE_NEWUSER by
+ default
+
+Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
+[bwh: Remove unneeded binary sysctl bits]
+Signed-off-by: Daniel Micay <danielmicay@gmail.com>
+---
+ kernel/fork.c | 15 +++++++++++++++
+ kernel/sysctl.c | 12 ++++++++++++
+ kernel/user_namespace.c | 3 +++
+ 3 files changed, 30 insertions(+)
+
+diff --git a/kernel/fork.c b/kernel/fork.c
+index 500ce64517d9..35f5860958b4 100644
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -102,6 +102,11 @@
+
+ #define CREATE_TRACE_POINTS
+ #include <trace/events/task.h>
++#ifdef CONFIG_USER_NS
++extern int unprivileged_userns_clone;
++#else
++#define unprivileged_userns_clone 0
++#endif
+
+ /*
+ * Minimum number of threads to boot the kernel
+@@ -1554,6 +1559,10 @@ static __latent_entropy struct task_struct *copy_process(
+ if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS))
+ return ERR_PTR(-EINVAL);
+
++ if ((clone_flags & CLONE_NEWUSER) && !unprivileged_userns_clone)
++ if (!capable(CAP_SYS_ADMIN))
++ return ERR_PTR(-EPERM);
++
+ /*
+ * Thread groups must share signals as well, and detached threads
+ * can only be started up within the thread group.
+@@ -2347,6 +2356,12 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
+ if (unshare_flags & CLONE_NEWNS)
+ unshare_flags |= CLONE_FS;
+
++ if ((unshare_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) {
++ err = -EPERM;
++ if (!capable(CAP_SYS_ADMIN))
++ goto bad_unshare_out;
++ }
++
+ err = check_unshare_flags(unshare_flags);
+ if (err)
+ goto bad_unshare_out;
+diff --git a/kernel/sysctl.c b/kernel/sysctl.c
+index 56aca862c4f5..e8402ba393c1 100644
+--- a/kernel/sysctl.c
++++ b/kernel/sysctl.c
+@@ -105,6 +105,9 @@ extern int core_uses_pid;
+ extern char core_pattern[];
+ extern unsigned int core_pipe_limit;
+ #endif
++#ifdef CONFIG_USER_NS
++extern int unprivileged_userns_clone;
++#endif
+ extern int pid_max;
+ extern int pid_max_min, pid_max_max;
+ extern int percpu_pagelist_fraction;
+@@ -513,6 +516,15 @@ static struct ctl_table kern_table[] = {
+ .proc_handler = proc_dointvec,
+ },
+ #endif
++#ifdef CONFIG_USER_NS
++ {
++ .procname = "unprivileged_userns_clone",
++ .data = &unprivileged_userns_clone,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = proc_dointvec,
++ },
++#endif
+ #ifdef CONFIG_PROC_SYSCTL
+ {
+ .procname = "tainted",
+diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
+index c490f1e4313b..dd03bd39d7bf 100644
+--- a/kernel/user_namespace.c
++++ b/kernel/user_namespace.c
+@@ -24,6 +24,9 @@
+ #include <linux/projid.h>
+ #include <linux/fs_struct.h>
+
++/* sysctl */
++int unprivileged_userns_clone;
++
+ static struct kmem_cache *user_ns_cachep __read_mostly;
+ static DEFINE_MUTEX(userns_state_mutex);
+
+--
+2.15.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 5770d59a5ba1..a2325d3e870b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,4 +1,6 @@
# Maintainer: Joan Figueras <ffigue at gmail dot com>
+# Contributor: Torge Matthies <openglfreak at googlemail dot com>
+# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Yoshi2889 <rick.2889 at gmail dot com>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Baechler <thomas@archlinux.org>
@@ -11,8 +13,10 @@
## Look inside 'choose-gcc-optimization.sh' to choose your microarchitecture
## Valid numbers between: 0 to 25
## Default is: 0 => generic
-## Good option if your package is for one machine: 22 => native
-_microarchitecture=0
+## Good option if your package is for one machine: 25 => native
+if [ -z ${_microarchitecture+x} ]; then
+ _microarchitecture=0
+fi
##
## Disable NUMA since most users do not have multiple processors. Breaks CUDA/NvEnc.
## Archlinux and Xanmod enable it by default.
@@ -39,56 +43,54 @@ fi
pkgbase=linux-xanmod-lts
_srcname=linux
-pkgver=4.14.90
-xanmod=54
+pkgver=4.19.14
+xanmod=8
pkgrel=1
arch=(x86_64)
url="http://www.xanmod.org/"
license=(GPL2)
makedepends=(xmlto kmod inetutils bc libelf python-sphinx graphviz)
options=('!strip')
-
-# Arch stock configuration files are directly pulled from a specific trunk
-arch_config_trunk=fb67d4a886adf352f0f1287a7bf7ba298b1d0606
-
-# Arch additional patches
-arch_patches=(
- 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
- 0002-drm-i915-edp-Only-use-the-alternate-fixed-mode-if-it.patch
-)
+_srcname="linux-${pkgver}-xanmod${xanmod}"
source=(https://github.com/xanmod/linux/archive/${pkgver}-xanmod${xanmod}.tar.gz
- '60-linux.hook' # pacman hook for depmod
- '90-linux.hook' # pacman hook for initramfs regeneration
- "$pkgbase.preset" # standard config files for mkinitcpio ramdisk
- 'choose-gcc-optimization.sh'
+ 60-linux.hook # pacman hook for depmod
+ 90-linux.hook # pacman hook for initramfs regeneration
+ ${pkgbase}.preset # standard config files for mkinitcpio ramdisk
+ choose-gcc-optimization.sh
+ 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch # Grabbed from linux-ck package
)
-for _patch in ${arch_patches[@]} ; do source+=("${_patch}::https://git.archlinux.org/svntogit/packages.git/plain/trunk/${_patch}?h=packages/linux-lts&id=${arch_config_trunk}") ; done
-sha256sums=('0729e61a3a08041f3ba3ecb31339e3cd01c7c59bbf2a85494c25f0e804a2c008'
+sha256sums=('dabf9721630243e1f7faa4775676c34585e50a5e8c6eaf438699793bb5e7316f'
'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
'75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65'
'bae7b9253512ef5724629738bfd4460494a08566f8225b9d8ec544ea8cc2f3a5'
- '36b1118c8dedadc4851150ddd4eb07b1c58ac5bbf3022cc2501a27c2b476da98'
- '6364edabad4182dcf148ae7c14d8f45d61037d4539e76486f978f1af3a090794')
+ '36b1118c8dedadc4851150ddd4eb07b1c58ac5bbf3022cc2501a27c2b476da98')
_kernelname=${pkgbase#linux}
prepare() {
- cd "${srcdir}/linux-${pkgver}-xanmod${xanmod}"
+ cd $_srcname
- if [ "${_kernelname}" != "" ]; then
- #sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
- sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
- fi
+ msg2 "Setting version..."
+ scripts/setlocalversion --save-scmversion
+ echo "-$pkgrel" > localversion.10-pkgrel
+ echo "$_kernelname" > localversion.20-pkgname
+
+ # Archlinux patches
+ local src
+ for src in "${source[@]}"; do
+ src="${src%%::*}"
+ src="${src##*/}"
+ [[ $src = *.patch ]] || continue
+ msg2 "Applying patch $src..."
+ patch -Np1 < "../$src"
+ done
# CONFIG_STACK_VALIDATION gives better stack traces. Also is enabled in all official kernel packages by Archlinux team
scripts/config --enable CONFIG_STACK_VALIDATION
- # Archlinux patches
- for n in ${arch_patches[@]} ; do patch -Np1 -i ../$n ; done
-
# Enable IKCONFIG following Arch's philosophy
scripts/config --enable CONFIG_IKCONFIG \
--enable CONFIG_IKCONFIG_PROC
@@ -120,165 +122,164 @@ prepare() {
cp -f "${startdir}"/myconfig .config
fi
- # set extraversion to pkgrel
- sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
-
- # don't run depmod on 'make install'. We'll do this ourselves in packaging
- sed -i '2iexit 0' scripts/depmod.sh
+ make olddefconfig
- # get kernel version
- make prepare
-
- # load configuration
- # Configure the kernel. Replace the line below with one of your choice.
- #make menuconfig # CLI menu for configuration
- #make nconfig # new CLI menu for configuration
- #make xconfig # X-based configuration
- #make oldconfig # using old config from previous kernel version
- # ... or manually edit .config
-
- # rewrite configuration
- yes "" | make config >/dev/null
+ make -s kernelrelease > ../version
+ msg2 "Prepared %s version %s" "$pkgbase" "$(<../version)"
}
build() {
- cd "${srcdir}/linux-${pkgver}-xanmod${xanmod}"
-
- make ${MAKEFLAGS} LOCALVERSION= bzImage modules
+ cd $_srcname
+ make bzImage modules
}
_package() {
pkgdesc="The Linux kernel and modules with Xanmod patches"
- depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
+ depends=(coreutils linux-firmware kmod mkinitcpio)
optdepends=('crda: to set the correct wireless channels of your country')
- backup=("etc/mkinitcpio.d/${pkgbase}.preset")
+ provides=('linux' 'linux-xanmod-git')
+ replaces=('linux-xanmod-git')
+ conflicts=('linux-xanmod-git')
+ backup=("etc/mkinitcpio.d/$pkgbase.preset")
install=linux.install
- cd "${srcdir}/linux-${pkgver}-xanmod${xanmod}"
+ local kernver="$(<version)"
+ local modulesdir="$pkgdir/usr/lib/modules/$kernver"
- # get kernel version
- _kernver="$(make LOCALVERSION= kernelrelease)"
- _basekernel=${_kernver%%-*}
- _basekernel=${_basekernel%.*}
+ cd $_srcname
- mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
- make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
- cp arch/x86/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
+ msg2 "Installing boot image..."
+ # systemd expects to find the kernel here to allow hibernation
+ # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
+ install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
+ install -Dm644 "$modulesdir/vmlinuz" "$pkgdir/boot/vmlinuz-$pkgbase"
- # make room for external modules
- local _extramodules="extramodules-${_basekernel}${_kernelname:--ARCH}"
- ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
+ msg2 "Installing modules..."
+ make INSTALL_MOD_PATH="$pkgdir/usr" modules_install
- # add real version for building modules and running depmod from hook
- echo "${_kernver}" |
- install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
+ # a place for external modules,
+ # with version file for building modules and running depmod from hook
+ local extramodules="extramodules$_kernelname"
+ local extradir="$pkgdir/usr/lib/modules/$extramodules"
+ install -Dt "$extradir" -m644 ../version
+ ln -sr "$extradir" "$modulesdir/extramodules"
# remove build and source links
- rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
-
- # now we call depmod...
- depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
-
- # add vmlinux
- install -Dt "${pkgdir}/usr/lib/modules/${_kernver}/build" -m644 vmlinux
+ rm "$modulesdir"/{source,build}
+ msg2 "Installing hooks..."
# sed expression for following substitutions
- local _subst="
- s|%PKGBASE%|${pkgbase}|g
- s|%KERNVER%|${_kernver}|g
- s|%EXTRAMODULES%|${_extramodules}|g
+ local subst="
+ s|%PKGBASE%|$pkgbase|g
+ s|%KERNVER%|$kernver|g
+ s|%EXTRAMODULES%|$extramodules|g
"
# hack to allow specifying an initially nonexisting install file
- sed "${_subst}" "${startdir}/${install}" > "${startdir}/${install}.pkg"
- true && install=${install}.pkg
-
- # install mkinitcpio preset file
- sed "${_subst}" ../${pkgbase}.preset |
- install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
-
- # install pacman hooks
- sed "${_subst}" ../60-linux.hook |
- install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
- sed "${_subst}" ../90-linux.hook |
- install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
+ sed "$subst" "$startdir/$install" > "$startdir/$install.pkg"
+ true && install=$install.pkg
+
+ # fill in mkinitcpio preset and pacman hooks
+ sed "$subst" ../$pkgbase.preset | install -Dm644 /dev/stdin \
+ "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
+ sed "$subst" ../60-linux.hook | install -Dm644 /dev/stdin \
+ "$pkgdir/usr/share/libalpm/hooks/60-$pkgbase.hook"
+ sed "$subst" ../90-linux.hook | install -Dm644 /dev/stdin \
+ "$pkgdir/usr/share/libalpm/hooks/90-$pkgbase.hook"
+
+ msg2 "Fixing permissions..."
+ chmod -Rc u=rwX,go=rX "$pkgdir"
}
_package-headers() {
pkgdesc="Header files and scripts for building modules for Xanmod Linux kernel"
+ provides=('linux-headers' 'linux-xanmod-git-headers')
+ replaces=('linux-xanmod-git-headers')
+ conflicts=('linux-xanmod-git-headers')
- cd "${srcdir}/linux-${pkgver}-xanmod${xanmod}"
- local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
+ local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
- install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
- install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
+ cd $_srcname
- mkdir "${_builddir}/.tmp_versions"
+ msg2 "Installing build files..."
+ install -Dt "$builddir" -m644 Makefile .config Module.symvers System.map vmlinux
+ install -Dt "$builddir/kernel" -m644 kernel/Makefile
+ install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
+ cp -t "$builddir" -a scripts
- cp -t "${_builddir}" -a include scripts
+ # add objtool for external module building and enabled VALIDATION_STACK option
+ install -Dt "$builddir/tools/objtool" tools/objtool/objtool
- install -Dt "${_builddir}/arch/x86" -m644 arch/x86/Makefile
- install -Dt "${_builddir}/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
+ # add xfs and shmem for aufs building
+ mkdir -p "$builddir"/{fs/xfs,mm}
- cp -t "${_builddir}/arch/x86" -a arch/x86/include
+ # ???
+ mkdir "$builddir/.tmp_versions"
- install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
- install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
+ msg2 "Installing headers..."
+ cp -t "$builddir" -a include
+ cp -t "$builddir/arch/x86" -a arch/x86/include
+ install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
- # http://bugs.archlinux.org/task/9912
- install -Dt "${_builddir}/drivers/media/dvb-core" -m644 drivers/media/dvb-core/*.h
+ install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
+ install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
# http://bugs.archlinux.org/task/13146
- install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
+ install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# http://bugs.archlinux.org/task/20402
- install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
- install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
- install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
-
- # add xfs and shmem for aufs building
- mkdir -p "${_builddir}"/{fs/xfs,mm}
-
- # copy in Kconfig files
- find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;
-
- # add objtool for external module building and enabled VALIDATION_STACK option
- install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool
-
- # remove unneeded architectures
- local _arch
- for _arch in "${_builddir}"/arch/*/; do
- [[ ${_arch} == */x86/ ]] && continue
- rm -r "${_arch}"
+ install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
+ install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
+ install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
+
+ msg2 "Installing KConfig files..."
+ find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
+
+ msg2 "Removing unneeded architectures..."
+ local arch
+ for arch in "$builddir"/arch/*/; do
+ [[ $arch = */x86/ ]] && continue
+ echo "Removing $(basename "$arch")"
+ rm -r "$arch"
done
- # remove files already in linux-docs package
- rm -r "${_builddir}/Documentation"
-
- # remove now broken symlinks
- find -L "${_builddir}" -type l -printf 'Removing %P\n' -delete
+ msg2 "Removing documentation..."
+ rm -r "$builddir/Documentation"
+
+ msg2 "Removing broken symlinks..."
+ find -L "$builddir" -type l -printf 'Removing %P\n' -delete
+
+ msg2 "Removing loose objects..."
+ find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
+
+ msg2 "Stripping build tools..."
+ local file
+ while read -rd '' file; do
+ case "$(file -bi "$file")" in
+ application/x-sharedlib\;*) # Libraries (.so)
+ strip -v $STRIP_SHARED "$file" ;;
+ application/x-archive\;*) # Libraries (.a)
+ strip -v $STRIP_STATIC "$file" ;;
+ application/x-executable\;*) # Binaries
+ strip -v $STRIP_BINARIES "$file" ;;
+ application/x-pie-executable\;*) # Relocatable binaries
+ strip -v $STRIP_SHARED "$file" ;;
+ esac
+ done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
- # Fix permissions
- chmod -R u=rwX,go=rX "${_builddir}"
+ msg2 "Adding symlink..."
+ mkdir -p "$pkgdir/usr/src"
+ ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase-$pkgver"
- # strip scripts directory
- local _binary _strip
- while read -rd '' _binary; do
- case "$(file -bi "${_binary}")" in
- *application/x-sharedlib*) _strip="${STRIP_SHARED}" ;; # Libraries (.so)
- *application/x-archive*) _strip="${STRIP_STATIC}" ;; # Libraries (.a)
- *application/x-executable*) _strip="${STRIP_BINARIES}" ;; # Binaries
- *) continue ;;
- esac
- /usr/bin/strip ${_strip} "${_binary}"
- done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null)
+ msg2 "Fixing permissions..."
+ chmod -Rc u=rwX,go=rX "$pkgdir"
}
pkgname=("${pkgbase}" "${pkgbase}-headers")
-for _p in ${pkgname[@]}; do
- eval "package_${_p}() {
- $(declare -f "_package${_p#${pkgbase}}")
- _package${_p#${pkgbase}}
+for _p in "${pkgname[@]}"; do
+ eval "package_$_p() {
+ $(declare -f "_package${_p#$pkgbase}")
+ _package${_p#$pkgbase}
}"
done