summaryrefslogtreecommitdiffstats
path: root/urunlevel/my_linux/Trinux/gethome
diff options
context:
space:
mode:
Diffstat (limited to 'urunlevel/my_linux/Trinux/gethome')
-rwxr-xr-xurunlevel/my_linux/Trinux/gethome61
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
3if [ "$1" ]
4then
5 home=$1
6else
7 home="home"
8fi
9
10homeline=`cat /etc/tux/config/home`
11
12if [ "$homeline" ]
13then
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`
17else
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
25fi
26
27
28echo "Retrieving home directory from $USER@$HOST via $PROTO"
29
30if [ $PROTO = "ssh" ]
31then
32 scp $USER@$HOST:~/$home.tgz /
33fi
34
35if [ $PROTO = "ftp" ]
36then
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
50fi
51
52cd /
53echo
54echo "Uncompressing archive..."
55gunzip -c $home.tgz | tar xvf -
56rm /$home.tgz 2> /dev/null
57
58
59
60
61