Tuesday, July 07, 2015

Smartmontools v6.4 and Ubuntu 12.04

I had to upgrade to new Smartmontools 6.4 on my Ubuntu 12.04 server as old version lacks Prolific PL2773 USB3 to SATA bridge support.


# Get rebuild deps
apt-get update
apt-get -y install devscripts
apt-get -y build-dep smartmontools

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

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

# Download sources
mkdir -p ~/build/smart64
cd ~/build/smart64
apt-get source smartmontools
wget http://sourceforge.net/projects/smartmontools/files/smartmontools/6.4/smartmontools-6.4.tar.gz

# Apply ubuntu changes
cd smartmontools-5.41+svn3365/
uupdate ../smartmontools-6.4.tar.gz -v 6.4

# Fix build rules
cd ../smartmontools-6.4
sed -i.bak debian/patches/series \
    -e 's/^52/#52/g' \
    -e 's/^54/#54/g' \
    -e 's/^61/#61/g' \
    -e 's/^63/#63/g' \
    -e 's/^manpage/#manpage/g' \
    -e 's/^fix-generic/#fix-generic/g'
sed -i.bak debian/docs \
    -e 's/WARNINGS//g'
sed -i.bak debian/rules \
    -e 's/dh_installchangelogs CHANGELOG/#dh_installchangelogs CHANGELOG/g'

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

# And finally compile binary
dpkg-buildpackage -j2 -b -us -uc -tc -nc

# Install new binaries (as root)
cd ~bobbuilder/build/smart64
DEBIAN_FRONTEND=noninteractive dpkg -i \
   smartmontools_6.4-0swedishchefborkborkbork0precise_*.deb

# Block updates from repo
echo "smartmontools hold"|dpkg --set-selections 

# Done

No comments:

Post a Comment

Got something to say?!