6 # Modifies the stock kernel PKGBUILD and its supporting files from ABS.
7 # Builds 'linux-pae' and 'linux-pae-headers' binary packages.
8 # Creates source PKG for AUR.
10 # buildpae [ -c | -t ]
15 # Tom Wizetek <tom@wizetek.com>
17 # update 14: 2011-11-10 v3.1 adjustments for updated kernel PKGBUILD (new patches - MD5, LEDS_ALIX2 in config)
18 # update 13: 2011-08-17 v3.0.2 fixed modifying pkgbase and appending pkgdesc
19 # update 12: 2011-08-08 v3.0.1 updated for kernel 3.0
20 # update 11: 2011-05-15 delete groups=('base'); ESC key = quit when prompted
21 # update 10: 2011-04-12 small bugfix when passing command line arguments
22 # update 9: 2011-03-26 new resync action, new automated build process via command arguments
23 # update 8: 2010-12-11
24 # update 7: 2010-11-28
25 # update 6: 2010-11-26
26 # update 5: 2010-09-30
27 # update 4: 2010-06-03
28 # update 3: 2010-03-28
29 # update 2: 2010-03-21
30 # update 1: 2010-02-10
31 # original: 2010-01-30
34 # where to build packages:
35 ##########################
37 ##########################
39 # automated build process
41 -c) _syncabs
=c
&& _repo
=core
&& _splitpkg
=b
&& _buildnow
=y
;;
42 -t) _syncabs
=t
&& _repo
=testing
&& _splitpkg
=b
&& _buildnow
=y
;;
44 *) echo "Unrecognized option: $1" ;;
49 _kverinst
=$
(pacman
-Q linux
2>/dev
/null |
awk '{print $2}')
50 _kverpae
=$
(pacman
-Q linux-pae
2>/dev
/null |
awk '{print $2}')
51 _pbcore
=/var
/abs
/core
/linux
/PKGBUILD
52 _pbtesting
=/var
/abs
/testing
/linux
/PKGBUILD
53 _kvercore
=$
(grep '_basekernel=' ${_pbcore} 2>/dev
/null | cut
-d'=' -f2)
54 _kvercore
=${_kvercore}$(grep 'pkgver=' ${_pbcore} 2>/dev/null | cut -d'}' -f2)
55 _kvercore=${_kvercore}-$(grep 'pkgrel
=' ${_pbcore} 2>/dev/null | cut -d'=' -f2)
56 _kvertesting=$(grep '_basekernel
=' ${_pbtesting} 2>/dev/null | cut -d'=' -f2)
57 _kvertesting=${_kvertesting}$(grep 'pkgver=' ${_pbtesting} 2>/dev/null | cut -d'}' -f2)
58 _kvertesting
=${_kvertesting}-$
(grep 'pkgrel=' ${_pbtesting} 2>/dev
/null | cut
-d'=' -f2)
59 echo -e "\nKernel version info:\n\ninstalled stock ARCH\t${_kverinst}\ninstalled PAE\t\t${_kverpae}\navailable ABS core\t${_kvercore}\navailable ABS testing\t${_kvertesting}\n"
66 if ! [[ ${_syncabs} ]]
68 echo -en "Sync 'linux' from ABS repo: [c]ore, [t]esting or [B]oth? [s]kip, [q]uit =>"
70 [[ ${_syncabs} ]] && echo
73 c|C
) abs core
/linux || sudo abs core
/linux
&& kernelver
;;
74 t|T
) abs testing
/linux || sudo abs testing
/linux
&& kernelver
;;
75 b|B|
'') _syncabs
=b
; abs core
/linux
&& abs testing
/linux || sudo abs core
/linux
&& sudo abs testing
/linux
&& kernelver
;;
76 s|S
) unset _syncabs
; echo ;;
77 q|Q|
\e) echo -e "\nQuit!\n" ; exit 1 ;;
78 *) unset _syncabs
; syncabs
;;
86 echo -en "Build from ABS repo: [C]ore or [t]esting? [r]esync, [q]uit =>"
88 [[ ${_absrepo} ]] && echo
90 c|C|
'') _repo
='core' ;;
91 t|T
) _repo
='testing' ;;
92 r|R
) echo ; syncabs
; absrepo
;;
93 q|Q|
\e) echo -e "\nQuit!\n" ; exit 1 ;;
98 [[ ${_repo} ]] || absrepo
100 _PKGBUILD
=/var
/abs
/${_repo}/linux
/PKGBUILD
101 [[ ! -e ${_PKGBUILD} ]] && echo -e "\nCould not find ${_PKGBUILD}\nSync ABS later again before building package.\n" && exit 1
103 _basekernel
=$
(sed -n 's/^_basekernel=//p' ${_PKGBUILD})
104 pkgver
=$
(sed -n 's/^pkgver=${_basekernel}//p' ${_PKGBUILD})
105 pkgrel
=$
(sed -n 's/^pkgrel=//p' ${_PKGBUILD})
106 _path
=${_BUILDPATH}/linux-pae-${_basekernel}${pkgver}-${pkgrel}
107 echo -e "\nBuild directory: ${_path}\n"
110 cp /var
/abs
/${_repo}/linux
/* .
111 cp PKGBUILD PKGBUILD.orig
112 cp config config.orig
113 cp linux.preset linux-pae.preset
114 cp linux.
install linux-pae.
install
119 sed -i 's/CONFIG_HIGHMEM4G=y/# CONFIG_HIGHMEM4G is not set/' config
120 sed -i 's/# CONFIG_HIGHMEM64G is not set/CONFIG_HIGHMEM64G=y/' config
123 # Tom Wizetek: settings not included in stock config (set to default)\
125 CONFIG_I2O_EXT_ADAPTEC_DMA64=y\
126 CONFIG_LEDS_ALIX2=n' config
131 #sed -i '/^pkgbase=/i\# Contributor: Tom Wizetek <tom@wizetek.com>' PKGBUILD
132 sed -i '/# Maintainer/,/^pkgbase=/ s/^$/# Contributor: Tom Wizetek <tom@wizetek.com>/' PKGBUILD
133 sed -i '/# Contributor/G' PKGBUILD
134 sed -i 's/^pkgbase=linux/&-pae/' PKGBUILD
138 if ! [[ ${_splitpkg} ]]
140 echo -en "Package(s) to build: [k]ernel only or [B]oth kernel and headers? [q]uit =>"
142 [[ ${_splitpkg} ]] && echo
145 k|K
) sed -i '/^pkgname=/ s/(.*/linux-pae/' PKGBUILD
;;
146 b|B|
'') sed -i "/^pkgname=/ s/' .*/-pae' 'linux-pae-headers')/" PKGBUILD
;;
147 q|Q|
\e) echo -e "\nQuit!\n" ; exit 1 ;;
154 sed -i '/^# pkgname=/d' PKGBUILD
155 sed -i '/^makedepends=/d' PKGBUILD
156 sed -i "/^arch=/ s/ 'x86_64'//" PKGBUILD
157 sed -i "s/ 'config.x86_64'$//" PKGBUILD
158 sed -i 's/package_linux/&-pae/' PKGBUILD
159 sed -i 's/and modules/& with PAE support (HIGHMEM64G)/' PKGBUILD
160 sed -i "/groups=('base')/d" PKGBUILD
161 sed -i '/provides=/ s/kernel26/&-pae/' PKGBUILD
162 sed -i '/conflicts=/ s/kernel26/&-pae/' PKGBUILD
163 sed -i '/replaces=/ s/kernel26/&-pae/' PKGBUILD
164 sed -i 's/modules for linux/&-pae/' PKGBUILD
166 #sed -i '/^package_linux-manpages()/,/^}/d' PKGBUILD
167 #sed -i '/^package_linux-pae-docs()/,/^}/d' PKGBUILD
168 sed -i '/^package_linux-pae-docs()/,/^}/ s/^/#&/' PKGBUILD
172 # workaround for uploading split packages to AUR\
174 pkgdesc="The Linux kernel and modules with PAE support (HIGHMEM64G)"\
177 #sed -i '/^# vim:set/ i\
178 ## workaround for uploading split packages to AUR\
180 #pkgdesc="The Linux kernel and modules with PAE support (HIGHMEM64G)"\
183 #sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' PKGBUILD
188 sed -i 's/linux/&-pae/' linux-pae.preset
193 sed -i 's/^KERNEL_NAME=/&-pae/' linux-pae.
install
194 sed -i 's/-ARCH/-pae/' linux-pae.
install
197 # Generate and replace MD5 checksums.
199 makepkg
-g > buildpae.tmp
200 sed -i '/md5sums=(/,/)/d' PKGBUILD
201 #sed -i "/md-raid10-fix-bug-when-activating-a-hot-spare.patch')$/r buildpae.tmp" PKGBUILD
202 sed -i "/.patch')$/r buildpae.tmp" PKGBUILD
211 # Build bin & src PKGs.
215 echo -en "Modifications completed. Build package now? [Y/n|q] =>"
217 [[ ${_buildnow} ]] && echo
220 n|N|q|Q|
\e) echo -e "\nTo build package(s) later using current configuration, run $(basename $0) again or manually run makepkg.\n" ; exit 1 ;;
225 [[ ${_buildnow} ]] || buildnow
227 (makepkg
-L || makepkg
-LRf ||
(rm -r ${_path}/{src
,pkg
} && makepkg
-L)) && makepkg
--source -f
230 # Install bin PKG(s).
233 pacman
-U ${_path}/linux-pae-*${_basekernel}${pkgver}-${pkgrel}-*.pkg.
* ||\
234 sudo pacman
-U ${_path}/linux-pae-*${_basekernel}${pkgver}-${pkgrel}-*.pkg.
*