-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·64 lines (50 loc) · 2.35 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
62
63
64
#!/bin/bash
# Store the current directory (where the script is executed)
ORIGINAL_DIR="$(pwd)"
# Define the repository URL and the target directory
REPO_URL="https://github.com/lakinduakash/linux-wifi-hotspot"
TARGET_DIR="/tmp/linux-wifi-hotspot"
# Install necessary dependencies
echo "Updating package list and installing dependencies..."
sudo apt-get update
sudo apt-get install -y libgtk-3-dev build-essential gcc g++ pkg-config make hostapd libqrencode-dev libpng-dev haveged
# Install haveged to avoid low entropy issues
echo "Starting haveged service for entropy generation..."
sudo systemctl enable haveged
sudo systemctl start haveged
# Install yq for YAML processing
echo "Installing yq for YAML editing..."
sudo wget https://github.com/mikefarah/yq/releases/download/v4.30.8/yq_linux_arm -O /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
# Clone and install the linux-wifi-hotspot repository
echo "Cloning linux-wifi-hotspot repository..."
if [ -d "$TARGET_DIR" ]; then
echo "Removing existing directory $TARGET_DIR"
rm -rf "$TARGET_DIR"
fi
git clone "$REPO_URL" "$TARGET_DIR"
# Move into the target directory for installation
cd "$TARGET_DIR"
echo "Building and installing linux-wifi-hotspot CLI..."
make
sudo make install-cli-only
# Clean up the temporary installation directory
echo "Cleaning up temporary files..."
rm -rf "$TARGET_DIR"
# Return to the original directory to ensure correct paths for copying configuration scripts
cd "$ORIGINAL_DIR"
# Copy configuration scripts and service files
echo "Copying scripts to /usr/local/bin..."
sudo cp setup_ap.sh kill_ap.sh clean_ap_and_configure_netplan.sh /usr/local/bin/
sudo chmod +x /usr/local/bin/setup_ap.sh /usr/local/bin/kill_ap.sh /usr/local/bin/clean_ap_and_configure_netplan.sh
echo "Copying systemd service file to /etc/systemd/system..."
sudo cp systemd_services/setup_ap.service /etc/systemd/system/
# Enable the setup_ap service
echo "Enabling the access point service..."
sudo systemctl daemon-reload
sudo systemctl enable setup_ap.service
echo "Installation and setup complete."
echo "Utility scripts installed in /usr/local/bin:"
echo "- setup_ap.sh: Script to set up the AP and back up the current netplan config."
echo "- kill_ap.sh: Script to stop the AP and restore netplan config."
echo "- clean_ap_and_configure_netplan.sh: Script to clean up the AP and generate a new netplan configuration."