#!/bin/bash
# non-pae_repack.sh v0.2
# 2014-01-07, 2015-05-10 by axt from axebase.net
# Description: The script replaces pae request with cmov request in Linux kernel image package.

# download the package linux-image-*-generic_*_i386.deb
# from http://archive.ubuntu.com/ubuntu/pool/main/l/linux/

# unpack
dpkg -x linux-image-*i386.deb common
dpkg --control linux-image-*i386.deb

# edit
sed -i "s/grep -q ' pae '/grep -q ' cmov '/g" DEBIAN/preinst
sed -i "s/non-PAE/non-cmov/g" DEBIAN/preinst

# repack
cp -a DEBIAN/ common/
dpkg -b common linux-image-*i386.deb

# clean up
rm -rf common DEBIAN

# install package at the target Banias or Dothan FSB 400 PC
# sudo dpkg -i linux-image-*i386.deb

exit 0
