-
-
Save qiuwei/4024587 to your computer and use it in GitHub Desktop.
unity-builder.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dirty script to build Unity under ArchLinux | |
# Thanks for PKGBUILDs, chenxiaolong! | |
# Valdos Sine <fat0troll at riseup dot net> 2012 | |
# Pratik Sinha <pratik at humbug dot in> 2012 | |
echo "Run it in directory which will be build root ;)" | |
echo "Make sure you're have sudo without password or you will stuck in every package installation" | |
echo "GO!" | |
pull_changes() { | |
# Checking main repo... | |
if [ -d Unity-for-Arch ] ; then | |
echo "All OK" | |
cd Unity-for-Arch/ | |
git pull | |
cd - | |
else | |
echo "There is no PKGBUILD main repo, checking..." | |
git clone https://github.com/chenxiaolong/Unity-for-Arch.git | |
fi | |
# Checking extra repo... | |
if [ -d Unity-for-Arch-Extra ] ; then | |
echo "All EXTRA OK" | |
cd Unity-for-Arch-Extra/ | |
git pull | |
cd - | |
else | |
echo "There is no PKGBUILD extra repo, checking..." | |
git clone https://github.com/chenxiaolong/Unity-for-Arch-Extra.git | |
fi | |
} | |
containsElement () { | |
local e | |
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done | |
return 1 | |
} | |
build_main() | |
{ | |
cd Unity-for-Arch/ | |
MAINPKGS=`cat README | grep [0-9]: | grep -v '*' | cut -d ' ' -f 2` | |
# Yes, I have removed optional packages. You can build they by adding it in next option | |
MAINPKGS+=" overlay-scrollbar" | |
EXCEPTIONS=("fixesproto-ubuntu" "libxfixes-ubuntu" "gsettings-desktop-schemas-ubuntu") | |
for i in $MAINPKGS ; do | |
cd $i | |
containsElement "$i" "${EXCEPTIONS[@]}" | |
CONTAINS="$?" | |
if [ "$CONTAINS" = "1" ]; then | |
CONFIRM="--noconfirm" | |
else | |
unset CONFIRM | |
fi | |
#need the NOCONFIRM because there are some places which have questions requiring a numeric input | |
yes | makepkg -si $CONFIRM | |
if [ "$?" != "0" ]; then | |
set -e | |
rm -rf pkg src | |
yes | makepkg -si $CONFIRM | |
set +e | |
fi | |
cd ../ | |
done | |
cd ../ | |
} | |
build_extra() | |
{ | |
cd Unity-for-Arch-Extra/ | |
# There is hardcoded array, just because README in this git is outdated ;-( | |
#EXTRAPKGS="humanity-icon-theme ubuntu-mono ubuntu-wallpapers light-themes ubuntu-sounds lightdm-ubuntu accountsservice-ubuntu lightdm-unity-greeter python-defer ubuntu-tweak" | |
EXTRAPKGS="`cat README | grep [0-9]: | grep -v '*' | cut -d ' ' -f 2`" | |
for j in $EXTRAPKGS ; do | |
cd $j | |
yes | makepkg -si --noconfirm | |
if [ "$?" != "0" ]; then | |
set -e | |
rm -rf pkg src | |
yes | makepkg -si --noconfirm | |
set +e | |
fi | |
cd ../ | |
done | |
cd ../ | |
} | |
repo() | |
{ | |
ARCH=`uname -m` | |
rm -rf unity | |
mkdir -p unity/$ARCH | |
mkdir -p unity/extra/$ARCH | |
find Unity-for-Arch -name *.pkg.tar.xz -exec cp '{}' unity/$ARCH/ \; | |
find Unity-for-Arch-Extra -name *.pkg.tar.xz -exec cp '{}' unity/extra/$ARCH/ \; | |
pushd unity/$ARCH/ | |
repo-add ./unity.db.tar.gz ./*.pkg.tar.xz | |
popd | |
pushd unity/extra/$ARCH/ | |
repo-add ./unity-extra.db.tar.gz ./*.pkg.tar.xz | |
popd | |
} | |
pacman -Q qtwebkit &>/dev/null | |
if [ "$?" == "0" ]; then | |
echo "REMOVING QTWEBKIT" | |
yes | sudo pacman -Rdd --noconfirm qtwebkit | |
fi | |
pull_changes | |
build_main | |
build_extra | |
repo | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment