4 # initializing some variables
5 backup_date=`date | awk '{ print $3"."$2"."$6 }'`
9 # set the backup directory
10 if [ "$host" = "gate" ] ; then
11 #mount -tnfs hackstation:/mnt/lfs/backup /mnt/nfs
13 elif [ "$host" = "sparc" ] ; then
14 #mount -tnfs hackstation:/mnt/lfs/backup /mnt/nfs
16 elif [ "$host" = "mobile" ] ; then
17 #mount -tnfs hackstation:/mnt/lfs/backup /mnt/nfs
19 elif [ "$host" = "right-hand" ] ; then
20 #mount -tnfs hackstation:/mnt/lfs/backup /mnt/nfs
22 elif [ "$host" = "hackstation" ] ; then
23 backup_dir="/mnt/lfs/backup"
24 elif [ "$host" = "hdw" ] ; then
26 elif [ "$host" = "left-hand" ] ; then
29 echo "pls adept the script for $host ..."
33 if [ ! -z "$2" ] ; then
34 if [ "$2" = "-backup_dir" -a -d $3 ] ; then
35 echo "using $3 as a backup directory ..."
40 # set kernel version(s) to store their .config
41 if [ -d /usr/src/linux ] ; then
42 kernel_num=`ls /usr/src/ | grep '^linux-' | sed 's/linux-//g'`
46 # which method to use?
47 if [ "$1" = "tar" ] ; then
49 elif [ "$1" = "dir" ] ; then
51 elif [ -z "$1" ] ; then
55 echo "usage: $0 [tar|dir] (-backup_dir /foo/bar)"
57 echo "tar: creates an archive called backup_${backup_date}.tar.bz2"
58 echo "dir: creates just the directory backup_${backup_date}"
64 if [ -d ${backup_dir}/${host}-backup-${backup_date} ] ; then
65 echo "u already did a backup today! remove it manually first!"
69 mkdir $backup_dir/${host}-backup-${backup_date} && cd ${backup_dir}/${host}-backup-${backup_date}
74 mkdir ./${host}-conf && cd ./${host}-conf
76 for i in $kernel_num; do
77 if [ -f /usr/src/linux-${i}*/.config ] ; then
78 echo "copying /usr/src/linux/.config"
79 cp /usr/src/linux-${i}*/.config ./$host-kernel-${i}-config
84 for i in init.d conf opt ppp cups; do
85 if [ -d /etc/$i ] ; then
86 echo "copying /etc/$i"
91 for i in dhcpd.conf fstab hosts host.conf hosts.allow hosts.deny lilo.conf \
92 profile sendmail.cf resolv.conf exports fb.modes inetd.conf \
93 xinetd.conf mp3user mp3db.conf; do
94 if [ -f /etc/$i ] ; then
95 echo "copying /etc/$i"
100 if [ -f /etc/X11/XF86Config ] ; then
102 echo "copying /etc/X11/XF86Config*"
103 cp /etc/X11/XF86Config* ./etc/X11
107 # specific config stuff
109 # gate specific config stuff!
110 if [ "$host" = "gate" ] ; then
113 if [ -d /etc/mail ] ; then
114 echo "copying /etc/mail directory"
115 cp -r /etc/mail ./etc
120 [ -f /etc/opt/unrealircd/unrealircd.conf ] && \
121 cp /etc/opt/unrealircd/unrealircd.conf ./irc
127 # data backup (specific)
128 cd ${backup_dir}/${host}-backup-${backup_date}
131 if [ "$host" = "gate" ] ; then
134 for i in `ls -A /var/mail`; do
136 echo "copying mail stuff"
137 cp /var/mail/$i ./mail_$i
140 echo "copying /chroot/$i"
141 tar -cf ./chroot/$i.tar /chroot/$i
143 tar -cf ./mlist-archive.tar /home/mlist/public_html
148 if [ "$host" = "right-hand" ] ; then
150 for i in www cvs hdw; do
151 if [ -d /chroot/$i ] ; then
152 echo "copying /chroot/$i"
153 tar .cf ./chroot/$i.tar /chroot/$i
160 # hackstation / mobile / hdw / sparc specific data
161 if [ "$host" = "hackstation" -o "$host" = "mobile" -o "$host" = "hdw" -o "$host" = "sparc" -o "$host" = "left-hand" ] ; then
164 mkdir -p ./home/hackbard
166 for i in software store; do
167 [ -d /home/hackbard/$i ] && \
168 cp -r /home/hackbard/$i ./home/hackbard
170 if [ "$host" = "hackstation" ]; then
171 [ -d /home/hackbard/projects ] && \
172 cp -r /home/hackbard/projects ./home/hackbard
174 for i in xinitrc_evil xinitrc_wm .xinitrc GNUstep .Xauthority \
175 .Xdefaults .signature .directfbrc; do
176 [ -f /home/hackbard/$i ] && \
177 cp -r /home/hackbard/$i ./home/hackbard
179 [ -d /home/hackbard/.ssh ] && cp -r /home/hackbard/.ssh ./home/hackbard
182 if [ -d /tftpboot ] ; then
184 echo "copyinf tftpboot stuff"
185 cp -r /tftpboot/* ./tftpboot
189 for i in prism lucent; do
190 if [ -f /root/hunz_${i}.sh ]; then
192 cp /root/hunz_${i}.sh ./root
199 # data stuff (none specific)
202 cp -r $HOME/scripts ./
205 # finished copying stuff, entering last backup procedure now :)))
209 if [ "$method" = "tar" ] ; then
211 tar cf ./${host}-backup-${backup_date}.tar \
212 ./${host}-backup-${backup_date}
213 rm -r ./${host}-backup-${backup_date}
214 bzip2 ./${host}-backup-${backup_date}.tar
218 # end! umounting nfs shared backup directory
219 if [ "$host" != "hackstation" ] ; then
220 echo "umounting nfs backup - dir"
221 #cd $HOME && umount /mnt/nfs