diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/common/gt-cmd | 12 | ||||
| -rwxr-xr-x | bin/extra/curszip | 6 | ||||
| -rwxr-xr-x | bin/menuscripts/mmedia | 4 | 
3 files changed, 11 insertions, 11 deletions
diff --git a/bin/common/gt-cmd b/bin/common/gt-cmd index 74b5f78..8cf30ae 100755 --- a/bin/common/gt-cmd +++ b/bin/common/gt-cmd @@ -17,13 +17,13 @@ fi  # Check if repo's remote's key is in ssh-agent  # If key is not registered and command is push/pull we exit with error +# Note: +# path to key: ~/.ssh/<hostname>.pub +# where <hostname> is the same in ssh config  r="$(grep "$repo" "$REPOS" | cut -f 2 -d ' ' | cut -f 2 -d '@' | cut -f 1 -d ':')" -if { [ "$command" = "push" ] || [ "$command" = "pull" ]; } &&  -    # In my ssh config every Host has the same name as its private key.  This means remotes in -    # "$REPOS" (here "$r") + .pub is the public key, so we convert the name to what would be the -    # public key's name and check if its contents are registered in the ssh-agent. -    [ -r "$HOME/.ssh/$r.pub" ] && -    ! ssh-add -L | grep "$(cat "$HOME/.ssh/$r.pub")" > /dev/null +if { [ "$command" = "push" ] || [ "$command" = "pull" ] || [ "$command" = "fetch" ]; } && +    # key not registered in agent +    ! { ssh-add -L | grep "$(cat "$HOME/.ssh/$r.pub")" > /dev/null; }  then      printf '%s: '\''%s'\'' not in ssh-agent\n' "$repo_pretty" "$r"       exit 1 diff --git a/bin/extra/curszip b/bin/extra/curszip index 0de772f..2d86284 100755 --- a/bin/extra/curszip +++ b/bin/extra/curszip @@ -4,17 +4,17 @@  # $2: type  list1() { find "$1" -mindepth 1 -maxdepth 1 -type "$2" -printf '%f\n'; } -curs="$(list1 ~/docs/school/Vakken d | dmenu -c)" +curs="$(list1 "$VAKKEN" d | dmenu -c)"  [ "$curs" ] || exit 1  >&2 printf "curs: %s\n" "$curs"  dldir="$(which xdg-user-dir > /dev/null 2>&1 && xdg-user-dir 'DOWNLOAD' || echo '~/dl')"  zip="$(list1 "$dldir" f | fzf -f "$curs" | grep '\.zip$')" -[ "$zip" ] || exit 1 +[ "$zip" ] || exit 2  >&2 printf "zip: %s\n" "$zip" -cd -- ~/docs/school/Vakken/"$curs" || exit 1 +cd -- "$VAKKEN"/"$curs" || exit 3  rm -rf Cursus  mv -- ~/dl/"$zip" .  unzip -- "./$zip" diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia index f4e6e3c..147a1dc 100755 --- a/bin/menuscripts/mmedia +++ b/bin/menuscripts/mmedia @@ -24,13 +24,13 @@ case "$1" in  	;;  "cursus")  	regex='^.*/[cC]ursus/index.html$' -	dirs="$HOME/docs/school/Vakken" +	dirs="$VAKKEN"  	concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##"; }  	viewer() { $BROWSER "$1"; }  	;;  "schoolpdf")  	regex='^.\+\.\(pdf\)$' -	dirs="$HOME/docs/school/Vakken" +	dirs="$VAKKEN"  	concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##;s#/Cursus/viewer/files/#: #"; }  	viewer() { $VIEWER "$1"; }  	;;  | 
