Compiling ntp v4.2.7 for Ubuntu 12.10

Compiling ntp v4.2.7 for Ubuntu 12.10# Get ntp rebuild deps
apt-get update
apt-get -y install devscripts autogen automake libtool
apt-get -y build-dep ntp

# Create build environment
adduser bobbuilder \
        --shell /bin/bash \
        --disabled-password \
        --gecos bobbuilder

# Switch to non-priviledged user for build
sudo su - bobbuilder

# Download ntpd 4.2.7p354 sources
mkdir -p ~/build/ntp
cd ~/build/ntp
apt-get source ntp

# Apply Ubuntu changes from 4.2.6p3 over 4.2.7p354
cd ntp-4.2.6.p3+dfsg
uupdate ../ntp-dev-4.2.7p354.tar.gz -v 4.2.7p354

# Remove broken patches
cd ../ntp-4.2.7p354/
sed -i.bak debian/patches/series \
rm -f debian/patches/autotools.patch

# Fix configure parameters
sed -i.bak debian/rules \
    -e's/--disable-local-libopts/--enable-local-libopts --disable-libopts-install/g' \

# Make sure package name does not look like real Ubuntu package
sed -i.bak debian/changelog \
    -e's/4.2.7p354-0ubuntu1/4.2.7p354-0swedishchef0'$(lsb_release -cs)'/g'

# And finally compile binary.. or at least try to.
dpkg-buildpackage -j1 -b -us -uc -tc -nc

# Install (as root)
cd ~bobbuilder/build/ntp
dpkg -i ntp*_4.2.7p354*.deb

# Block upstream updates
echo "ntp hold"|dpkg --set-selections 
echo "ntpdate hold"|dpkg --set-selections 

# Done