Skip to content

Commit b10028a

Browse files
committed
update install and workflow
1 parent a8ca496 commit b10028a

File tree

6 files changed

+86
-6
lines changed

6 files changed

+86
-6
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
shell: bash
9292
run: |
9393
cd target/${{ matrix.platform.target }}/release
94-
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} ../../../install.sh ../../../completions
94+
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} ../../../install ../../../completions
9595
cd -
9696
if: |
9797
startsWith( github.ref, 'refs/tags/v' )

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
*.pcapng
55
*.kismet
66
*.hc22000
7-
install
7+

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
members = ["libs/libwifi", "libs/libwifi_macros", "libs/pcap-file"]
33

44
[workspace.package]
5-
version = "0.8.11"
5+
version = "0.8.12"
66
authors = ["Ryan Butler"]
77
description = "80211 Attack Tool"
88
license = "GPL"

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ You can download pre-compiled binaries of AngryOxide in the [releases](https://g
2626

2727
```bash
2828
tar -xf angryoxide-linux-x86_64.tar.gz # Untar
29-
chmod +x install.sh # Make executable
30-
sudo install.sh install # Install (as root, including zsh/bash completions)
29+
chmod +x install # Make executable
30+
sudo install install # Install (as root, including zsh/bash completions)
3131
```
3232

3333
You can get information about how to use AngryOxide in the [User Guide](https://github.com/Ragnt/AngryOxide/wiki/1.-User-Guide).

install

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
3+
prog="angryoxide"
4+
bash_completion_script="completions/bash_angryoxide_completions"
5+
zsh_completion_script="completions/zsh_angryoxide_completions"
6+
BASH_COMPLETION_DIR="/etc/bash_completion.d"
7+
ZSH_COMPLETION_DIR="/home"
8+
9+
check_root() {
10+
if [[ "$(id -u)" -ne 0 ]]; then
11+
echo "This operation must be run as root. Please use sudo." >&2
12+
exit 1
13+
fi
14+
}
15+
16+
install_binary() {
17+
check_root
18+
echo "Installing $prog binary..."
19+
cp "$prog" "/usr/bin/$prog"
20+
}
21+
22+
install_bash() {
23+
check_root
24+
if command -v bash &> /dev/null; then
25+
echo "Installing bash completion for $prog..."
26+
mkdir -p "$BASH_COMPLETION_DIR"
27+
cp "$bash_completion_script" "$BASH_COMPLETION_DIR/$prog"
28+
echo "Bash completion installed successfully."
29+
else
30+
echo "Bash not found, skipping Bash completion installation."
31+
fi
32+
}
33+
34+
install_zsh() {
35+
check_root
36+
if command -v zsh &> /dev/null; then
37+
echo "Installing zsh completion for $prog for all users..."
38+
for dir in $ZSH_COMPLETION_DIR/*; do
39+
if [[ -d "$dir" ]]; then
40+
user=$(basename "$dir")
41+
zsh_dir="$dir/.zsh/completion"
42+
echo "Installing for user $user..."
43+
mkdir -p "$zsh_dir"
44+
cp "$zsh_completion_script" "$zsh_dir/_$prog"
45+
chown "$user:$user" "$zsh_dir/_$prog"
46+
fi
47+
done
48+
echo "Zsh completion installed successfully for all users."
49+
else
50+
echo "Zsh not found, skipping Zsh completion installation."
51+
fi
52+
}
53+
54+
uninstall() {
55+
check_root
56+
echo "Uninstalling $prog..."
57+
rm -f "/usr/bin/$prog"
58+
rm -f "$BASH_COMPLETION_DIR/$prog"
59+
for dir in $ZSH_COMPLETION_DIR/*; do
60+
if [[ -d "$dir" ]]; then
61+
rm -f "$dir/.zsh/completion/_$prog"
62+
fi
63+
done
64+
echo "Cleaned installed binary and completion scripts."
65+
}
66+
67+
case "$1" in
68+
install)
69+
install_binary
70+
install_bash
71+
install_zsh
72+
;;
73+
uninstall)
74+
uninstall
75+
;;
76+
*)
77+
echo "Usage: $0 (install|uninstall)"
78+
exit 1
79+
;;
80+
esac

0 commit comments

Comments
 (0)