diff options
| -rwxr-xr-x | bin/common/gt | 22 | ||||
| -rw-r--r-- | config/essentials/shell/aliases.sh | 1 | ||||
| -rw-r--r-- | config/essentials/shell/functions.sh | 16 |
3 files changed, 29 insertions, 10 deletions
diff --git a/bin/common/gt b/bin/common/gt index 03ca464..cf05a1e 100755 --- a/bin/common/gt +++ b/bin/common/gt @@ -20,7 +20,7 @@ touch "$REPOS" || exit 1 which parallel >/dev/null 2>&1 && parallel=1 help() { - cat >&2 <<EOF + >&2 cat <<EOF usage: gt [OPTION] -a PATH add repo -c COMMAND run 'git COMMAND' in each repo @@ -66,18 +66,22 @@ while getopts ":a:c:f:dlsheu" opt; do exit 1 fi - repo="$(git rev-parse --show-toplevel)" - remote_url="$(git remote show -n origin | awk '/^ Fetch/ {print $NF}')" - # TODO: check if remote_url is not empty + repo="$(git rev-parse --show-toplevel 2>/dev/null)" + remote_url="$(git remote show -n origin 2>/dev/null | awk '/^ Fetch/ {print $NF}')" + if [ -z "$repo" ] || [ -z "$remote_url" ] + then + >&2 printf 'Couldn'\''t add '\''%s'\'', not a git repository.\n' "$OPTARG" + exit 1 + fi if grep "^$repo " "$REPOS" >/dev/null 2>&1; then - printf >&2 'added already.\n' - exit 3 + >&2 printf 'added already.\n' + exit 1 fi printf '%s %s\n' "$repo" "$remote_url" >>"$REPOS" - printf >&2 'added.\n' + >&2 printf 'added.\n' ;; c) quit_when_no_repos @@ -144,11 +148,11 @@ while getopts ":a:c:f:dlsheu" opt; do ;; h) help ;; :) - printf >&2 -- '-%s requires argument\n' "$OPTARG" + >&2 printf -- '-%s requires argument\n' "$OPTARG" exit 1 ;; ?) - printf >&2 -- 'Invalid option: -%s\n' "$OPTARG" + >&2 printf -- 'Invalid option: -%s\n' "$OPTARG" exit 1 ;; esac diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 655a061..7ebbadc 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -333,5 +333,4 @@ else alias pkg_search_online='pacman -Ss' alias pkg_install='doas pacman -S' alias pkg_search_owned='pkgfile' - alias fi diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 478ee26..ef745c9 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -408,3 +408,19 @@ trclipo() transmission-remote autumn -a -w "/downloads/$choice" "$magnet" } + +debinstall() +{ + if [ "$1" ] + then + ar p "$1" data.tar.xz | + tar -xv -J; find usr -type f | + while read -r file + do + >&2 printf 'cp %s /usr/local/%s\n' "$file" "${file#usr/}" + doas cp "$file" "/usr/local${file#usr}" + done + else + >&2 printf 'usage: %s <source.deb>\n' "$0" + fi +} |
