1
0
Fork 0

remove tridactyl script

This commit is contained in:
Luca Bilke 2023-02-21 23:17:31 +01:00
parent 643d80c751
commit 5a49868890
1 changed files with 0 additions and 60 deletions

View File

@ -1,60 +0,0 @@
#!/bin/sh
echoerr() {
red="\\033[31m"
normal="\\e[0m"
printf "%b\n" "$red$*$normal" >&2
}
sedEscape() {
printf "%s" "$@" | sed 's/[&/\]/\\&/g'
}
run() {
set -e
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
manifest_home="$HOME/.librewolf/native-messaging-hosts/"
binary_suffix="Linux"
native_version="$(curl -sSL https://api.github.com/repos/tridactyl/native_messenger/releases/latest | grep "tag_name" | cut -d':' -f2- | sed 's|[^0-9\.]||g')"
manifest_loc="https://raw.githubusercontent.com/tridactyl/native_messenger/$native_version/tridactyl.json"
native_loc="https://github.com/tridactyl/native_messenger/releases/download/$native_version/native_main-$binary_suffix"
manifest_file="$manifest_home/tridactyl.json"
native_file="$XDG_DATA_HOME/tridactyl/native_main"
echo "Installing manifest here: $manifest_home"
echo "Installing script here: XDG_DATA_HOME: $XDG_DATA_HOME/tridactyl"
mkdir -p "$manifest_home" "$XDG_DATA_HOME"
curl -sSL --create-dirs -o "$manifest_file" "$manifest_loc"
curl -sSL --create-dirs -o "$native_file" "$native_loc"
if [ ! -f "$manifest_file" ] ; then
echoerr "Failed to create '$manifest_file'. Please make sure that the directories exist and that you have the necessary permissions."
exit 1
fi
if [ ! -f "$native_file" ] ; then
echoerr "Failed to create '$native_file'. Please make sure that the directories exist and that you have the necessary permissions."
exit 1
fi
sed -i.bak "s/REPLACE_ME_WITH_SED/$(sedEscape "$native_file")/" "$manifest_file"
chmod +x "$native_file"
echo
echo "Successfully installed Tridactyl native messenger!"
echo "Run ':native' in Firefox to check."
}
# Run the run function in a subshell so that it can be exited early if an error
# occurs
if ret="$(run "$@")"; then
# Print captured output
printf "%b\n" "$ret"
else
# Print captured output, ${ret:+\n} adds a newline only if ret isn't empty
printf "%b" "$ret${ret:+\n}"
echoerr 'Failed to install!'
fi