Changeset 1256 in MondoRescue
- Timestamp:
- Mar 21, 2007, 12:48:32 PM (18 years ago)
- Location:
- branches/stable/mondo
- Files:
-
- 1 added
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/distributions/conf/mondo.conf.dist
r1249 r1256 83 83 84 84 # 85 # deplist file used 85 # deplist file used (either fill path or relative to 86 # mondo's configuration dir 86 87 # 87 mondo_deplist_file=" /etc/mondo/deplist.txt"88 mondo_deplist_file="deplist.txt" 88 89 89 90 # … … 128 129 # Default compression level 129 130 # 130 mondo_compression_level= 5131 mondo_compression_level=6 131 132 132 133 # … … 134 135 # (white space separated list of paths) 135 136 # 136 mondo_exclude_ files=""137 mondo_exclude_paths="" 137 138 138 139 # … … 140 141 # (white space separated list of paths) 141 142 # 142 mondo_include_ files=""143 mondo_include_paths="" 143 144 144 145 # 145 # Activate semi-graphical mode by default (yes|no) 146 # Which mode should be activated by default (cli|newt|x11|web) 147 # TBC 146 148 # 147 mondo_ text_mode=no149 mondo_ui_mode=newt 148 150 149 151 # … … 156 158 # Scratch directory 157 159 # 158 mondo_scratch_dir=" "159 #scratch_dir="/ tmp/mondo/scratch"160 mondo_scratch_dir="/var/spool/mondo" 161 #scratch_dir="/var/cache/mondo/scratch" 160 162 161 163 # 162 # Temporary directory 164 # Temporary directory main path 165 # A subdirectory will be created below to host mondo's temp files 163 166 # 164 mondo_tmp_dir=" "165 #tmp_dir="/ tmp/mondo/tmp"167 mondo_tmp_dir="/tmp" 168 #tmp_dir="/var/cache/mondo/tmp" 166 169 167 170 # -
branches/stable/mondo/src/common/libmondo-archive.c
r1213 r1256 19 19 #include "my-stuff.h" 20 20 #include "mondostructures.h" 21 21 22 #include "mr_conf.h" 22 23 #include "mr_mem.h" … … 3900 3901 char *tmp = NULL; 3901 3902 char *p = NULL; 3902 char *path_min = "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/ sbin:/usr/local/bin";3903 char *path_min = "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"; 3903 3904 3904 3905 mr_setenv("MONDO_SHARE",MONDO_SHARE); 3905 3906 mr_setenv("MONDORESTORECFG",MONDORESTORECFG); 3906 3907 mr_setenv("MONDO_CACHE",MONDO_CACHE); 3908 /* Add the ARCH environment variable for ia64 purposes */ 3909 mr_setenv("ARCH", get_architecture()); 3910 3907 3911 3908 3912 if ((p = getenv("PATH")) == NULL) { -
branches/stable/mondo/src/include/mr_conf.h
r1064 r1256 15 15 #define MR_CONF_H 16 16 17 /* mondoarchive structure storing conf info 18 * each field of the configuration file should have an entry here 19 */ 20 struct mr_ar_conf { 21 /* ISO image CLI command to use */ 22 char *iso_creation_cmd; 23 /* ISO image common creation options */ 24 char *iso_creation_options; 25 /* ISO Burning CLI command to use */ 26 char *iso_burning_cmd; 27 /* ISO Burning CLI command options */ 28 char *iso_burning_options; 29 /* ISO Burning Speed */ 30 int iso_burning_speed; 31 /* Default size of media */ 32 int media_size; 33 /* Default device of media */ 34 char *media_device; 35 /* Is the CD tray manual ? */ 36 bool manual_tray; 37 /* Default log level */ 38 int log_level; 39 /* default prefix for ISO names */ 40 char *prefix; 41 /* External tape blocksize */ 42 int external_tape_blocksize; 43 /* Internal tape blocksize */ 44 int internal_tape_blocksize; 45 /* Size in MB of the slices for biggiefiles */ 46 int slice_size; 47 /* deplist file used */ 48 char *deplist_file; 49 /* Write boot floppies ? */ 50 bool write_boot_floppy; 51 /* Create mindi CD ? */ 52 bool create_mindi_cd; 53 /* Kernel to use */ 54 char *kernel; 55 /* Additional modules to support */ 56 char *additional_modules; 57 /* Boot loader to use */ 58 char *boot_loader; 59 /* Differential backup ? */ 60 bool differential; 61 /* Default compression tool */ 62 char *compression_tool; 63 /* Default compression level */ 64 int compression_level; 65 /* Paths to exclude from backup */ 66 char *exclude_paths; 67 /* Paths to include onto the backup */ 68 char *include_paths; 69 /* Which mode should be activated by default*/ 70 char *ui_mode; 71 /* Activate automatic restore ? */ 72 bool automatic_restore; 73 /* Scratch directory */ 74 char *scratch_dir; 75 /* Temporary directory main path */ 76 char *tmp_dir; 77 /* Images creation dir */ 78 char *images_dir; 79 }; 80 17 81 /* functions (public methods) */ 18 82 … … 27 91 extern double mr_conf_fread(const char *field_name); 28 92 93 /*read boolean after string str in the current file*/ 94 extern bool mr_conf_bread(const char *field_name); 95 29 96 /* 30 97 * read string after string str in the current file. -
branches/stable/mondo/src/lib/mr_conf.c
r1227 r1256 207 207 } 208 208 209 209 210 /* 210 211 reads string outstr after string str in the current file (between … … 256 257 mr_free(q); 257 258 259 return ret; 260 } 261 262 /*read boolean after string str in the current file*/ 263 bool mr_conf_bread(const char *field_name) { 264 char *p = NULL; /*pointer to the field */ 265 bool ret = FALSE; 266 267 p = mr_conf_sread(field_name); 268 if (p != NULL) { 269 /* match if yes/true/1 */ 270 if ((strncasecmp(p, "y" , (size_t)1) == 0) || 271 (strncasecmp(p, "t" , (size_t)1) == 0) || 272 (strncasecmp(p, "1" , (size_t)1) == 0)) { 273 ret = TRUE; 274 } 275 } 258 276 return ret; 259 277 } -
branches/stable/mondo/src/lib/mr_err.c
r1104 r1256 36 36 37 37 mr_cleanup(); 38 fprintf(stderr,"%s\n",message); 38 if (message != NULL) { 39 fprintf(stderr,"%s\n",message); 40 } 39 41 exit(errorcode); 40 42 } -
branches/stable/mondo/src/mondoarchive/Makefile.am
r1187 r1256 4 4 ## Process with Automake to generate Makefile.in 5 5 ## 6 AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include -I${top_builddir}/src/common 6 AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include -I${top_builddir}/src/common -I${top_builddir}/src/mondoarchive 7 7 8 8 ## Headers 9 noinst_HEADERS = mondo-cli-EXT.h mondo-cli.h 9 noinst_HEADERS = mondo-cli-EXT.h mondo-cli.h mondoarchive.h 10 10 11 11 ## The program -
branches/stable/mondo/src/mondoarchive/mondoarchive.c
r1245 r1256 22 22 #include "mondo-cli-EXT.h" 23 23 24 #include "mondoarchive.h" 24 25 #include "mr_mem.h" 25 26 #include "mr_str.h" 26 27 #include "mr_msg.h" 27 28 #include "mr_file.h" 29 #include "mr_conf.h" 28 30 29 31 // for CVS … … 41 43 extern char *g_erase_tmpdir_and_scratchdir; 42 44 extern char *g_cdrw_drive_is_here; 45 extern double g_kernel_version; 46 extern char *g_magicdev_command; 47 extern t_bkptype g_backup_media_type; 48 extern int g_loglevel; 49 43 50 static char *g_cdrom_drive_is_here = NULL; 44 51 static char *g_dvd_drive_is_here = NULL; 45 extern double g_kernel_version; 46 47 /***************** global vars, used only by main.c ******************/ 52 53 struct mr_ar_conf mr_conf; 54 55 /***************** global vars ******************/ 48 56 bool g_skip_floppies; 49 57 long diffs; … … 51 59 char *ps_proc_id = "$2"; 52 60 53 extern t_bkptype g_backup_media_type; 54 extern int g_loglevel; 55 56 /****************** subroutines used only by main.c ******************/ 61 /****************** subroutines used only here ******************/ 57 62 58 63 … … 60 65 * Print a "don't panic" message to the log and a message about the logfile to the screen. 61 66 */ 62 void welcome_to_mondoarchive(void)67 static void welcome_to_mondoarchive(void) 63 68 { 64 mr_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org", 65 PACKAGE_VERSION); 69 mr_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org", PACKAGE_VERSION); 66 70 mr_msg(0, "running on %s architecture", get_architecture()); 67 mr_msg(0, 68 "-----------------------------------------------------------"); 69 mr_msg(0, 70 "NB: Mondo logs almost everything, so don't panic if you see"); 71 mr_msg(0, 72 "some error messages. Please read them carefully before you"); 73 mr_msg(0, 74 "decide to break out in a cold sweat. Despite (or perhaps"); 75 mr_msg(0, 76 "because of) the wealth of messages. some users are inclined"); 77 mr_msg(0, 78 "to stop reading this log. If Mondo stopped for some reason,"); 79 mr_msg(0, 80 "chances are it's detailed here. More than likely there's a"); 81 mr_msg(0, 82 "message at the very end of this log that will tell you what"); 83 mr_msg(0, 84 "is wrong. Please read it! -Devteam"); 85 mr_msg(0, 86 "-----------------------------------------------------------"); 71 mr_msg(0, "-----------------------------------------------------------"); 72 mr_msg(0, "NB: Mondo logs almost everything, so don't panic if you see"); 73 mr_msg(0, "some error messages. Please read them carefully before you"); 74 mr_msg(0, "decide to break out in a cold sweat. Despite (or perhaps"); 75 mr_msg(0, "because of) the wealth of messages. some users are inclined"); 76 mr_msg(0, "to stop reading this log. If Mondo stopped for some reason,"); 77 mr_msg(0, "chances are it's detailed here. More than likely there's a"); 78 mr_msg(0, "message at the very end of this log that will tell you what"); 79 mr_msg(0, "is wrong. Please read it! -Devteam"); 80 mr_msg(0, "-----------------------------------------------------------"); 87 81 88 82 mr_msg(0, "Zero..."); … … 98 92 } 99 93 100 101 extern char *g_magicdev_command;102 103 94 /** 104 95 * Do whatever is necessary to insure a successful backup on the Linux distribution 105 96 * of the day. 106 97 */ 107 void distro_specific_kludges_at_start_of_mondoarchive(void)98 static void distro_specific_kludges_at_start_of_mondoarchive(void) 108 99 { 109 100 mr_msg(2, "Unmounting old ramdisks if necessary"); … … 120 111 * Undo whatever was done by distro_specific_kludges_at_start_of_mondoarchive(). 121 112 */ 122 void distro_specific_kludges_at_end_of_mondoarchive(void)113 static void distro_specific_kludges_at_end_of_mondoarchive(void) 123 114 { 124 115 mr_msg(2, "Restarting magicdev if necessary"); … … 133 124 sync(); 134 125 unmount_boot_if_necessary(); // for Gentoo users 126 } 127 128 /* create the mr_ar_conf structure from mondo's conf file */ 129 static void mr_ar_store_conf(struct mr_ar_conf *mr_conf) { 130 131 mr_asprintf(mr_conf->iso_creation_cmd, mr_conf_sread("mondo_iso_creation_cmd")); 132 mr_asprintf(mr_conf->iso_creation_options, mr_conf_sread("mondo_iso_creation_options")); 133 mr_asprintf(mr_conf->iso_burning_cmd, mr_conf_sread("mondo_iso_burning_cmd")); 134 mr_asprintf(mr_conf->iso_burning_options, mr_conf_sread("mondo_iso_burning_options")); 135 iso_burning_speed = mr_conf_iread("mondo_iso_burning_speed"); 136 media_size = mr_conf_iread("mondo_media_size"); 137 mr_asprintf(mr_conf->media_device, mr_conf_sread("mondo_media_device")); 138 manual_tray = mr_conf_bread("mondo_manual_tray"); 139 log_level = mr_conf_iread("mondo_log_level"); 140 mr_asprintf(mr_conf->prefix, mr_conf_sread("mondo_prefix")); 141 external_tape_blocksize = mr_conf_iread("mondo_external_tape_blocksize"); 142 internal_tape_blocksize = mr_conf_iread("mondo_internal_tape_blocksize"); 143 slice_size = mr_conf_iread("mondo_slice_size"); 144 mr_asprintf(mr_conf->deplist_file, mr_conf_sread("mondo_deplist_file")); 145 write_boot_floppy = mr_conf_bread("mondo_write_boot_floppy"); 146 create_mindi_cd = mr_conf_bread("mondo_create_mindi_cd"); 147 mr_asprintf(mr_conf->kernel, mr_conf_sread("mondo_kernel")); 148 mr_asprintf(mr_conf->additional_modules, mr_conf_sread("mondo_additional_modules")); 149 mr_asprintf(mr_conf->boot_loader, mr_conf_sread("mondo_boot_loader")); 150 differential = mr_conf_bread("mondo_differential"); 151 mr_asprintf(mr_conf->compression_tool, mr_conf_sread("mondo_compression_tool")); 152 compression_level = mr_conf_iread("mondo_compression_level"); 153 mr_asprintf(mr_conf->exclude_paths, mr_conf_sread("mondo_exclude_paths")); 154 mr_asprintf(mr_conf->include_paths, mr_conf_sread("mondo_include_paths")); 155 mr_asprintf(mr_conf->ui_mode, mr_conf_sread("mondo_ui_mode")); 156 automatic_restore = mr_conf_bread("mondo_automatic_restore"); 157 mr_asprintf(mr_conf->scratch_dir, mr_conf_sread("mondo_scratch_dir")); 158 mr_asprintf(mr_conf->tmp_dir, mr_conf_sread("mondo_tmp_dir")); 159 mr_asprintf(mr_conf->images_dir, mr_conf_sread("mondo_images_dir")); 135 160 } 136 161 … … 145 170 int main(int argc, char *argv[]) 146 171 { 147 struct s_bkpinfo *bkpinfo ;172 struct s_bkpinfo *bkpinfo = NULL; 148 173 struct stat stbuf; 149 174 char *tmp = NULL; … … 157 182 (void) textdomain("mondo"); 158 183 #endif 159 /* Make sure I'm root; abort if not */ 184 printf(_("Initializing...")); 185 186 /* initialize log file with time stamp */ 187 /* We start with a loglevel of 4 - Adapted later on */ 188 /* It's mandatory to set this up first as all mr_ functions rely on it */ 189 unlink(MONDO_LOGFILE); 190 mr_msg_init(MONDO_LOGFILE,4); 191 mr_msg(0, _("Time started: %s"), mr_date()); 192 193 /* Make sure I'm root; abort if not */ 160 194 if (getuid() != 0) { 161 fprintf(stderr, _("Please run as root.\n")); 162 exit(127); 195 mr_log_exit(127, _("Please run as root.")); 163 196 } 164 197 … … 168 201 || !strcmp(argv[argc - 1], "--version"))) { 169 202 printf(_("mondoarchive v%s\nSee man page for help\n"), PACKAGE_VERSION); 170 exit(0); 171 } 203 mr_exit(0, NULL); 204 } 205 206 /* Conf file management */ 207 /* Check md5 sum before */ 208 /* Get content */ 209 if (mr_conf_open(MONDO_CONF_DIR"/mondo.conf.dist") != 0) { 210 mr_log_exit(-1, "Unable to open "MONDO_CONF_DIR"/mondo.conf.dist"); 211 } 212 mr_ar_store_conf(&mr_conf); 213 mr_conf_close(); 214 215 /* Add MONDO_SHARE + other environment variables for mindi */ 216 setenv_mondo_var(); 172 217 173 218 /* Initialize variables */ 174 219 malloc_libmondo_global_strings(); 175 176 res = 0;177 retval = 0;178 220 diffs = 0; 179 180 /* initialize log file with time stamp */181 unlink(MONDO_LOGFILE);182 mr_msg_init(MONDO_LOGFILE,4);183 mr_msg(0, _("Initializing...\n"));184 mr_msg(0, _("Time started: %s"), mr_date());185 186 221 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo)); 187 188 /* Add the ARCH environment variable for ia64 purposes */189 setenv("ARCH", get_architecture(), 1);190 191 /* Add MONDO_SHARE + other environment variables for mindi */192 setenv_mondo_var();193 194 222 if (stat(MONDO_CACHE, &stbuf) != 0) { 195 223 mr_mkdir(MONDO_CACHE,0x755);
Note:
See TracChangeset
for help on using the changeset viewer.