Upload files to "angry_scripts"
This commit is contained in:
parent
db879f6854
commit
82a18a22c3
3 changed files with 135 additions and 0 deletions
23
angry_scripts/buildAngryOxide.sh
Normal file
23
angry_scripts/buildAngryOxide.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
sudo apt install git -y
|
||||||
|
|
||||||
|
echo "Downloading rust...."
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
|
||||||
|
source $HOME/.cargo/env
|
||||||
|
|
||||||
|
echo "Cloning AngryOxide"
|
||||||
|
|
||||||
|
git clone https://github.com/Ragnt/AngryOxide.git
|
||||||
|
cd AngryOxide
|
||||||
|
|
||||||
|
echo "Building Project...."
|
||||||
|
make
|
||||||
|
|
||||||
|
echo "Installing AngryOxide"
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
echo "Installation complete"
|
||||||
30
angry_scripts/getAngryOxide.sh
Normal file
30
angry_scripts/getAngryOxide.sh
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
sudo apt install jq
|
||||||
|
|
||||||
|
CPU_ARCHTIECTURE=$(lscpu | grep Architecture | awk {'print $2'})
|
||||||
|
|
||||||
|
json=$(curl -s "https://api.github.com/repos/Ragnt/AngryOxide/releases")
|
||||||
|
|
||||||
|
latest_tag=$(echo "$json" | jq -r '.[0].tag_name')
|
||||||
|
|
||||||
|
version=$(echo "$latest_tag" | awk -F 'v' '{print $2}')
|
||||||
|
|
||||||
|
wget https://github.com/Ragnt/AngryOxide/releases/download/${latest_tag}/angryoxide-linux-${CPU_ARCHTIECTURE}-musl.tar.gz
|
||||||
|
|
||||||
|
tar -xvf angryoxide-linux-${CPU_ARCHTIECTURE}-musl.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$version" < "0.8.5" ]]; then
|
||||||
|
|
||||||
|
sudo mv angryoxide /usr/local/bin/
|
||||||
|
COMPETIONS=$(pkg-config --variable=completionsdir bash-completion)
|
||||||
|
sudo mv completions/angryoxide $COMPETIONS
|
||||||
|
rm -rf completions/ angryoxide-linux-${CPU_ARCHTIECTURE}-musl.tar.gz
|
||||||
|
else
|
||||||
|
|
||||||
|
chmod +x install.sh
|
||||||
|
sudo ./install.sh install
|
||||||
|
rm -rf angryoxide completions/ angryoxide-linux-${CPU_ARCHTIECTURE}-musl.tar.gz
|
||||||
|
fi
|
||||||
82
angry_scripts/install.sh
Normal file
82
angry_scripts/install.sh
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
#!/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..."
|
||||||
|
chmod +x $prog
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
install_binary
|
||||||
|
install_bash
|
||||||
|
install_zsh
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Loading…
Reference in a new issue