-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
61 lines (50 loc) · 1.71 KB
/
install.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
#!/bin/sh
set -e
# Check for necessary commands
for cmd in curl tar xz; do
if ! command -v $cmd > /dev/null 2>&1; then
echo "Error: '$cmd' is not installed. Please install it and try again." >&2
exit 1
fi
done
DEST=$1
# Prompt for installation path if not provided
if [ -z "$DEST" ]; then
printf "Where to install amumax? [Default=$HOME/.local/bin]: "
read DEST
if [ -z "$DEST" ]; then
DEST="$HOME/.local/bin"
fi
fi
mkdir -p "$DEST"
DEST=$(realpath "$DEST")
# Warn if DEST is not in PATH
case ":$PATH:" in
*:"$DEST":*) ;;
*)
echo && echo " !!! WARNING !!! '$DEST' not in PATH!"
echo "Consider adding '$DEST' to your PATH." >&2
;;
esac
# Download and install amumax
cd $DEST
echo "Downloading amumax from GitHub..."
curl -Ls https://github.com/mathieumoalic/amumax/releases/latest/download/amumax -o amumax
# Download and extract necessary libraries
echo "Downloading and extracting libcufft.so.10..."
curl -Ls https://developer.download.nvidia.com/compute/cuda/redist/libcufft/linux-x86_64/libcufft-linux-x86_64-10.9.0.58-archive.tar.xz -o tmp
tar -xJf tmp > /dev/null
cp -L libcufft-linux-x86_64-10.9.0.58-archive/lib/libcufft.so.10 .
echo "Downloading and extracting libcurand.so.10..."
curl -Ls https://developer.download.nvidia.com/compute/cuda/redist/libcurand/linux-x86_64/libcurand-linux-x86_64-10.3.6.39-archive.tar.xz -o tmp
tar -xJf tmp > /dev/null
cp -L libcurand-linux-x86_64-10.3.6.39-archive/lib/libcurand.so.10 .
# Clean up
rm -rf libcufft-linux-x86_64-10.9.0.58-archive
rm -rf libcurand-linux-x86_64-10.3.6.39-archive
rm tmp
# Make amumax executable
echo "Setting amumax as executable"
chmod +x amumax
# Completion message
echo "Installation complete. You can now use 'amumax'."