public
Last active — forked from /unity-builder.sh.txt

unity-builder.sh

  • Download Gist
unity-builder.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
#!/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!"
sudo pacman -Sy
sudo abs
del_old_dirs() {
for dir in $1/*/
do
dir=${dir%*/}
if [ ! -f $dir/PKGBUILD ]; then
rm -rf $1/${dir##*/}
fi
done
}
 
del_old_packages() {
unset pkgname pkgver pkgrel
if [ -f PKGBUILD ]; then
source PKGBUILD
BUILD=0
for i in ${pkgname[@]}
do
#echo $i # or do whatever with individual element of the array
#echo $i-$pkgver-$pkgrel-$(uname -m).pkg.tar.xz
if [ "$arch" != "any" ]; then
arch=$(uname -m)
fi
if [ "$i" = "xorg-server-devel-ubuntu" ]; then
arch="any";
fi
echo $i-$pkgver-$pkgrel-${arch}.pkg.tar.xz
if [ ! -f $i-$pkgver-$pkgrel-${arch}.pkg.tar.xz ]; then
BUILD=1
fi
done
 
if [ $BUILD = 1 ]; then
mkdir -p ~/oldpkgs
mv *.pkg.tar.xz ~/oldpkgs
fi
fi
}
 
pull_changes_unity() {
# Checking main repo...
if [ -d Unity-for-Arch ] ; then
echo "All OK"
cd Unity-for-Arch/
git pull --no-rebase
cd -
del_old_packages Unity-for-Arch
else
echo "There is no PKGBUILD main repo, checking..."
git clone https://github.com/chenxiaolong/Unity-for-Arch.git
fi
}
 
pull_changes_unity_extra() {
 
# Checking extra repo...
 
if [ -d Unity-for-Arch-Extra ] ; then
echo "All EXTRA OK"
cd Unity-for-Arch-Extra/
git pull --no-rebase
cd -
del_old_packages Unity-for-Arch-Extra
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
del_old_packages
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
set -e
pull_changes_unity
set +e
build_main
set -e
pull_changes_unity_extra
set +e
build_extra
repo
echo "Done"

Hello, I've tried it today, and found some minor isses:

If glib2 already is installed it will conflict with the ubuntu one, so I've added some lines to remove it.

There is something wrong with the compilation of TEST packages, so I've added the --nocheck flag. I know this is not the right fix, but I'm also not sure about how to fix the packages generation. This is just something to make it work until someone doesn't find the right fix.

I've made the fixes available here:
https://gist.github.com/rafamanzo/5792635

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.