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 ..."
31 if [ ! -z "$2" ] ; then
32 if [ "$2" = "-backup_dir" -a -d $3 ] ; then
33 echo "using $3 as a backup directory ..."
38 # set kernel version(s) to store their .config
39 if [ -d /usr/src/linux ] ; then
40 kernel_num=`ls /usr/src/ | grep '^linux-' | sed 's/linux-//g'`
44 # which method to use?
45 if [ "$1" = "tar" ] ; then
47 elif [ "$1" = "dir" ] ; then
49 elif [ -z "$1" ] ; then
53 echo "usage: $0 [tar|dir] (-backup_dir /foo/bar)"
55 echo "tar: creates an archive called backup_${backup_date}.tar.bz2"
56 echo "dir: creates just the directory backup_${backup_date}"
62 if [ -d ${backup_dir}/${host}-backup-${backup_date} ] ; then
63 echo "u already did a backup today! remove it manually first!"
67 mkdir $backup_dir/${host}-backup-${backup_date} && cd ${backup_dir}/${host}-backup-${backup_date}
72 mkdir ./${host}-conf && cd ./${host}-conf
74 for i in $kernel_num; do
75 if [ -f /usr/src/linux-${i}*/.config ] ; then
76 echo "copying /usr/src/linux/.config"
77 cp /usr/src/linux-${i}*/.config ./$host-kernel-${i}-config
82 for i in conf opt ppp; do
83 if [ -d /etc/$i ] ; then
84 echo "copying /etc/$i"
90 for i in `ls -A /etc/conf`; do
91 if [ -f /etc/init.d/$i ] ; then
92 echo "copying /etc/init.d/$i"
93 cp /etc/init.d/$i ./etc/init.d
97 for i in dhcpd.conf fstab hosts host.conf hosts.allow hosts.deny lilo.conf \
98 profile sendmail.cf resolv.conf exports fb.modes inetd.conf \
100 if [ -f /etc/$i ] ; then
101 echo "copying /etc/$i"
106 if [ -f /etc/X11/XF86Config ] ; then
108 echo "copying /etc/X11/XF86Config*"
109 cp /etc/X11/XF86Config* ./etc/X11
113 # specific config stuff
115 # gate specific config stuff!
116 if [ "$host" = "gate" ] ; then
119 if [ -d /etc/mail ] ; then
120 echo "copying /etc/mail directory"
121 cp -r /etc/mail ./etc
125 mkdir -p ./irc/networks
126 [ -f /opt/unreal/etc/unrealircd.conf ] && \
127 cp /opt/unreal/etc/unrealircd.conf ./irc/unrealircd_new.conf
128 for i in ircd.conf networks/hackdaworld.network \
129 networks/unrealircd.conf; do
130 [ -f /home/irc/Unreal3.1.1/$i ] && \
131 cp /home/irc/Unreal3.1.1/$i ./irc/$i
133 [ -f /home/irc/services_new/services.conf ] && \
134 cp /home/irc/services_new/services.conf ./irc
135 for i in rebecka defcon_one elin; do
136 [ -f /home/irc/eggdrop/$i ] && cp /home/irc/eggdrop/$i* ./irc
144 # data backup (specific)
145 cd ${backup_dir}/${host}-backup-${backup_date}
148 if [ "$host" = "gate" ] ; then
150 # minimalist and mail stuff
151 mkdir -p minimalist_spool mail_admin mail_hackbard mail_mlist
152 echo "copying minimalist and mail stuff"
153 cp -r /opt/minimalist/spool/* ./minimalist_spool
154 cp -r /home/hackbard/* ./mail_hackbard
155 cp -r /home/admin/* ./mail_admin
156 cp /var/mail/mlist ./mail_mlist
161 echo "copying /chroot/$i"
162 tar -cf ./chroot/$i.tar /chroot/$i
164 tar -cf ./mlist-archive.tar /home/mlist/public_html
168 # hackstation specific data
169 if [ "$host" = "hackstation" -o "$host" = "mobile" -o "$host" = "hdw" -o "$host" = "sparc" ] ; then
172 mkdir -p ./home/hackbard
174 for i in projects software store; do
175 [ -d /home/hackbard/$i ] && \
176 cp -r /home/hackbard/$i ./home/hackbard
178 for i in xinitrc_evil xinitrc_wm .xinitrc GNUstep .Xauthority \
179 .Xdefaults .signature .directfbrc; do
180 [ -f /home/hackbard/$i ] && \
181 cp -r /home/hackbard/$i ./home/hackbard
183 cp -r /home/hackbard/.ssh ./home/hackbard
188 # data stuff (none specific)
190 # extensions, stored on root
191 if [ -d /root/${host}_exts ] ; then
192 echo "copying ${host}_exts"
193 cp -r /root/${host}_exts ./
197 if [ -d /root/${host}_bunker ] ; then
198 echo "copying ${host}_bunker"
199 cp -r /root/${host}_bunker ./
203 cp -r $HOME/scripts ./
206 # finished copying stuff, entering last backup procedure now :)))
210 if [ "$method" = "tar" ] ; then
212 tar cf ./${host}-backup-${backup_date}.tar \
213 ./${host}-backup-${backup_date}
214 rm -r ./${host}-backup-${backup_date}
215 bzip2 ./${host}-backup-${backup_date}.tar
219 # end! umounting nfs shared backup directory
220 if [ "$host" != "hackstation" ] ; then
221 echo "umounting nfs backup - dir"
222 #cd $HOME && umount /mnt/nfs