Debian Codegraph @

scripts/ftppass

raw
1 #! /bin/sh
2
3 if test -z "$1" ; then
4 echo "usage: $0 username@[hostname]" 1>&2
5 exit 1
6 fi
7
8 userhost=$1
9
10
11 if test -r "$AVFSBASE/#avfsstat" ; then
12 basedir="$AVFSBASE"
13 elif test -r "$HOME/.avfs/#avfsstat" ; then
14 basedir="$HOME/.avfs"
15 elif test -r "/#avfsstat" ; then
16 basedir=
17 elif test -r "/overlay/#avfsstat" ; then
18 basedir=/overlay
19 else
20 echo "AVFS not running" 1>&2
21 exit 1
22 fi
23
24 ctrlc () {
25 stty $oldsetting
26 echo
27 exit 127
28 }
29
30 oldsetting=`stty -g`
31 printf "Password: "
32 trap ctrlc 2 3 15
33 stty -echo
34 read passwd < /dev/tty
35 stty $oldsetting
36 echo
37
38 echo $passwd | cp /dev/stdin $basedir/#ftp_ctl:$userhost/password
39
40 if [ -e "$basedir/#ucftp_ctl" ]; then
41 echo $passwd | cp /dev/stdin $basedir/#ucftp_ctl:$userhost/password
42 fi