tpf-setup 2.76 KB
Newer Older
1
#!/bin/bash
Roman Haefeli's avatar
Roman Haefeli committed
2

3
4
5
6
7
8
9
10
11
12
# defaults
externaldir=~/Library/Pd
EXTERNALURLS=(
  'http://puredata.info/Members/rdz/software/iemnet/0.2.1~git20151214/iemnet-v0.2.1~git20151214-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz'
  'http://puredata.info/Members/rdz/software/osc/0.2~git20151118/osc-v0.2~git20151118-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz'
  'http://puredata.info/Members/rdz/software/slip/0.1~git20151118/slip-v0.1~git20151118-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz'
)
qjconffile=~/Library/Preferences/org.rncbc.QjackCtl.plist
pdconffile=~/Library/Preferences/org.puredata.pd.plist

Roman Haefeli's avatar
Roman Haefeli committed
13
# do nothing (test)
Roman Haefeli's avatar
Roman Haefeli committed
14
15
16
17
18
if [ "$1" == "--do-nothing" ]
then
  exit 0
fi

Roman Haefeli's avatar
Roman Haefeli committed
19
# Create symlink to qjackctl application
20
if [ ! -e /Applications/qjackctl.app ]
Roman Haefeli's avatar
Roman Haefeli committed
21
then
22
  read -p "Create symlink to qjackctl.app in /Applications? Y/n " -r
Roman Haefeli's avatar
Roman Haefeli committed
23
24
  if [[ ! $REPLY =~ ^[Nn]$ ]]
  then
25
26
27
28
29
30
31
32
33
    if  [ -w /Applications ]
    then
      ln -s /usr/local/opt/qjackctl-tpf/qjackctl.app /Applications/
    else
      sudo ln -s /usr/local/opt/qjackctl-tpf/qjackctl.app /Applications/
    fi
    echo "Done."
  else
    echo "Skipping..."
Roman Haefeli's avatar
Roman Haefeli committed
34
35
36
37
  fi
fi

# Install qjackctl configuration
Roman Haefeli's avatar
Roman Haefeli committed
38
39
40
41
42
43
44
if [ -f $qjconffile ]
then
  prompt="Overwrite existing qjackctl configuration file? Y/n "
else
  prompt="Write qjackctl configuration file? Y/n "
fi
read -p "$prompt" -r
Roman Haefeli's avatar
Roman Haefeli committed
45
46
if [[ ! $REPLY =~ ^[Nn]$ ]]
then
Roman Haefeli's avatar
Roman Haefeli committed
47
48
  cp /usr/local/share/tpf/org.rncbc.QjackCtl.plist $qjconffile
  echo "Done."
Roman Haefeli's avatar
Roman Haefeli committed
49
50
51
52
53
else
  echo "Skipping..."
fi

# Install pd configuration
Roman Haefeli's avatar
Roman Haefeli committed
54
55
56
57
58
59
60
if [ -f $pdconffile ]
then
  prompt="Overwrite existing pd configuration file? Y/n "
else
  prompt="Write pd configuration file? Y/n "
fi
read -p "$prompt" -r
Roman Haefeli's avatar
Roman Haefeli committed
61
62
if [[ ! $REPLY =~ ^[Nn]$ ]]
then
Roman Haefeli's avatar
Roman Haefeli committed
63
64
  cp /usr/local/share/tpf/org.puredata.pd.plist $pdconffile
  echo "Done."
Roman Haefeli's avatar
Roman Haefeli committed
65
66
67
68
else
  echo "Skipping..."
fi

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
# Create external dir, if there is none yet
if [ ! -d $externaldir ]
then
  mkdir $externaldir
fi

function install_external {
  # ARG1: url of Pd external
  local url="$1"
  local archive
  (
    cd $externaldir
    curl -s -O "$1"
    archive="$(basename "$url")"
    tar xf "$archive"
    rm "$archive"
  )
}

read -p "Install required Pd externals? Y/n " -r
if [[ ! $REPLY =~ ^[Nn]$ ]]
then
  for url in ${EXTERNALURLS[*]}
  do
    package=$(basename "$url" | sed -e 's/-.*$//')
    echo "Installing $package to $externaldir"
    install_external "$url"
  done
  echo "Done."
else
  echo "Skipping..."
fi

102
103
104
105
106
107
108
109
110
# At this point mtr should be installed and thus if we don't find
# it means that /usr/local/sbin is not part of PATH
if ! echo $PATH | grep -q "/usr/local/sbin"
then
  read -p "Add /usr/local/sbin to your PATH? Y/n " -r
  if [[ ! $REPLY =~ ^[Nn]$ ]]
  then
    echo "export PATH=/usr/local/sbin:$PATH" >> ~/.bash_profile
    echo "Please execute the following in your terminal window:"
111
    echo 'source ~/.bash_profile'
112
113
114
  fi
fi