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

3
4
5
6
7
8
# 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'
9
  'http://puredata.info/Members/rdz/software/ggee/0.27~git20151117/ggee-v0.27~git20151117-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz'
10
11
12
13
)
qjconffile=~/Library/Preferences/org.rncbc.QjackCtl.plist
pdconffile=~/Library/Preferences/org.puredata.pd.plist

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

Roman Haefeli's avatar
Roman Haefeli committed
20
# Create symlink to qjackctl application
21
if [ ! -e /Applications/qjackctl.app ]
Roman Haefeli's avatar
Roman Haefeli committed
22
then
23
  read -p "Create symlink to qjackctl.app in /Applications? Y/n " -r
Roman Haefeli's avatar
Roman Haefeli committed
24
25
  if [[ ! $REPLY =~ ^[Nn]$ ]]
  then
26
27
28
29
30
31
32
33
34
    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
35
36
37
38
  fi
fi

# Install qjackctl configuration
Roman Haefeli's avatar
Roman Haefeli committed
39
40
41
42
43
44
45
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
46
47
if [[ ! $REPLY =~ ^[Nn]$ ]]
then
Roman Haefeli's avatar
Roman Haefeli committed
48
49
  cp /usr/local/share/tpf/org.rncbc.QjackCtl.plist $qjconffile
  echo "Done."
Roman Haefeli's avatar
Roman Haefeli committed
50
51
52
53
54
else
  echo "Skipping..."
fi

# Install pd configuration
Roman Haefeli's avatar
Roman Haefeli committed
55
56
57
58
59
60
61
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
62
63
if [[ ! $REPLY =~ ^[Nn]$ ]]
then
Roman Haefeli's avatar
Roman Haefeli committed
64
65
  cp /usr/local/share/tpf/org.puredata.pd.plist $pdconffile
  echo "Done."
Roman Haefeli's avatar
Roman Haefeli committed
66
67
68
69
else
  echo "Skipping..."
fi

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
# 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

103
104
105
106
107
108
109
110
111
# 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:"
112
    echo 'source ~/.bash_profile'
113
114
115
  fi
fi