diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-09-19 15:00:03 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-09-19 15:00:03 +0200 |
commit | 5126b17be04fcc75dd1327975acb2f27080a1061 (patch) | |
tree | 3f100c5ce5072937a403591d52f2afbbbbb16a94 /bin/guiscripts | |
parent | 55fc5130e6cd5650dd82e2955b4266eb92c33738 (diff) |
removed scripts and made seperate project
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-x | bin/guiscripts/keyadd | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd deleted file mode 100755 index cb81efe..0000000 --- a/bin/guiscripts/keyadd +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh - -# For when script calls itself -if [ -n "$PASSWORD" ] -then - pass show "$PASSWORD" && - exit - exit 1 -fi - - -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --matching-algorithm=normal" -else - menucmd="$MENUCMD" -fi - - -die () -{ - echo "$1" >&2 -} - -notify () -{ - notify-send -t 1000 "keyadd" "$1" - die "$1" -} - - -SSHFOLDER="$HOME/.ssh" - -# Test if can connect to ssh-agent -ssh-add -l > /dev/null 2>&1 -if [ $? -gt 1 ] # ignore if there are no identities -then - notify "Could not connect to agent." - exit 1 -fi - -if [ -z "${key:=$1}" ] -then - key="$(find "$SSHFOLDER" -iname "*.pub" | - sed "s,$SSHFOLDER/,," | # Clean - sed 's/\.pub$//' | - $menucmd)" -else - shift -fi -die "key: $key" - -[ ! -f "$SSHFOLDER/$key" ] && exit 1 - -HOST=$(hostnamectl hostname) -die "host: $HOST" - -if [ "$1" = "-d" ] -then - if ssh-add -q -d - < "$SSHFOLDER"/"$key".pub 2> /dev/null - then - notify "Deleted <b>$key</b>" - else - notify "Could not delete." - fi -# check if key is already added -elif ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/"$key")" -then - notify "Key already added." -else - export PASSWORD="keys/$HOST/ssh/$key" - export SSH_ASKPASS="$0" - ssh-add -q - < "$SSHFOLDER"/"$key" && - notify "Added <b>$key</b>." -fi |