Skip to content

Commit

Permalink
update install and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragnt committed Mar 26, 2024
1 parent a8ca496 commit b10028a
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -91,7 +91,7 @@ jobs:
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} ../../../install.sh ../../../completions
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }} ../../../install ../../../completions
cd -
if: |
startsWith( github.ref, 'refs/tags/v' )
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -4,4 +4,4 @@
*.pcapng
*.kismet
*.hc22000
install

2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -2,7 +2,7 @@
members = ["libs/libwifi", "libs/libwifi_macros", "libs/pcap-file"]

[workspace.package]
version = "0.8.11"
version = "0.8.12"
authors = ["Ryan Butler"]
description = "80211 Attack Tool"
license = "GPL"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -26,8 +26,8 @@ You can download pre-compiled binaries of AngryOxide in the [releases](https://g

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

You can get information about how to use AngryOxide in the [User Guide](https://github.com/Ragnt/AngryOxide/wiki/1.-User-Guide).
Expand Down
80 changes: 80 additions & 0 deletions install
@@ -0,0 +1,80 @@
#!/bin/bash

prog="angryoxide"
bash_completion_script="completions/bash_angryoxide_completions"
zsh_completion_script="completions/zsh_angryoxide_completions"
BASH_COMPLETION_DIR="/etc/bash_completion.d"
ZSH_COMPLETION_DIR="/home"

check_root() {
if [[ "$(id -u)" -ne 0 ]]; then
echo "This operation must be run as root. Please use sudo." >&2
exit 1
fi
}

install_binary() {
check_root
echo "Installing $prog binary..."
cp "$prog" "/usr/bin/$prog"
}

install_bash() {
check_root
if command -v bash &> /dev/null; then
echo "Installing bash completion for $prog..."
mkdir -p "$BASH_COMPLETION_DIR"
cp "$bash_completion_script" "$BASH_COMPLETION_DIR/$prog"
echo "Bash completion installed successfully."
else
echo "Bash not found, skipping Bash completion installation."
fi
}

install_zsh() {
check_root
if command -v zsh &> /dev/null; then
echo "Installing zsh completion for $prog for all users..."
for dir in $ZSH_COMPLETION_DIR/*; do
if [[ -d "$dir" ]]; then
user=$(basename "$dir")
zsh_dir="$dir/.zsh/completion"
echo "Installing for user $user..."
mkdir -p "$zsh_dir"
cp "$zsh_completion_script" "$zsh_dir/_$prog"
chown "$user:$user" "$zsh_dir/_$prog"
fi
done
echo "Zsh completion installed successfully for all users."
else
echo "Zsh not found, skipping Zsh completion installation."
fi
}

uninstall() {
check_root
echo "Uninstalling $prog..."
rm -f "/usr/bin/$prog"
rm -f "$BASH_COMPLETION_DIR/$prog"
for dir in $ZSH_COMPLETION_DIR/*; do
if [[ -d "$dir" ]]; then
rm -f "$dir/.zsh/completion/_$prog"
fi
done
echo "Cleaned installed binary and completion scripts."
}

case "$1" in
install)
install_binary
install_bash
install_zsh
;;
uninstall)
uninstall
;;
*)
echo "Usage: $0 (install|uninstall)"
exit 1
;;
esac

0 comments on commit b10028a

Please sign in to comment.