diff --git a/README.md b/README.md index 13ff0f1e311e971f30c89ab181df61c41bbb0a30..8abcea47efd19f76aa9be5b19c90d6dd4d42b0f5 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ gnome-keyring-yubikey-unlock/create_secret_file.sh /path/to/your_secret [Your Gn # input your keyring:password ``` -As an example, I need to input `默认钥匙环:My_Very_Long_Login_Password`. +As an example, I need to input `默认钥匙环:My_Very_Long_Login_Password`. (You may use `seahorse` to determine the name of your keyring) Then, add the following command to gnome-autostart. You should know how to auto-run a command after starting gnome. diff --git a/unlock_keyrings.sh b/unlock_keyrings.sh index 43e30718bdcc5a907640bedd5033bf1fd9b3909c..5638eec507b93b04bce18fb9f7b01653808af60d 100755 --- a/unlock_keyrings.sh +++ b/unlock_keyrings.sh @@ -1,7 +1,7 @@ #!/bin/bash # This script should be run after gnome being started. -_my_path="$0" +_self_bin_name="$0" secret_file="$1" [[ "$secret_file" = '' ]] && echo "Usage: $0 <secret_file>" && exit 1 @@ -15,10 +15,11 @@ function where_is_him () { done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" echo -n "$DIR" - } +} function where_am_i () { - where_is_him "$_my_path" + _my_path=`type -p ${_self_bin_name}` + [[ "$_my_path" = "" ]] && where_is_him "$_self_bin_name" || where_is_him "$_my_path" } cd `where_am_i` &&