Changeset 1688 in MondoRescue for branches/2.2.5
- Timestamp:
- Oct 20, 2007, 8:07:36 PM (16 years ago)
- Location:
- branches/2.2.5
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.5/mindi/mindi
r1684 r1688 1735 1735 echo -en "." 1736 1736 echo "Creating a vfat filesystem on $USBPART" >> $LOGFILE 1737 mk fs -t vfat$USBPART 2>&1 >> $LOGFILE1737 mkdosfs -F 32 $USBPART 2>&1 >> $LOGFILE 1738 1738 if [ $? -ne 0 ]; then 1739 1739 echo "Unable to create a vfat filesystem on $USBPART" | tee -a $LOGFILE -
branches/2.2.5/mondo/src/common/libmondo-archive.c
r1687 r1688 1844 1844 } 1845 1845 1846 1847 1848 1849 /** 1850 * Create a USB image in @c destfile, from files in @c bkpinfo->scratchdir. 1851 * 1852 * @param bkpinfo The backup information structure. Fields used: 1853 * - @c backup_media_type 1854 * - @c nonbootable_backup 1855 * - @c scratchdir 1856 * 1857 * @param destfile Where to put the generated USB image. 1858 * @return The number of errors encountered (0 for success) 1859 */ 1860 int make_usb_fs(char *destfile) 1861 { 1862 /*@ int ********************************************** */ 1863 int retval = 0; 1864 int res; 1865 1866 /*@ buffers ****************************************** */ 1867 char *tmp = NULL; 1868 char *tmp1 = NULL; 1869 char *message_to_screen = NULL; 1870 char *old_pwd; 1871 1872 malloc_string(old_pwd); 1873 assert(bkpinfo != NULL); 1874 assert_string_is_neither_NULL_nor_zerolength(destfile); 1875 1876 log_msg(2, "make_usb_fs --- scratchdir=%s --- destfile=%s", 1877 bkpinfo->scratchdir, destfile); 1878 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1879 asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir); 1880 run_program_and_log_output(tmp, FALSE); 1881 paranoid_free(tmp); 1882 chdir(bkpinfo->scratchdir); 1883 1884 asprintf(&message_to_screen, "Copying data to make %s #%d", 1885 media_descriptor_string(bkpinfo->backup_media_type), 1886 g_current_media_number); 1887 log_msg(1, message_to_screen); 1888 1889 if (is_this_device_mounted(bkpinfo->media_device)) { 1890 log_msg(1, "USB device mounted. Remounting it at the right place"); 1891 asprintf(&tmp, "umount %s", bkpinfo->media_device); 1892 run_program_and_log_output(tmp, FALSE); 1893 paranoid_free(tmp); 1894 } 1895 log_msg(1, "Mounting USB device."); 1896 asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir); 1897 asprintf(&tmp, "mkdir -p %s", tmp1); 1898 run_program_and_log_output(tmp, FALSE); 1899 paranoid_free(tmp); 1900 asprintf(&tmp, "mount %s %s", bkpinfo->media_device, tmp1); 1901 run_program_and_log_output(tmp, FALSE); 1902 paranoid_free(tmp); 1903 paranoid_free(tmp1); 1904 1905 if (bkpinfo->nonbootable_backup) { 1906 log_msg(1, "Making nonbootable USB backup not implemented yet"); 1907 } else { 1908 log_msg(1, "Making bootable backup"); 1909 1910 asprintf(&tmp,"cp -rp %s/* %s", bkpinfo->scratchdir, ); /* Command to execute */ 1911 res = eval_call_to_make_USB(tmp, message_to_screen); 1912 if (res) { 1913 asprintf(&result_sz, "%s ...failed",tmp); 1914 } else { 1915 asprintf(&result_sz, "%s ...OK",tmp); 1916 } 1917 log_to_screen(result_sz); 1918 paranoid_free(result_sz); 1919 paranoid_free(tmp); 1920 retval += res; 1921 } 1922 paranoid_free(message_to_screen); 1923 1924 if (is_this_device_mounted(bkpinfo->media_device)) { 1925 asprintf(&tmp, "umount %s", bkpinfo->media_device); 1926 run_program_and_log_output(tmp, FALSE); 1927 paranoid_free(tmp); 1928 } 1929 1930 chdir(old_pwd); 1931 if (retval) { 1932 log_msg(1, "WARNING - make_usb_fs returned an error"); 1933 } 1934 paranoid_free(old_pwd); 1935 return (retval); 1936 } 1846 1937 1847 1938 … … 3843 3934 g_current_media_number); 3844 3935 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3845 res = make_iso_fs(isofile); 3936 if (bkpinfo->backup_media_type != usb) { 3937 res = make_iso_fs(isofile); 3938 } else { 3939 res = make_usb_fs(isofile); 3940 } 3846 3941 if (g_current_media_number == 1 && !res 3847 3942 && (bkpinfo->backup_media_type == cdr -
branches/2.2.5/mondo/src/common/libmondo-fork.c
r1645 r1688 299 299 300 300 301 /** 302 * Call copy of data to create an USB image. 303 * @param bkpinfo The backup information structure. Fields used: 304 * - @c bkpinfo->backup_media_type 305 * @return Exit code of @c copy (0 is success, anything else indicates failure). 306 */ 307 int 308 eval_call_to_make_USB(char *command, char *what_i_am_doing) { 309 310 /*@ int's *** */ 311 int retval = 0; 312 313 314 /*@*********** End Variables ***************************************/ 315 316 log_msg(3, "Starting"); 317 assert(bkpinfo != NULL); 318 319 log_to_screen 320 ("Please be patient. Do not be alarmed by on-screen inactivity."); 321 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'", 322 what_i_am_doing); 323 324 if (!g_text_mode) { 325 newtSuspend(); 326 } 327 log_msg(1, "command = '%s'", command); 328 if (!g_text_mode) { 329 retval = run_external_binary_with_percentage_indicator_NEW 330 (what_i_am_doing, command); 331 } else { 332 retval += system(command); 333 } 334 if (!g_text_mode) { 335 newtResume(); 336 } 337 338 return (retval); 339 } 340 341 301 342 302 343 -
branches/2.2.5/mondo/src/common/my-stuff.h
r1666 r1688 463 463 #define VANILLA_SCSI_CDROM "/dev/cd0" 464 464 #define VANILLA_SCSI_TAPE "/dev/sa0" 465 #define VANILLA_USB_DEVICE "tobegivenbybsdguru" 465 466 #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/vinum/" 466 467 #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE … … 472 473 #define VANILLA_SCSI_CDROM "/dev/scd0" 473 474 #define VANILLA_SCSI_TAPE "/dev/st0" 475 #define VANILLA_USB_DEVICE "/dev/hda" 474 476 #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/md" 475 477 #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
Note:
See TracChangeset
for help on using the changeset viewer.