Updated shell assumptions
This commit is contained in:
+1
-13
@@ -27,14 +27,11 @@ if [ -w "$(dirname "$INSTALL_BIN")" ]; then
|
||||
# Get release tag by $(curl -s https://git.cer.sh/api/v1/repos/axodouble/quptime/releases/latest | jq -r '.tag_name')
|
||||
RELEASE=$(curl -s https://git.cer.sh/api/v1/repos/axodouble/quptime/releases/latest | jq -r '.tag_name')
|
||||
# Download the latest release binary from the Git repository and save it to /usr/local/bin/qu
|
||||
if command -v curl > /dev/null; then
|
||||
|
||||
echo_cmd "curl -L -o \"/usr/local/bin/qu\" \"https://git.cer.sh/axodouble/quptime/releases/download/${RELEASE}/qu-${RELEASE}-linux-amd64\""
|
||||
echo_cmd "chmod +x \"/usr/local/bin/qu\""
|
||||
echo "> qu has been installed to /usr/local/bin/qu"
|
||||
|
||||
# Drop completions into the directories each shell already scans.
|
||||
# No rc-file edits, and uninstall is just `rm`. Silently skips
|
||||
# shells whose completion dir is absent.
|
||||
if "$INSTALL_BIN" --help 2>/dev/null | grep -q "completion"; then
|
||||
write_completion() {
|
||||
local shell=$1 path=$2
|
||||
@@ -53,17 +50,11 @@ if [ -w "$(dirname "$INSTALL_BIN")" ]; then
|
||||
else
|
||||
echo "> qu does not expose completion support; skipping shell completion installation."
|
||||
fi
|
||||
else
|
||||
echo "Error: curl is not installed. Please install curl and try again."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: You are not allowed to write to /usr/local/bin. Please install qu manually, or run this script with sudo."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the user has systemd, if so create a systemd service file for qu serve
|
||||
if command -v systemctl > /dev/null; then
|
||||
echo "> Creating systemd service file for qu serve..."
|
||||
|
||||
cat <<EOL > "$SERVICE_FILE"
|
||||
@@ -83,8 +74,5 @@ EOL
|
||||
echo_cmd "systemctl daemon-reload"
|
||||
echo_cmd "systemctl enable $(basename "$SERVICE_FILE")"
|
||||
echo "> qu serve service has been created and enabled. You can start it with 'systemctl start $(basename "$SERVICE_FILE")'"
|
||||
else
|
||||
echo "> Warning: systemd is not available on this system. qu serve will not be automatically started on boot. You can start it manually with '$INSTALL_BIN serve'"
|
||||
fi
|
||||
|
||||
echo "Installation complete, before starting `qu serve`, make sure to run `qu init` and read the documentation."
|
||||
|
||||
Reference in New Issue
Block a user