From 316c30d375e70182f8231ae6497d4e8bc093e64a Mon Sep 17 00:00:00 2001
From: Christoph <auer.chrisi@gmx.net>
Date: Sun, 8 May 2016 17:55:01 +0200
Subject: [PATCH 1/2] Update arch.sh to latest version from upstream

Signed-off-by: Christoph <auer.chrisi@gmx.net>
---
 .travis/arch.sh | 63 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

diff --git a/.travis/arch.sh b/.travis/arch.sh
index 9c917be1d..36a66dee5 100755
--- a/.travis/arch.sh
+++ b/.travis/arch.sh
@@ -21,14 +21,16 @@
 
 ARCH_TRAVIS_MIRROR=${ARCH_TRAVIS_MIRROR:-"https://lug.mtu.edu/archlinux"}
 ARCH_TRAVIS_ARCH_ISO=${ARCH_TRAVIS_ARCH_ISO:-"$(date +%Y.%m).01"}
+ARCH_TRAVIS_ARCH=${ARCH_TRAVIS_ARCH:-"x86_64"}
 mirror_entry='Server = '$ARCH_TRAVIS_MIRROR'/\$repo/os/\$arch'
-archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-x86_64.tar.gz"
-default_root="root.x86_64"
+archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-${ARCH_TRAVIS_ARCH}.tar.gz"
+default_root="root.${ARCH_TRAVIS_ARCH}"
 ARCH_TRAVIS_CHROOT=${ARCH_TRAVIS_CHROOT:-"$default_root"}
 user="travis"
 user_home="/home/$user"
-user_build_dir="/build"
-user_uid=$UID
+user_build_dir=$(pwd)
+uid=$UID
+gid=$GID
 
 if [ -n "$CC" ]; then
   # store travis CC
@@ -56,7 +58,7 @@ setup_chroot() {
     # if it fails, try arch iso form the previous month
     if [ $ret -gt 0 ]; then
       ARCH_TRAVIS_ARCH_ISO="$(date +%Y.%m -d "-1 month").01"
-      archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-x86_64.tar.gz"
+      archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-${ARCH_TRAVIS_ARCH}.tar.gz"
       as_normal "curl -O $ARCH_TRAVIS_MIRROR/iso/$ARCH_TRAVIS_ARCH_ISO/$archive"
     fi
   fi
@@ -102,13 +104,13 @@ setup_chroot() {
   chroot_as_root "locale-gen"
 
   # setup non-root user
-  chroot_as_root "useradd -u $user_uid -m -s /bin/bash $user"
+  chroot_as_root "useradd -u $uid -m -s /bin/bash $user"
 
   # disable password for sudo users
   as_root "echo \"$user ALL=(ALL) NOPASSWD: ALL\" >> $ARCH_TRAVIS_CHROOT/etc/sudoers.d/$user"
 
   # Add build dir
-  chroot_as_root "mkdir $user_build_dir && chown $user $user_build_dir"
+  chroot_as_root "mkdir -p $user_build_dir && chown $user $user_build_dir"
 
   # bind $TRAVIS_BUILD_DIR to chroot build dir
   sudo mount --bind $TRAVIS_BUILD_DIR $ARCH_TRAVIS_CHROOT$user_build_dir
@@ -157,14 +159,22 @@ as_root() {
 # run command in chroot as root
 chroot_as_root() {
   local str="$@"
-  run sudo_wrapper chroot $ARCH_TRAVIS_CHROOT /bin/bash -c "$str"
+  run sudo_wrapper setarch $ARCH_TRAVIS_ARCH chroot \
+    $ARCH_TRAVIS_CHROOT /bin/bash -c "$str"
+}
+
+# execute command in chroot as normal user
+_chroot_as_normal() {
+  local str="$@"
+  sudo_wrapper setarch $ARCH_TRAVIS_ARCH chroot \
+    --userspec=$uid:$uid $ARCH_TRAVIS_CHROOT /bin/bash \
+    -c "export HOME=$user_home USER=$user TRAVIS_BUILD_DIR=$user_build_dir && cd $user_build_dir && $str"
 }
 
 # run command in chroot as normal user
 chroot_as_normal() {
   local str="$@"
-  run sudo_wrapper chroot --userspec=$user:$user $ARCH_TRAVIS_CHROOT /bin/bash \
-      -c "export HOME=$user_home USER=$user TRAVIS_BUILD_DIR=$user_build_dir && cd $user_build_dir && $str"
+  run _chroot_as_normal "$str"
 }
 
 # run command
@@ -182,7 +192,7 @@ run() {
 run_build_script() {
   local cmd="$@"
   echo "$ $cmd"
-  sudo_wrapper chroot --userspec=$user:$user $ARCH_TRAVIS_CHROOT /bin/bash -c "export HOME=$user_home USER=$user TRAVIS_BUILD_DIR=$user_build_dir && cd $user_build_dir && $cmd"
+  _chroot_as_normal "$cmd"
   local ret=$?
 
   if [ $ret -gt 0 ]; then
@@ -193,18 +203,23 @@ run_build_script() {
 
 # setup pacaur
 setup_pacaur() {
-  local cowerarchive="cower.tar.gz"
-  local aururl="https://aur.archlinux.org/cgit/aur.git/snapshot/"
-  # install cower
-  as_normal "curl -O $aururl/$cowerarchive"
-  as_normal "tar xf $cowerarchive"
-  chroot_as_normal "cd cower && makepkg -is --skippgpcheck --noconfirm"
-  as_root "rm -r cower"
-  as_normal "rm $cowerarchive"
-  # install pacaur
-  chroot_as_normal "cower -dd pacaur"
-  chroot_as_normal "cd pacaur && makepkg -is --noconfirm"
-  chroot_as_normal "rm -rf pacaur"
+  # Check if pacaur is available in the added repos
+  if _chroot_as_normal "pacman -Si pacaur &> /dev/null"; then
+    chroot_as_root "pacman -S --noconfirm pacaur"
+  else
+    local cowerarchive="cower.tar.gz"
+    local aururl="https://aur.archlinux.org/cgit/aur.git/snapshot/"
+    # install cower
+    as_normal "curl -O $aururl/$cowerarchive"
+    as_normal "tar xf $cowerarchive"
+    chroot_as_normal "cd cower && makepkg -is --skippgpcheck --noconfirm"
+    as_root "rm -r cower"
+    as_normal "rm $cowerarchive"
+    # install pacaur
+    chroot_as_normal "cower -dd pacaur"
+    chroot_as_normal "cd pacaur && makepkg -is --noconfirm"
+    chroot_as_normal "rm -rf pacaur"
+  fi
 }
 
 # install package through pacaur
@@ -231,7 +246,7 @@ travis_yml() {
 }
 
 read_config() {
-    old_ifs=$IFS
+    local old_ifs=$IFS
     IFS=$'\n'
     CONFIG_BUILD_SCRIPTS=($(travis_yml arch script))
     CONFIG_PACKAGES=($(travis_yml arch packages))

From 51459c5d54d3453612b3273107083f93dab94831 Mon Sep 17 00:00:00 2001
From: Christoph <auchri@users.noreply.github.com>
Date: Tue, 17 May 2016 10:11:22 +0200
Subject: [PATCH 2/2] Use fixed dee version

Signed-off-by: Christoph <auer.chrisi@gmx.net>
---
 .travis.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 11f305e48..0b1724aa0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,7 @@ arch:
 
    - git
    - patch
+   - dee-fixed
    - libunity
    - libappindicator-gtk2
 
@@ -44,4 +45,4 @@ before_install:
   - .travis/check.sh
 
 script:
-  - .travis/arch.sh
\ No newline at end of file
+  - .travis/arch.sh