summaryrefslogtreecommitdiff
path: root/gen_kernel_patch
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2008-04-05 12:04:21 +0200
committerThomas Bächler <thomas@archlinux.org>2008-04-05 12:04:21 +0200
commit32c8c733f296ea76d599c0c90aff7307d85a4eb3 (patch)
tree7acd0f0d313f088d4e24179e5b04254f9b6868e3 /gen_kernel_patch
Initial commit of the patch generation script and the patches used in 2.6.24.4-ARCH
Diffstat (limited to 'gen_kernel_patch')
-rwxr-xr-xgen_kernel_patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/gen_kernel_patch b/gen_kernel_patch
new file mode 100755
index 0000000..36c39ec
--- /dev/null
+++ b/gen_kernel_patch
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+cat_patch() {
+ file=${startdir}/src/$(basename ${1})
+ ftype=$(file -bizL "${file}")
+ case "$ftype" in
+ *application/x-gzip*)
+ zcat ${file} ;;
+ *application/x-bzip*)
+ bzcat ${file} ;;
+ *)
+ cat ${file} ;;
+ esac
+}
+
+get_file() {
+ file=$(basename ${1})
+ OPWD=${PWD}
+ if [ "${file}" != "${1}" ]; then
+ cd ${SRCDEST}
+ [ ! -f ${file} ] && wget -c ${1}
+ cd ${startdir}/src
+ ln -s ${SRCDEST}/${file} .
+ else
+ cd ${startdir}/src
+ ln -s ../patches/${file} .
+ fi
+ cd ${OPWD}
+}
+
+source /etc/makepkg.conf
+source PATCHCFG
+
+export SRCNAME
+
+export startdir=${PWD}
+mkdir ${startdir}/src
+cd ${startdir}/src
+
+get_file ${SRC}
+bsdtar -xf $(basename ${SRC})
+cp -a ${SRCORIG} ${SRCNAME}
+cd ${SRCNAME}
+
+pre_apply
+
+for p in ${PATCHES[@]}; do
+ patchname=$(echo ${p} | cut -d% -f1)
+ patchstrip=$(echo ${p} | cut -d% -f2)
+ get_file ${patchname}
+ cat_patch ${patchname} | patch -Np${patchstrip} || exit 1
+done
+
+post_apply
+
+cd ${startdir}/src
+diff -Nur ${SRCORIG} ${SRCNAME} > $startdir/${PATCHNAME}
+bzip2 --best $startdir/${PATCHNAME}