diff options
Diffstat (limited to 'urunlevel/my_linux/Trinux/gethome')
-rwxr-xr-x | urunlevel/my_linux/Trinux/gethome | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/urunlevel/my_linux/Trinux/gethome b/urunlevel/my_linux/Trinux/gethome new file mode 100755 index 0000000..c47c238 --- /dev/null +++ b/urunlevel/my_linux/Trinux/gethome | |||
@@ -0,0 +1,61 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if [ "$1" ] | ||
4 | then | ||
5 | home=$1 | ||
6 | else | ||
7 | home="home" | ||
8 | fi | ||
9 | |||
10 | homeline=`cat /etc/tux/config/home` | ||
11 | |||
12 | if [ "$homeline" ] | ||
13 | then | ||
14 | PROTO=`cut -d':' -f1 /etc/tux/config/home` | ||
15 | HOST=`cut -d':' -f2 /etc/tux/config/home` | ||
16 | USER=`cut -d':' -f3 /etc/tux/config/home` | ||
17 | else | ||
18 | echo -n "ftp or ssh: " | ||
19 | read PROTO | ||
20 | echo -n "Host: " | ||
21 | read HOST | ||
22 | echo -n "User: " | ||
23 | read USER | ||
24 | echo $PROTO:$HOST:$USER > /etc/tux/config/home | ||
25 | fi | ||
26 | |||
27 | |||
28 | echo "Retrieving home directory from $USER@$HOST via $PROTO" | ||
29 | |||
30 | if [ $PROTO = "ssh" ] | ||
31 | then | ||
32 | scp $USER@$HOST:~/$home.tgz / | ||
33 | fi | ||
34 | |||
35 | if [ $PROTO = "ftp" ] | ||
36 | then | ||
37 | echo "Using FTP to transfor $home.tgz -- your passwords are sniffable" | ||
38 | |||
39 | if [ -x /usr/bin/curl ] | ||
40 | then | ||
41 | curl -u $USER ftp://$HOST/$home.tgz > /$home.tgz | ||
42 | |||
43 | else | ||
44 | echo "Curl is not installed. You will have to login with your" | ||
45 | echo "username and upload $home.tgz manually" | ||
46 | |||
47 | ftp $HOST | ||
48 | |||
49 | fi | ||
50 | fi | ||
51 | |||
52 | cd / | ||
53 | echo | ||
54 | echo "Uncompressing archive..." | ||
55 | gunzip -c $home.tgz | tar xvf - | ||
56 | rm /$home.tgz 2> /dev/null | ||
57 | |||
58 | |||
59 | |||
60 | |||
61 | |||