| 1 | #!/bin/bash |
| 2 | # -*- sh -*- |
| 3 | # set-login-with-default-bin.sh |
| 4 | # Copyright (C) 2008 g10 Code GmbH |
| 5 | # |
| 6 | # This file is part of Poldi. |
| 7 | # |
| 8 | # Poldi is free software; you can redistribute it and/or modify it |
| 9 | # under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation; either version 3 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | # Poldi is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | # GNU General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | program_name="set-login-with-default-pin.sh" |
| 22 | |
| 23 | if [ "$#" != "1" ]; then |
| 24 | echo "Usage: ${program_name} <login data>" >&2 |
| 25 | exit 1 |
| 26 | fi |
| 27 | |
| 28 | logindata="$1" |
| 29 | logindata_final=$(echo -ne "${logindata}" | sed -e 's/+/%2b/;' | sed -e 's/ /+/;') |
| 30 | logindata_final="${logindata_final}%0a%14F=3%18" |
| 31 | |
| 32 | #echo "'$logindata_final'" |
| 33 | echo "SCD SETATTR LOGIN-DATA ${logindata_final}" | gpg-connect-agent |
| 34 | |
| 35 | exit 0 |