forked from raspishake/rsudp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unix-install-rsudp.sh
73 lines (66 loc) · 2.35 KB
/
unix-install-rsudp.sh
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
#!/bin/bash
dir_name="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # current directory
arch=$(uname -m) # machine hardware
conda="conda" # anaconda executable or alias
if [[ "$arch" == "armv"* ]]; then release='berryconda3'; else release='miniconda3'; fi
# conda install location:
prefix="$HOME/$release" # $HOME/miniconda3 is default location
full="$HOME/anaconda3" # full release install location
berryconda="$HOME/berryconda3" # berryconda install location
miniconda="$HOME/miniconda3" # miniconda install location
config="$HOME/.config/rsudp" # config location
settings="$config/rsudp_settings.json" # settings file
echo "Looking for existing installation..."
# first we have to test if there is an existing anaconda installation
# the simplest case, that the conda command works:
command -v conda >/dev/null 2>&1 &&
conda activate >/dev/null 2>&1 &&
conda_exists=1
if [ -z ${conda_exists+x} ]; then
# if conda command doesn't exist,
if [ -f "$miniconda/bin/conda" ]; then
# now we look in the default install location
. $prefix/etc/profile.d/conda.sh &&
conda activate &&
conda_exists=1
elif [ -f "$berryconda/bin/conda" ]; then
# look for a berryconda release
. $berryconda/etc/profile.d/conda.sh &&
prefix=$berryconda
conda activate &&
conda_exists=1
elif [ -f "$full/bin/conda" ]; then
# finally, look for a full release
. $full/etc/profile.d/conda.sh &&
prefix=$full &&
conda activate &&
conda_exists=1
else
conda="$prefix/bin/conda"
fi
else
prefix="$(cd $(dirname $(which conda))/../; pwd)"
fi
if [ ${conda_exists+x} ]; then
echo "Found anaconda at $prefix"
if [ -d $prefix/envs/rsudp ]; then
rsudp_exists=1
echo "rsudp environment exists at $prefix/envs/rsudp"
read -rp $'Press Enter to continue with update, or type reinstall and press Enter to reinstall...\n' update_choice
if [[ "$update_choice" == *"reinstall"* ]]; then
echo "Removing existing rsudp"
rm -rf $prefix/envs/rsudp
echo "Reinstalling rsudp"
/bin/bash $dir_name/bin/unix-install.sh
else
echo "Starting update script."
/bin/bash $dir_name/bin/unix-update.sh
fi
else
echo "No rsudp environment found."
fi
fi
if [ -z ${rsudp_exists+x} ]; then
echo "Starting install script."
/bin/bash $dir_name/bin/unix-install.sh
fi