4 # Name : snarf_linux_config
5 # Author : Chris Koeritz
6 # Rights : Copyright (C) 1996-$now by Author
8 # Backs up the useful linux config files and names the file after the
11 # This program is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by the Free
13 # Software Foundation; either version 2 of the License or (at your option)
14 # any later version. See: "http://www.gruntose.com/Info/GNU/GPL.html" for a
15 # version of the License. Please send any updates to "fred@gruntose.com".
18 require "shared_snarfer.pl";
24 # get the number we use and increment it for the next use.
25 local($number) = &retrieve_number("aa_backup");
27 # variables used throughout.
28 local($snarf_file_base) = snarf_prefix("config-linux");
29 local($snarf_file) = &snarf_name($snarf_file_base, $number);
31 # store the current archive number in the file for retrieval on the
33 &backup_number("aa_backup", $snarf_file_base, $number);
35 # write a little file showing the disk status.
36 local($infofile) = $HOME . "/disk_info.txt";
38 open(INF, ">>" . $infofile);
39 print INF "Current mount configuration:\n";
42 system("mount >>$infofile");
43 open(INF, ">>" . $infofile);
46 print INF "Current disk configuration:\n";
49 system("fdisk -l >>$HOME/disk_info.txt");
50 &backup_files($snarf_file_base, $number, $HOME, ".", ("disk_info.txt"));
53 # backup the dpkg info.
54 &backup_files($snarf_file_base, $number, "/", "var/lib/dpkg", ("status*"));
56 # backup the crucial hierarchies in /var...
57 &backup_hierarchy($snarf_file_base, $number, "/", "var/named");
58 ###not good: &backup_hierarchy($snarf_file_base, $number, "/", "var/lib/mysql");
59 ###the mysql snarf is not necessarily usable, since we really should be
60 ###backing up the databases by another means than this.
61 &backup_hierarchy($snarf_file_base, $number, "/", "var/lib/named/master");
62 &backup_hierarchy($snarf_file_base, $number, "/", "var/lib/webalizer");
64 # snag the grub bootloader files.
65 &backup_hierarchy($snarf_file_base, $number, "/", "boot/grub");
67 # now get the entire /etc hierarchy...
68 &backup_hierarchy($snarf_file_base, $number, "/", "etc");
70 # clean out extra files.
71 &remove_from_backup($snarf_file_base, $number, "etc/cups/ppds.dat*");
72 &remove_from_backup($snarf_file_base, $number, "etc/httpd/conf/ssl.crt/ca-bundle.crt");
73 &remove_from_backup($snarf_file_base, $number, "etc/locale/*");
74 &remove_from_backup($snarf_file_base, $number, "etc/opt/kde3/share/services/ksycoca");
75 &remove_from_backup($snarf_file_base, $number, "etc/preload.d/*");
76 &remove_from_backup($snarf_file_base, $number, "etc/rmt");
77 &remove_from_backup($snarf_file_base, $number, "etc/termcap");
78 &remove_from_backup($snarf_file_base, $number, "etc/X11/X");
79 &remove_from_backup($snarf_file_base, $number, "etc/X11/xkb/*");
80 &remove_from_backup($snarf_file_base, $number, "*.bak");
81 &remove_from_backup($snarf_file_base, $number, "*.cache");
82 &remove_from_backup($snarf_file_base, $number, "*.crt");
83 &remove_from_backup($snarf_file_base, $number, "*.old");
84 &remove_from_backup($snarf_file_base, $number, "*.schemas");
85 &remove_from_backup($snarf_file_base, $number, "*.so");
86 &remove_from_backup($snarf_file_base, $number, "*.xml");
88 # now rename the file so only the unpacker can access it.
89 &rename_archive($snarf_file);