-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·107 lines (91 loc) · 2.91 KB
/
install.sh
File metadata and controls
executable file
·107 lines (91 loc) · 2.91 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
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
#
#########################################################################################
#
# SCRIPT : install.sh
# AUTHOR : Rofi (Fixploit03)
# GITHUB : https://github.com/fixploit03/run_ap
# LISENSI : MIT
#
#########################################################################################
#
# Script ini sepenuhnya FREE (alias GRATIS!)
#
#########################################################################################
set -e
#-------------- Cek Root --------------#
if [[ $EUID -ne 0 ]]; then
echo "ERROR: Script ini harus dijalankan sebagai root!"
exit 1
fi
#-------------- Cek Koneksi Internet --------------#
if ! ping -c 1 -W 2 8.8.8.8 &>/dev/null; then
echo "ERROR: Tidak ada koneksi internet!"
exit 1
fi
#-------------- Cek Direktori run_ap --------------#
if [[ -d "/usr/share/run_ap" ]]; then
echo "ERROR: Direktori '/usr/share/run_ap' sudah ada!"
exit 1
fi
#-------------- Update & Instal --------------#
#
# arch linux
if [[ -f /etc/arch-release ]]; then
command_update="pacman -Syu --noconfirm"
command_install="pacman -S --noconfirm"
dependensi="base-devel libnl openssl pkgconf"
# debian
elif [[ -f /etc/debian_version ]]; then
command_update="apt-get update -y"
command_install="apt-get install -y"
dependensi="build-essential libnl-3-dev libnl-genl-3-dev libssl-dev pkg-config"
fi
#-------------- Update Repositori --------------#
echo "INFO: Mengupdate repositori..."
eval "${command_update}"
#-------------- Instal Dependensi --------------#
echo "INFO: Menginstal dependensi yang dibutuhkan..."
eval "${command_install} ${dependensi} git iw dnsmasq wget binutils nano figlet freeradius"
#-------------- Kloning Repositori --------------#
echo "INFO: Mengkloning repositori..."
if ! git clone https://github.com/fixploit03/run_ap.git /usr/share/run_ap; then
echo "ERROR: Gagal mengkloning repositori!"
exit 1
fi
cd /usr/share/run_ap
root_dir=$(pwd)
path=/usr/sbin
#-------------- Backup hostapd --------------#
if [[ -f "${path}/hostapd" ]]; then
mv "${path}/hostapd" "${path}/hostapd.bak"
fi
#-------------- Backup hostapd_cli --------------#
if [[ -f "${path}/hostapd_cli" ]]; then
mv "${path}/hostapd_cli" "${path}/hostapd_cli.bak"
fi
#-------------- Download hostapd --------------#
echo "INFO: Mendownload file 'hostapd-2.11.tar.gz'..."
if ! wget "https://w1.fi/releases/hostapd-2.11.tar.gz"; then
echo "ERROR: Gagal mendownload file 'hostapd-2.11.tar.gz'!"
exit 1
fi
echo "INFO: Mengekstrak file 'hostapd-2.11.tar.gz'..."
tar -zxvf hostapd-2.11.tar.gz
#-------------- Compile & Instal hostapd --------------#
cp etc/.config hostapd-2.11/hostapd/
cd hostapd-2.11/hostapd/
make clean
make -j"$(nproc)"
make install
cp hostapd "${path}"
cp hostapd_cli "${path}"
ldconfig
hash -r
#-------------- Instal run_ap --------------#
cd "${root_dir}"
cp run_ap.sh /usr/local/bin/run_ap
cp scripts/* /usr/local/bin/
rm -rf hostapd-2.11 hostapd-2.11.tar.gz
echo "INFO: run_ap berhasil instal!"
exit 0