summaryrefslogtreecommitdiffstats
path: root/urunlevel/my_linux/Trinux/savehome
diff options
context:
space:
mode:
Diffstat (limited to 'urunlevel/my_linux/Trinux/savehome')
-rwxr-xr-xurunlevel/my_linux/Trinux/savehome79
1 files changed, 79 insertions, 0 deletions
diff --git a/urunlevel/my_linux/Trinux/savehome b/urunlevel/my_linux/Trinux/savehome
new file mode 100755
index 0000000..837c639
--- /dev/null
+++ b/urunlevel/my_linux/Trinux/savehome
@@ -0,0 +1,79 @@
1#!/bin/sh
2
3# savehome - saves home directory to
4
5if [ "$1" ]
6then
7 home=$1
8else
9 home="home"
10fi
11
12
13
14if [ -f /etc/tux/config/home ]
15then
16 PROTO=`cut -d':' -f1 /etc/tux/config/home`
17 HOST=`cut -d':' -f2 /etc/tux/config/home`
18 USER=`cut -d':' -f3 /etc/tux/config/home`
19else
20 echo -n "ftp or ssh: "
21 read PROTO
22 echo -n "Host: "
23 read HOST
24 echo -n "User: "
25 read USER
26 echo $PROTO:$HOST:$USER > /etc/tux/config/home
27fi
28
29[ -d /usr/local/tmp ] || mkdir -p /usr/local/tmp
30
31cd /
32tar cf - home | gzip -f > /usr/local/tmp/$home.tgz
33echo "Saving home directory to $USER@$HOST via $PROTO"
34
35cd /usr/local/tmp
36
37if [ "$PROTO" = "ssh" ]
38then
39 scp $home.tgz $USER@$HOST:~
40fi
41
42if [ "$PROTO" = "ftp" ]
43then
44 echo "Using FTP to transfor $home.tgz -- your passwords are sniffable"
45 if [ -x /usr/bin/curl ]
46 then
47 curl -u $USER -T $home.tgz ftp://$HOST
48
49 else
50 echo "Curl is not installed. You will have to login with your"
51 echo "username and upload $home.tgz manually"
52
53 ftp $HOST
54
55 fi
56fi
57
58if [ "$PROTO" = "fixed" ]
59then
60 if mount -t $PROTO $HOST /mnt
61 then
62 [ "$USER" ] && cd /mnt/$USER
63 cp /usr/local/tmp/$home.tgz .
64 cd /
65 umount /mnt
66 fi
67fi
68
69if [ "$PROTO" = "floppy" ]
70then
71 if mount -t vfat /dev/fd0 /mnt
72 then
73 cp /usr/local/tmp/$home.tgz /mnt
74 cd /
75 umount /mnt
76 else
77 echo "Unable to mount floppy"
78 fi
79fi