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
27 echo "pls adept the script for $host ..."
32 # set kernel version(s) to store their .config
33 if [ -d /usr/src/linux ] ; then
34 kernel_num=`ls /usr/src/ | grep 'linux-' | awk -F- '{ print $2 }'`
38 # which method to use?
39 if [ "$1" = "tar" ] ; then
41 elif [ "$1" = "dir" ] ; then
43 elif [ -z "$1" ] ; then
47 echo "usage: $0 [tar|dir]"
49 echo "tar\t: creates an archive called backup_${backup_date}.tar.bz2"
50 echo "dir\t: creates just the directory backup_${backup_date}"
56 if [ -d ${backup_dir}/${host}-backup-${backup_date} ] ; then
57 echo "u already did a backup today! remove it manually first!"
61 mkdir $backup_dir/${host}-backup-${backup_date} && cd ${backup_dir}/${host}-backup-${backup_date}
66 mkdir ./${host}-conf && cd ./${host}-conf
68 for i in $kernel_num; do
69 if [ -f /usr/src/linux-${i}*/.config ] ; then
70 echo "copying /usr/src/linux/.config"
71 cp /usr/src/linux-${i}*/.config ./$host-kernel-${i}-config
76 for i in conf opt ppp; do
77 if [ -d /etc/$i ] ; then
78 echo "copying /etc/$i"
84 for i in `ls -A /etc/conf`; do
85 if [ -f /etc/init.d/$i ] ; then
86 echo "copying /etc/init.d/$i"
87 cp /etc/init.d/$i ./etc/init.d
91 for i in dhcpd.conf fstab hosts host.conf hosts.allow hosts.deny lilo.conf \
92 profile sendmail.cf resolv.conf exports; do
93 if [ -f /etc/$i ] ; then
94 echo "copying /etc/$i"
99 if [ -f /etc/X11/XF86Config ] ; then
101 echo "copying /etc/X11/XF86Config*"
102 cp /etc/X11/XF86Config* ./etc/X11
106 # specific config stuff
108 # gate specific config stuff!
109 if [ "$host" = "gate" ] ; then
112 if [ -d /etc/mail ] ; then
113 echo "copying /etc/mail directory"
114 cp -r /etc/mail ./etc
118 mkdir -p ./irc/networks
119 [ -f /opt/unreal/etc/unrealircd.conf ] && \
120 cp /opt/unreal/etc/unrealircd.conf ./irc/unrealircd_new.conf
121 for i in ircd.conf networks/hackdaworld.network \
122 networks/unrealircd.conf; do
123 [ -f /home/irc/Unreal3.1.1/$i ] && \
124 cp /home/irc/Unreal3.1.1/$i ./irc/$i
126 [ -f /home/irc/services_new/services.conf ] && \
127 cp /home/irc/services_new/services.conf ./irc
128 for i in rebecka defcon_one elin; do
129 [ -f /home/irc/eggdrop/$i ] && cp /home/irc/eggdrop/$i* ./irc
137 # data backup (specific)
138 cd ${backup_dir}/${host}-backup-${backup_date}
141 if [ "$host" = "gate" ] ; then
143 # minimalist and mail stuff
144 mkdir -p minimalist_spool mail_admin mail_hackbard
145 echo "copying minimalist and mail stuff"
146 cp -r /opt/minimalist/spool/* ./minimalist_spool
147 cp -r /home/hackbard/* ./mail_hackbard
148 cp -r /home/admin/* ./mail_admin
153 echo "copying /chroot/$i"
154 tar -cf ./chroot/$i.tar /chroot/$i
159 # hackstation specific data
160 if [ "$host" = "hackstation" -o "$host" = "mobile" -o "$host" = "hdw" ] ; then
163 mkdir -p ./home/hackbard
165 for i in projects software store; do
166 [ -d /home/hackbard/$i ] && \
167 cp -r /home/hackbard/$i ./home/hackbard
169 for i in xinitrc_evil xinitrc_wm .xinitrc GNUstep .Xauthority \
170 .Xdefaults .signature; do
171 [ -f /home/hackbard/$i ] && \
172 cp -r /home/hackbard/$i ./home/hackbard
178 # data stuff (none specific)
180 # extensions, stored on root
181 if [ -d /root/${host}_exts ] ; then
182 echo "copying ${host}_exts"
183 cp -r /root/${host}_exts ./
187 if [ -d /root/${host}_bunker ] ; then
188 echo "copying ${host}_bunker"
189 cp -r /root/${host}_bunker ./
193 cp -r $HOME/scripts ./
196 # finished copying stuff, entering last backup procedure now :)))
200 if [ "$method" = "tar" ] ; then
202 tar cf ./${host}-backup-${backup_date}.tar \
203 ./${host}-backup-${backup_date}
204 rm -r ./${host}-backup-${backup_date}
205 bzip2 ./${host}-backup-${backup_date}.tar
209 # end! umounting nfs shared backup directory
210 if [ "$host" != "hackstation" ] ; then
211 echo "umounting nfs backup - dir"
212 #cd $HOME && umount /mnt/nfs