diff --git a/scripts/release.sh b/scripts/release.sh index 1e638af..74f731c 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -49,9 +49,12 @@ if gdbus introspect --session \\ --dest io.github.retrozinndev.colorshell \\ --object-path /io/github/retrozinndev/colorshell > /dev/null 2>&1; then - echo \"\$@\" | socat - \"\${XDG_RUNTIME_DIR:-/run/user/\$(id -u)}/colorshell.sock\" - exit 0 - + if command -v socat; then + echo \"\$@\" | socat - \"\${XDG_RUNTIME_DIR:-/run/user/\$(id -u)}/colorshell.sock\" + exit 0 + else + echo \"[warn] \`socat\` not installed, falling back to remote instance communication\" + fi fi `cat "${outdir:-./build/release}/colorshell" | sed -e 's/^#.*//'`" # remove shebang @@ -61,5 +64,5 @@ fi echo "[info] making desktop entry" entry=`cat ./resources/colorshell.desktop` -entry=${entry/\$COLORSHELL_BINARY/${bin_target:-\$HOME/.local/bin/colorshell}} -echo -n "$entry" > ${outdir:-./build/release}/colorshell.desktop +bin_target=${bin_target:-'$HOME/.local/bin/colorshell'} +echo -n "${entry/'$COLORSHELL_BINARY'/${bin_target/'$'/'\\\$'}}" > ${outdir:-./build/release}/colorshell.desktop diff --git a/scripts/sync-config.sh b/scripts/sync-config.sh index cbb7983..a4e460a 100644 --- a/scripts/sync-config.sh +++ b/scripts/sync-config.sh @@ -1,5 +1,3 @@ -#!/usr/bin/bash - source ./scripts/utils.sh config_dirs=( diff --git a/scripts/utils.sh b/scripts/utils.sh index ea882c8..9373765 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - # This script contains useful functions to be used # in other scripts from colorshell. # ---------- @@ -56,13 +54,17 @@ function Print_header() { # Input answer is exported as $answer # ------------- function Ask() { - read -n 1 -p "$1 [y/n] " r + read -n 1 -p "$@ [y/n] " answer printf '\n' - export answer=$r + if [[ ! $answer =~ [yn] ]]; then + Ask "$@" # restart if different from accepted chars + fi + + export answer } # ------------- -# Ask a yes/no question to user +# Ask the user to choose a number from the provided list # Input answer is exported as $answer # (this function is not done yet) # -------------