-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't view or download raw file #74
Comments
https://raw.githubusercontent.com/tridactyl/native_messenger/master/installers/install.sh works fine for me. The script is quite short so I'll post it here: #!/usr/bin/env sh
echoerr() {
red="\\033[31m"
normal="\\e[0m"
printf "%b\n" "$red$*$normal" >&2
}
sedEscape() {
printf "%s" "$@" | sed 's/[&/\]/\\&/g'
}
# To install, curl -fsSl 'url to this script' | sh
# Or run "./installers/install.sh local" in the repository of the
# native messanger.
run() {
set -e
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/tridactyl"
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/tridactyl"
# Decide where to put the manifest based on OS
# Get OSTYPE from bash if it's installed. If it's not, then this will
# default to the Linux location as OSTYPE will be empty
OSTYPE="$(command -v bash >/dev/null && bash -c 'echo $OSTYPE')"
case "$OSTYPE" in
linux-gnu|linux-musl|linux|freebsd*)
manifest_home="$HOME/.mozilla/native-messaging-hosts/"
binary_suffix="Linux"
;;
linux-gnueabihf)
manifest_home="$HOME/.mozilla/native-messaging-hosts/"
binary_suffix="armhf-Linux"
;;
darwin*)
manifest_home="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts/"
binary_suffix="macOS"
;;
*)
# Fallback to default Linux location for unknown OSTYPE
# TODO: fall back to old Python messenger
manifest_home="$HOME/.mozilla/native-messaging-hosts/"
binary_suffix="Linux"
;;
esac
if [ "$1" = "local" ] ; then
manifest_loc="file://"$(pwd)"/tridactyl.json"
native_loc="file://"$(pwd)"/native_main"
else
if [ -n "$1" ] ; then
native_version="$(curl -sSL https://raw.githubusercontent.com/tridactyl/tridactyl/"$1"/native/current_native_version 2>/dev/null)"
else
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')"
fi
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"
fi
mkdir -p "$manifest_home" "$XDG_DATA_HOME"
manifest_file="$manifest_home/tridactyl.json"
native_file="$XDG_DATA_HOME/native_main"
echo "Installing manifest here: $manifest_home"
echo "Installing script here: XDG_DATA_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"
## Apparently `curl`'d things don't get quarantined, so maybe we don't need this after all?
# case "$OSTYPE" in
# darwin*)
# echo
# echo "Please log in as an administrator to give Tridactyl's messenger permission to run:"
# sudo xattr -d com.apple.quarantine "$native_file"
# ;;
# esac
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
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to install the native messenger for tridactyl but I'm neither able to download it from the shell or download the raw file. The Url is not accessible from the browser
The text was updated successfully, but these errors were encountered: