forked from RFnexus/modem73
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·94 lines (79 loc) · 2.52 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·94 lines (79 loc) · 2.52 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bash
set -e
if [[ $(id -u) -eq 0 ]]; then
echo "Do not run this script as root. It will ask for sudo when needed."
exit 1
fi
# Check if this is Debian, Ubuntu, or some other distribution that uses APT.
if apt -h >/dev/null 2>&1; then
echo "APT-based distribution detected"
DIST_STYLE="debian"
# Check if this is Arch Linux.
elif stat /etc/arch-release >/dev/null 2>&1; then
echo "Pacman-based distribution detected"
DIST_STYLE="arch"
# No other distribution styles are supported at this time.
else
echo "This script requires a Debian-based system with APT, or alternately,"
echo "Arch Linux. No other distributions are supported yet."
exit 1
fi
PARENT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
echo "=== MODEM73 Installer ==="
echo "Install directory: $PARENT_DIR"
echo ""
# Depending on the distribution style, the naming convention and sources for
# the dependent packages will be different.
if [[ $DIST_STYLE == "debian" ]]; then
PACKAGES="git build-essential libncurses-dev g++"
elif [[ $DIST_STYLE == "arch" ]]; then
PACKAGES="git base-devel ncurses"
fi
read -rp "Install hamlib for rigctl PTT support? [y/N] " HAMLIB
if [[ "$HAMLIB" =~ ^[Yy]$ ]]; then
if [[ $DIST_STYLE == "debian" ]]; then
PACKAGES="$PACKAGES libhamlib-dev libhamlib-utils"
elif [[ $DIST_STYLE == "arch" ]]; then
PACKAGES="$PACKAGES hamlib"
fi
fi
read -rp "Install libhidapi-dev for CM108 USB PTT support? [y/N] " CM108
if [[ "$CM108" =~ ^[Yy]$ ]]; then
if [[ $DIST_STYLE == "debian" ]]; then
PACKAGES="$PACKAGES libhidapi-dev"
elif [[ $DIST_STYLE == "arch" ]]; then
PACKAGES="$PACKAGES hidapi"
fi
fi
echo ""
echo "Installing packages: $PACKAGES"
if [[ $DIST_STYLE == "debian" ]]; then
sudo apt update
sudo apt install -y $PACKAGES
elif [[ $DIST_STYLE == "arch" ]]; then
sudo pacman -Sy
sudo pacman -S $PACKAGES
fi
cd "$PARENT_DIR"
if [ ! -d "modem73" ]; then
git clone "https://github.com/RFnexus/modem73.git"
fi
cd modem73
make clean 2>/dev/null || true
make -j"$(nproc)"
echo ""
echo "Build complete."
echo ""
read -rp "Install modem73 to /usr/local/bin? [y/N] " INSTALL
if [[ "$INSTALL" =~ ^[Yy]$ ]]; then
# Some Arch Linux systems, and even some Debian-like ones that have been
# modified, may not have /usr/local/bin as a valid directory. If that is
# the case, create it.
sudo mkdir -p /usr/local/bin
sudo make install
echo ""
echo "Run: modem73 to launch"
else
echo ""
echo "Run: cd $(pwd) && ./modem73 to launch"
fi