Skip to content

Instantly share code, notes, and snippets.

@wangjiezhe
Last active August 29, 2015 14:08
Show Gist options
  • Save wangjiezhe/35ebcf84098d18c4845d to your computer and use it in GitHub Desktop.
Save wangjiezhe/35ebcf84098d18c4845d to your computer and use it in GitHub Desktop.
Install command 'dfc'
#!/usr/bin/env bash
set -e
PROXY="--proxy http://127.0.0.1:8087"
check_and_preinstall() {
CHECKLIST=(${depends[*]} ${makedepends[*]})
num=0
for package in ${CHECKLIST[*]}
do
printf "Checking for package $package ... "
rpm -q $package 2>&1 1>/dev/null && printf "Installed\n" || (printf "Not found\n" && INSTALLLIST[$num]=$package)
done
if [[ -n $INSTALLLIST ]]
then
sudo yum install ${INSTALLLIST[*]}
fi
}
tmpdir=$(mktemp -t -d dfc.XXXXXX)
cd ${tmpdir}
echo "Downloading build configuration from archlinux.org ..."
curl -o PKGBUILD $PROXY https://projects.archlinux.org/svntogit/community.git/plain/trunk/PKGBUILD?h=packages/dfc
echo "Succeed"
source PKGBUILD
echo "Downloading source file for dfc"
curl -O $PROXY $source
echo "Downloading Succeed"
tar xf ${pkgname}-${pkgver}.tar.gz
cd ${pkgname}-${pkgver}
check_and_preinstall
cmake .
make
sudo make install
echo "Installation Succeed"
rm -rf ${tmpdir}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment