File: postinstall

package info (click to toggle)
arrayfire 3.3.2%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 109,016 kB
  • sloc: cpp: 127,909; lisp: 6,878; python: 3,923; ansic: 1,051; sh: 347; makefile: 338; xml: 175
file content (34 lines) | stat: -rwxr-xr-x 1,106 bytes parent folder | download
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
#!/bin/bash

set -e
set -o pipefail

err_file=/tmp/AFInstallerOpenCL.err
brew=/usr/local/bin/brew

echo $(date) > $err_file

if [ ! -f $brew ]; then
    osascript -e 'tell app "Installer" to display dialog "Brew not installed. Please install brew at brew.sh"'
    echo "Brew not found" >> $err_file
    exit 1
fi

user=$(ps aux | grep console | grep -v 'grep\|root' | cut -d' ' -f1 | head -n1)

if [ -z $user ]; then
    echo "User not found" >> $err_file
    exit 1
fi

function deps_err
{
    osascript -e 'tell app "Installer" to display dialog "ArrayFire files installed but failed to install ArrayFire dependencies using Brew."'
    osascript -e 'tell app "Installer" to display dialog "Visit https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures to fix errors manually."'
    open https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures
    echo "Dependencies failed to install" >> $err_file
    exit 1
}

su $user -c "$brew tap homebrew/versions" >> $err_file 2>&1
su $user -c "$brew install fftw glfw3 fontconfig" >> $err_file 2>&1 || deps_err