Changeset 2382 in MondoRescue for branches/2.2.10/mondo/src
- Timestamp:
- Sep 10, 2009, 2:07:16 AM (15 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2376 r2382 759 759 mr_asprintf(value, "iso"); 760 760 break; 761 case n fs:762 mr_asprintf(value, "n fs");761 case netfs: 762 mr_asprintf(value, "netfs"); 763 763 break; 764 764 case dvd: … … 824 824 } 825 825 826 estimated_total_noof_slices = 827 size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 828 /* BERLIOS: add n fs stuff here? */826 estimated_total_noof_slices = size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 827 828 /* BERLIOS: add netfs stuff here? */ 829 829 mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir); 830 830 if (system(command)) { … … 1218 1218 1219 1219 if ((bkpinfo->isodir != NULL) && (bkpinfo->prefix != NULL)) { 1220 if (bkpinfo->n fs_remote_dir) {1220 if (bkpinfo->netfs_remote_dir) { 1221 1221 // NFS 1222 mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->n fs_remote_dir, bkpinfo->prefix);1222 mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix); 1223 1223 } else { 1224 1224 // ISO … … 3131 3131 * - @c manual_cd_tray 3132 3132 * - @c media_size 3133 * - @c n fs_mount3134 * - @c n fs_remote_dir3133 * - @c netfs_mount 3134 * - @c netfs_remote_dir 3135 3135 * - @c scratchdir 3136 3136 * - @c verify_data … … 3203 3203 log_to_screen("Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir), (long) bkpinfo->media_size[g_current_media_number]); 3204 3204 } 3205 if (((bkpinfo->isodir == NULL) && (bkpinfo->n fs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {3205 if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) { 3206 3206 fatal_error("Something wrong in your environement. Report to dev team"); 3207 3207 } 3208 if (bkpinfo->n fs_remote_dir) {3209 // N FS3210 mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->n fs_remote_dir, bkpinfo->prefix, g_current_media_number);3208 if (bkpinfo->netfs_remote_dir) { 3209 // Network 3210 mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number); 3211 3211 } else { 3212 3212 // ISO 3213 3213 mr_asprintf(isofile, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number); 3214 3214 } 3215 3215 3216 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3216 3217 if (bkpinfo->backup_media_type != usb) { -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2338 r2382 55 55 static void free_mounted_fs_list (void); 56 56 static int get_dsf_mount_list (const char *dsf, char **included_dsf_list, char **excluded_dsf_list); 57 static int create_list_of_non_N FS_mounted_file_systems (void);57 static int create_list_of_non_NETFS_mounted_file_systems (void); 58 58 static MOUNTED_FS_STRUCT *find_mount_point_in_list (const char *mount_point); 59 59 static MOUNTED_FS_STRUCT *find_device_in_list (const char *device); … … 162 162 /** 163 163 * Frees the memory for all of the structures on the linked list of 164 * all of the non-N FS mounted file systems.164 * all of the non-NETFS mounted file systems. 165 165 */ 166 166 static void free_mounted_fs_list (void) { … … 179 179 180 180 /** 181 * Creates a singly linked list of all of the non-N FS mounted file systems.181 * Creates a singly linked list of all of the non-NETFS mounted file systems. 182 182 * @param DSFptr A pointer to the structure MOUNTED_FS_STRUCT used to hold 183 183 * the list of mounted file systems. … … 197 197 198 198 /** 199 * Find the structure, in the singly linked list of all of the non-N FS199 * Find the structure, in the singly linked list of all of the non-NETFS 200 200 * mounted file systems, that contains the specified device. 201 201 * @param device The device to find … … 218 218 219 219 /** 220 * Find the structure, in the singly linked list of all of the non-N FS220 * Find the structure, in the singly linked list of all of the non-NETFS 221 221 * mounted file systems, that contains the specified mount point. 222 222 * @param mount_point The mount point to find … … 239 239 240 240 /** 241 * Creates a linked list of all of the non-N FS mounted file systems.241 * Creates a linked list of all of the non-NETFS mounted file systems. 242 242 * We use a linked list because we don't know how many mounted file 243 243 * there are (and there can be a lot). 244 244 * @return 0 on success and greated than 0 on failure. 245 245 */ 246 static int create_list_of_non_N FS_mounted_file_systems (void)246 static int create_list_of_non_NETFS_mounted_file_systems (void) 247 247 { 248 248 int i = 0; … … 372 372 373 373 /* Get a list of the mounted file systems */ 374 if (create_list_of_non_N FS_mounted_file_systems()) {374 if (create_list_of_non_NETFS_mounted_file_systems()) { 375 375 log_to_screen ("Could not get the list of mounted file systems"); 376 376 return (1); … … 967 967 968 968 if (flag_set['n']) { 969 mr_free(bkpinfo->n fs_mount);970 mr_asprintf(bkpinfo->n fs_mount, "%s", flag_val['n']);969 mr_free(bkpinfo->netfs_mount); 970 mr_asprintf(bkpinfo->netfs_mount, "%s", flag_val['n']); 971 971 if (!flag_set['d']) { 972 mr_free(bkpinfo->nfs_remote_dir); 973 mr_asprintf(bkpinfo->nfs_remote_dir, "/"); 974 } 975 /* test if we specified a user for the NFS dialog */ 976 p = strchr(bkpinfo->nfs_mount, '@'); 972 mr_free(bkpinfo->netfs_remote_dir); 973 mr_asprintf(bkpinfo->netfs_remote_dir, "/"); 974 } 975 /* test for protocol */ 976 p = strchr(bkpinfo->netfs_mount, ':'); 977 if (p == NULL) { 978 /* protocol not found abort */ 979 fatal_error("No protocol specified for remote share mount. Please do man mondoarchive as syntax changed"); 980 } else { 981 /* Proto found. Store the 2 values */ 982 bkpinfo->netfs_proto = bkpinfo->netfs_mount; 983 p++; 984 if (*p != '/') { 985 fatal_error("No protocol correctly specified for remote share mount. Use protocol://server:share"); 986 } 987 p++; 988 if (*p != '/') { 989 fatal_error("No protocol correctly specified for remote share mount. Use protocol://server:share"); 990 } 991 bkpinfo->netfs_mount = p; 992 /* new netfs mount - remove :// from proto */ 993 p--; 994 p--; 995 p--; 996 *p = '\0'; 997 } 998 /* test if we specified a user */ 999 p = strchr(bkpinfo->netfs_mount, '@'); 977 1000 if (p != NULL) { 978 1001 /* User found. Store the 2 values */ 979 bkpinfo->n fs_user = bkpinfo->nfs_mount;1002 bkpinfo->netfs_user = bkpinfo->netfs_mount; 980 1003 p++; 981 /* new NFSmount */982 bkpinfo->n fs_mount = p;1004 /* new netfs mount */ 1005 bkpinfo->netfs_mount = p; 983 1006 p--; 984 1007 *p = '\0'; 985 1008 } 986 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->n fs_mount);1009 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount); 987 1010 mr_free(bkpinfo->isodir); 988 1011 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1)); … … 990 1013 991 1014 if (strlen(bkpinfo->isodir) < 3) { 992 log_to_screen("NFS share is not mounted. Trying to mount it for you.\n"); 993 mr_asprintf(tmp1, "mount %s", bkpinfo->nfs_mount); 1015 log_to_screen("Network share is not mounted. Trying to mount it for you.\n"); 1016 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 1017 mr_asprintf(tmp1, "sshfs %s", bkpinfo->netfs_mount); 1018 } else { 1019 mr_asprintf(tmp1, "mount %s", bkpinfo->netfs_mount); 1020 } 994 1021 i = system(tmp1); 995 1022 mr_free(tmp1); 996 1023 if (i) { 997 log_to_screen("Unable to mount N FS share %s. Please mount manually.\n", bkpinfo->nfs_mount);1024 log_to_screen("Unable to mount Network share %s. Please mount manually.\n", bkpinfo->netfs_mount); 998 1025 retval++; 999 1026 } else { 1000 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->n fs_mount);1027 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount); 1001 1028 mr_free(bkpinfo->isodir); 1002 1029 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1)); … … 1005 1032 if (strlen(bkpinfo->isodir) < 3) { 1006 1033 retval++; 1007 log_to_screen("N FS share %s is strangely not mounted. Please mount manually...\n", bkpinfo->nfs_mount);1034 log_to_screen("Network share %s is strangely not mounted. Please mount manually...\n", bkpinfo->netfs_mount); 1008 1035 } 1009 1036 } 1010 1037 } 1011 log_msg(3, "mount = %s", bkpinfo->n fs_mount);1038 log_msg(3, "mount = %s", bkpinfo->netfs_mount); 1012 1039 log_msg(3, "isodir= %s", bkpinfo->isodir); 1013 1040 } … … 1023 1050 } 1024 1051 if (flag_set['n']) { 1025 bkpinfo->backup_media_type = n fs;1026 /* Never try to eject a N FSdevice */1052 bkpinfo->backup_media_type = netfs; 1053 /* Never try to eject a Network device */ 1027 1054 bkpinfo->please_dont_eject = TRUE; 1028 1055 } … … 1134 1161 } 1135 1162 1136 if ((flag_set['N']) && (! bkpinfo->restore_data)) // exclude N FSmounts & devices1163 if ((flag_set['N']) && (! bkpinfo->restore_data)) // exclude Network mounts & devices 1137 1164 { 1138 mr_asprintf(psz, "%s", list_of_N FS_mounts_only());1165 mr_asprintf(psz, "%s", list_of_NETFS_mounts_only()); 1139 1166 mr_strcat(bkpinfo->exclude_paths, " %s ", psz); 1140 1167 mr_free(psz); … … 1201 1228 } 1202 1229 1203 if (flag_set['d']) { /* backup directory (if ISO/N FS) */1230 if (flag_set['d']) { /* backup directory (if ISO/NETFS) */ 1204 1231 if (flag_set['i']) { 1205 1232 mr_free(bkpinfo->isodir); … … 1212 1239 mr_free(tmp1); 1213 1240 } else if (flag_set['n']) { 1214 mr_free(bkpinfo->n fs_remote_dir);1215 mr_asprintf(bkpinfo->n fs_remote_dir, "%s", flag_val['d']);1241 mr_free(bkpinfo->netfs_remote_dir); 1242 mr_asprintf(bkpinfo->netfs_remote_dir, "%s", flag_val['d']); 1216 1243 } else { /* backup device (if tape/CD-R/CD-RW) */ 1217 1244 mr_free(bkpinfo->media_device); … … 1221 1248 1222 1249 if ((flag_set['n']) && (! bkpinfo->restore_data)) { 1223 mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->n fs_remote_dir);1224 if ( bkpinfo->nfs_user) {1225 mr_asprintf(tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->n fs_user, tmp1);1250 mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->netfs_remote_dir); 1251 if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) { 1252 mr_asprintf(tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->netfs_user, tmp1); 1226 1253 } else { 1227 1254 mr_asprintf(tmp2, "echo hi > %s", tmp1); … … 1232 1259 if (i) { 1233 1260 retval++; 1234 log_to_screen(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->n fs_remote_dir, bkpinfo->nfs_mount);1261 log_to_screen(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->netfs_remote_dir, bkpinfo->netfs_mount); 1235 1262 } 1236 1263 unlink(tmp1); -
branches/2.2.10/mondo/src/common/libmondo-devices-EXT.h
r2330 r2382 46 46 extern int eject_device(char *); 47 47 48 extern char *list_of_N FS_devices_and_mounts();49 extern char *list_of_N FS_mounts_only(void);48 extern char *list_of_NETFS_devices_and_mounts(); 49 extern char *list_of_NETFS_mounts_only(void); 50 50 51 51 extern void sensibly_set_scratchdir(); -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2376 r2382 54 54 */ 55 55 bool g_restoring_live_from_cd = FALSE; 56 bool g_restoring_live_from_n fs = FALSE;56 bool g_restoring_live_from_netfs = FALSE; 57 57 58 58 extern t_bkptype g_backup_media_type; // set by main() … … 164 164 mr_asprintf(output, "cdstream"); 165 165 break; 166 case n fs:167 mr_asprintf(output, "n fs");166 case netfs: 167 mr_asprintf(output, "netfs"); 168 168 break; 169 169 case tape: … … 1298 1298 mr_free(tmp); 1299 1299 1300 if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso || bkpinfo->backup_media_type == n fs) {1300 if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso || bkpinfo->backup_media_type == netfs) { 1301 1301 // BERLIOS --- I'm tempted to do something about this... 1302 1302 // Why unmount and remount again and again? … … 1310 1310 mr_free(tmp); 1311 1311 1312 if (((bkpinfo->isodir == NULL) && (bkpinfo->n fs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {1312 if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) { 1313 1313 fatal_error("Unable to prepare ISO file name. Please report to dev team"); 1314 1314 } 1315 if (bkpinfo->n fs_remote_dir) {1316 // N FS1317 mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->n fs_remote_dir, bkpinfo->prefix, cd_number_i_want);1315 if (bkpinfo->netfs_remote_dir) { 1316 // NETFS 1317 mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, cd_number_i_want); 1318 1318 } else { 1319 1319 // ISO … … 1322 1322 if (!does_file_exist(tmp)) { 1323 1323 mr_free(tmp); 1324 if (bkpinfo->n fs_remote_dir) {1325 // N FS1326 mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->n fs_remote_dir, bkpinfo->prefix, cd_number_i_want);1324 if (bkpinfo->netfs_remote_dir) { 1325 // NETFS 1326 mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, cd_number_i_want); 1327 1327 } else { 1328 1328 // ISO … … 1413 1413 bkpinfo->nonbootable_backup = FALSE; 1414 1414 1415 // Tape, CD, N FS, ...?1415 // Tape, CD, NETFS, ...? 1416 1416 srandom(getpid()); 1417 1417 bkpinfo->backup_media_type = … … 1647 1647 1648 1648 1649 case n fs:1650 /* Never try to eject a N FS device */1649 case netfs: 1650 /* Never try to eject a NETFS device */ 1651 1651 bkpinfo->please_dont_eject = TRUE; 1652 1652 1653 /* Initiate bkpinfo n fs_mount path from running environment if not already done */1654 if (bkpinfo->n fs_mount == NULL) {1655 mr_asprintf(bkpinfo->n fs_mount, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1"));1653 /* Initiate bkpinfo netfs_mount path from running environment if not already done */ 1654 if (bkpinfo->netfs_mount == NULL) { 1655 mr_asprintf(bkpinfo->netfs_mount, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1")); 1656 1656 } 1657 1657 #ifdef __FreeBSD__ … … 1661 1661 #endif 1662 1662 { 1663 p = popup_and_get_string("N FS dir.", "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)", bkpinfo->nfs_mount);1663 p = popup_and_get_string("Network shared dir.", "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)", bkpinfo->netfs_mount); 1664 1664 if (p == NULL) { 1665 1665 log_to_screen("User has chosen not to backup the PC"); 1666 1666 finish(1); 1667 1667 } 1668 mr_free(bkpinfo->n fs_mount);1669 bkpinfo->n fs_mount = p;1668 mr_free(bkpinfo->netfs_mount); 1669 bkpinfo->netfs_mount = p; 1670 1670 if (!bkpinfo->restore_data) { 1671 1671 if ((bkpinfo->compression_level = … … 1677 1677 // check whether already mounted - we better remove 1678 1678 // surrounding spaces and trailing '/' for this 1679 mr_strip_spaces(bkpinfo->n fs_mount);1680 if (bkpinfo->n fs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')1681 bkpinfo->n fs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';1682 mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->n fs_mount);1679 mr_strip_spaces(bkpinfo->netfs_mount); 1680 if (bkpinfo->netfs_mount[strlen(bkpinfo->netfs_mount) - 1] == '/') 1681 bkpinfo->netfs_mount[strlen(bkpinfo->netfs_mount) - 1] = '\0'; 1682 mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->netfs_mount); 1683 1683 mr_free(bkpinfo->isodir); 1684 1684 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(command)); … … 1711 1711 mr_free(command); 1712 1712 1713 p = popup_and_get_string("N FS share", "Which remote NFS share should I mount?", bkpinfo->nfs_mount);1713 p = popup_and_get_string("Network share", "Which remote Network share should I mount?", bkpinfo->netfs_mount); 1714 1714 if (p == NULL) { 1715 1715 log_to_screen("User has chosen not to backup the PC"); 1716 1716 finish(1); 1717 1717 } 1718 mr_free(bkpinfo->n fs_mount);1719 bkpinfo->n fs_mount = p;1718 mr_free(bkpinfo->netfs_mount); 1719 bkpinfo->netfs_mount = p; 1720 1720 } 1721 1721 /* Initiate bkpinfo isodir path from running environment if mount already done */ 1722 1722 mr_free(bkpinfo->isodir); 1723 if (is_this_device_mounted(bkpinfo->n fs_mount)) {1723 if (is_this_device_mounted(bkpinfo->netfs_mount)) { 1724 1724 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1725 1725 1726 1726 } else { 1727 mr_asprintf(bkpinfo->isodir, "%s/n fsdir", bkpinfo->tmpdir);1727 mr_asprintf(bkpinfo->isodir, "%s/netfsdir", bkpinfo->tmpdir); 1728 1728 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 1729 1729 run_program_and_log_output(command, 5); … … 1731 1731 1732 1732 if (bkpinfo->restore_data) { 1733 mr_asprintf(tmp, "mount -t nfs -o nolock,ro %s %s", bkpinfo->nfs_mount, bkpinfo->isodir); 1733 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 1734 mr_asprintf(tmp, "sshfs -o ro %s %s", bkpinfo->netfs_mount, bkpinfo->isodir); 1735 } else { 1736 mr_asprintf(tmp, "mount -t %s -o nolock,ro %s %s", bkpinfo->netfs_proto, bkpinfo->netfs_mount, bkpinfo->isodir); 1737 } 1734 1738 } else { 1735 mr_asprintf(tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir); 1739 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 1740 mr_asprintf(tmp, "sshfs %s %s", bkpinfo->netfs_mount, bkpinfo->isodir); 1741 } else { 1742 mr_asprintf(tmp, "mount -t %s -o nolock %s %s", bkpinfo->netfs_proto, bkpinfo->netfs_mount, bkpinfo->isodir); 1743 } 1736 1744 } 1737 1745 run_program_and_log_output(tmp, 3); … … 1741 1749 strcpy(g_selfmounted_isodir, bkpinfo->isodir); 1742 1750 } 1743 if (!is_this_device_mounted(bkpinfo->n fs_mount)) {1751 if (!is_this_device_mounted(bkpinfo->netfs_mount)) { 1744 1752 popup_and_OK("Please mount that partition before you try to backup to or restore from it."); 1745 1753 finish(1); 1746 1754 } 1747 p = popup_and_get_string("Directory", "Which directory within that mountpoint?", bkpinfo->n fs_remote_dir);1755 p = popup_and_get_string("Directory", "Which directory within that mountpoint?", bkpinfo->netfs_remote_dir); 1748 1756 if (p == NULL) { 1749 1757 log_to_screen("User has chosen not to backup the PC"); 1750 1758 finish(1); 1751 1759 } 1752 mr_free(bkpinfo->n fs_remote_dir);1753 bkpinfo->n fs_remote_dir = p;1760 mr_free(bkpinfo->netfs_remote_dir); 1761 bkpinfo->netfs_remote_dir = p; 1754 1762 1755 1763 // check whether writable - we better remove surrounding spaces for this 1756 mr_strip_spaces(bkpinfo->n fs_remote_dir);1764 mr_strip_spaces(bkpinfo->netfs_remote_dir); 1757 1765 1758 1766 p = popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename. Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix); … … 1765 1773 log_msg(3, "prefix set to %s", bkpinfo->prefix); 1766 1774 1767 log_msg(3, "Just set n fs_remote_dir to %s", bkpinfo->nfs_remote_dir);1775 log_msg(3, "Just set netfs_remote_dir to %s", bkpinfo->netfs_remote_dir); 1768 1776 log_msg(3, "isodir is still %s", bkpinfo->isodir); 1769 1777 break; … … 1873 1881 bkpinfo->include_paths = p; 1874 1882 1875 mr_asprintf(tmp, "%s", list_of_N FS_mounts_only());1883 mr_asprintf(tmp, "%s", list_of_NETFS_mounts_only()); 1876 1884 if (strlen(tmp) > 2) { 1877 1885 mr_strcat(bkpinfo->exclude_paths, " %s",tmp); … … 1946 1954 1947 1955 if (bkpinfo->backup_media_type == iso 1948 || bkpinfo->backup_media_type == n fs) {1956 || bkpinfo->backup_media_type == netfs) { 1949 1957 g_ISO_restore_mode = TRUE; 1950 1958 } … … 1952 1960 // skip 1953 1961 #else 1954 if (bkpinfo->backup_media_type == n fs) {1955 log_msg(3, "I think the NFSmount is mounted at %s", bkpinfo->isodir);1962 if (bkpinfo->backup_media_type == netfs) { 1963 log_msg(3, "I think the Remote mount is mounted at %s", bkpinfo->isodir); 1956 1964 } 1957 1965 log_it("isodir = %s", bkpinfo->isodir); 1958 if (bkpinfo->nfs_mount) { 1959 log_it("nfs_mount = '%s'", bkpinfo->nfs_mount); 1960 } 1961 if (bkpinfo->nfs_user) { 1962 log_it("nfs_user = '%s'", bkpinfo->nfs_user); 1966 if (bkpinfo->netfs_mount) { 1967 log_it("netfs_mount = '%s'", bkpinfo->netfs_mount); 1968 } 1969 if (bkpinfo->netfs_user) { 1970 log_it("netfs_user = '%s'", bkpinfo->netfs_user); 1971 } 1972 if (bkpinfo->netfs_proto) { 1973 log_it("netfs_proto = '%s'", bkpinfo->netfs_proto); 1963 1974 } 1964 1975 #endif … … 2008 2019 */ 2009 2020 /** 2010 * Get a space-separated list of N FS devices and mounts.2021 * Get a space-separated list of NETFS devices and mounts. 2011 2022 * @return The list created. 2012 2023 * @note The return value points to static data that will be overwritten with each call. 2013 2024 */ 2014 char *list_of_N FS_devices_and_mounts(void)2025 char *list_of_NETFS_devices_and_mounts(void) 2015 2026 { 2016 2027 char *exclude_these_devices = NULL; … … 2018 2029 static char result_sz[1024]; 2019 2030 2020 mr_asprintf(exclude_these_directories,"%s",list_of_N FS_mounts_only());2021 mr_asprintf(exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs| nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));2031 mr_asprintf(exclude_these_directories,"%s",list_of_NETFS_mounts_only()); 2032 mr_asprintf(exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|sshfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2022 2033 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2023 2034 mr_free(exclude_these_devices); … … 2030 2041 2031 2042 /** 2032 * Get a space-separated list of N FS mounts.2043 * Get a space-separated list of NETFS mounts. 2033 2044 * @return The list created. 2034 2045 * @note The return value points to static data that will be overwritten with each call. 2035 2046 * @bug Even though we only want the mounts, the devices are still checked. 2036 2047 */ 2037 char *list_of_N FS_mounts_only(void)2048 char *list_of_NETFS_mounts_only(void) 2038 2049 { 2039 2050 char *exclude_these_directories = NULL; 2040 2051 static char result_sz[512]; 2041 2052 2042 mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs, nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));2053 mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2043 2054 snprintf(result_sz, 511, "%s", exclude_these_directories); 2044 2055 mr_free(exclude_these_directories); … … 2094 2105 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2095 2106 #else 2096 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2107 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2097 2108 #endif 2098 2109 … … 2535 2546 struct stat buf; 2536 2547 #endif 2537 log_msg(0, "Looking for partition table format type");2538 2548 mr_asprintf(fdisk, "/sbin/parted2fdisk"); 2539 log_msg(1, "Using %s", fdisk);2540 2549 mr_asprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive); 2541 2550 mr_free(fdisk); -
branches/2.2.10/mondo/src/common/libmondo-devices.h
r2325 r2382 38 38 int eject_device(char *); 39 39 40 char *list_of_N FS_devices_and_mounts();41 char *list_of_N FS_mounts_only();40 char *list_of_NETFS_devices_and_mounts(); 41 char *list_of_NETFS_mounts_only(); 42 42 43 43 void sensibly_set_scratchdir(); -
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2370 r2382 1299 1299 *p = '\0'; 1300 1300 return (sz_res); 1301 }1302 1303 1304 1305 /**1306 * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full.1307 * @param logfile Unused.1308 * @param include_paths The paths to back up, or NULL if you're using a user-defined filelist.1309 * @param excp The paths to NOT back up.1310 * @param differential The differential level (currently only 0 and 1 are supported).1311 * @param userdef_filelist The user-defined filelist, or NULL if you're using @p include_paths.1312 * @return 0, always.1313 * @bug @p logfile is unused.1314 * @bug Return value is meaningless.1315 */1316 int mondo_makefilelist(char *logfile, char *include_paths, char *excp, int differential, char *userdef_filelist)1317 {1318 char *p, *q;1319 char *sz_datefile;1320 char *sz_filelist;1321 char *exclude_paths = NULL;1322 char *tmp;1323 int i;1324 FILE *fout;1325 char *command = NULL;1326 time_t time_of_last_full_backup = 0;1327 struct stat statbuf;1328 char *tmp1 = NULL;1329 char *tmp2 = NULL;1330 1331 malloc_string(tmp);1332 malloc_string(g_skeleton_filelist);1333 mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);1334 if (!include_paths && !userdef_filelist) {1335 fatal_error("Please supply either include_paths or userdef_filelist");1336 }1337 // make hole for filelist1338 mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);1339 paranoid_system(command);1340 mr_free(command);1341 1342 mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);1343 make_hole_for_file(sz_filelist);1344 1345 if (differential == 0) {1346 // restore last good datefile if it exists1347 mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);1348 run_program_and_log_output(command, 3);1349 mr_free(command);1350 1351 // backup last known good datefile just in case :)1352 if (does_file_exist(sz_datefile)) {1353 mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, sz_datefile);1354 paranoid_system(command);1355 mr_free(command);1356 }1357 make_hole_for_file(sz_datefile);1358 write_one_liner_data_file(sz_datefile,1359 call_program_and_get_last_line_of_output1360 ("date +%s"));1361 } else if (lstat(sz_datefile, &statbuf)) {1362 log_msg(2, "Warning - unable to find date of previous backup. Full backup instead.");1363 differential = 0;1364 time_of_last_full_backup = 0;1365 } else {1366 time_of_last_full_backup = statbuf.st_mtime;1367 log_msg(2, "Differential backup. Yay.");1368 }1369 paranoid_free(sz_datefile);1370 1371 // use user-specified filelist (if specified)1372 if (userdef_filelist) {1373 log_msg(1, "Using the user-specified filelist - %s - instead of calculating one", userdef_filelist);1374 mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist);1375 if (run_program_and_log_output(command, 3)) {1376 mr_free(command);1377 fatal_error("Failed to copy user-specified filelist");1378 }1379 mr_free(command);1380 } else {1381 if (include_paths) {1382 log_msg(2, "include_paths = '%s'", include_paths);1383 }1384 log_msg(1, "Calculating filelist");1385 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));1386 if (strlen(tmp2) < 1) {1387 mr_asprintf(tmp1," ");1388 } else {1389 log_msg(2, "Found windows FS: %s",tmp2);1390 mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);1391 mr_free(tmp2);1392 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));1393 log_msg(2, "Found windows files: %s",tmp2);1394 }1395 mr_free(tmp1);1396 1397 mr_asprintf(exclude_paths, " %s %s %s %s %s . .. " MNT_CDROM " " MNT_FLOPPY " /media /tmp /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);1398 mr_free(tmp2);1399 1400 log_msg(2, "Excluding paths = '%s'", exclude_paths);1401 log_msg(2, "Generating skeleton filelist so that we can track our progress");1402 sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir);1403 make_hole_for_file(g_skeleton_filelist);1404 log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries);1405 log_msg(2, "Opening out filelist to %s", sz_filelist);1406 if (!(fout = fopen(sz_filelist, "w"))) {1407 fatal_error("Cannot openout to sz_filelist");1408 }1409 i = 0;1410 if ((!include_paths) || (strlen(include_paths) == 0)) {1411 log_msg(1, "Including only '/' in %s", sz_filelist);1412 open_and_list_dir("/", exclude_paths, fout,1413 time_of_last_full_backup);1414 } else {1415 p = include_paths;1416 while (*p) {1417 q = next_entry(p);1418 log_msg(1, "Including %s in filelist %s", q, sz_filelist);1419 open_and_list_dir(q, exclude_paths, fout,1420 time_of_last_full_backup);1421 p += strlen(q);1422 paranoid_free(q);1423 while (*p == ' ') {1424 p++;1425 }1426 }1427 }1428 mr_free(exclude_paths);1429 paranoid_fclose(fout);1430 }1431 log_msg(2, "Copying new filelist to scratchdir");1432 mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);1433 paranoid_system(command);1434 mr_free(command);1435 1436 mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);1437 paranoid_system(command);1438 mr_free(command);1439 1440 mr_asprintf(command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);1441 paranoid_system(command);1442 mr_free(command);1443 1444 paranoid_free(sz_filelist);1445 log_msg(2, "Freeing variables");1446 paranoid_free(tmp);1447 paranoid_free(g_skeleton_filelist);1448 log_msg(2, "Exiting");1449 return (0);1450 }1451 1452 1453 1454 /**1455 * Wrapper around mondo_makefilelist().1456 * @param bkpinfo The backup information structure. Fields used:1457 * - @c bkpinfo->differential1458 * - @c bkpinfo->exclude_paths1459 * - @c bkpinfo->include_paths1460 * - @c bkpinfo->make_filelist1461 * - @c bkpinfo->scratchdir1462 * - @c bkpinfo->tmpdir1463 * @return 0 for success, nonzero for failure.1464 * @see mondo_makefilelist1465 */1466 int prepare_filelist()1467 {1468 1469 /*@ int **************************************************** */1470 int res = 0;1471 1472 assert(bkpinfo != NULL);1473 log_it("tmpdir=%s; scratchdir=%s", bkpinfo->tmpdir, bkpinfo->scratchdir);1474 if (bkpinfo->make_filelist) {1475 mvaddstr_and_log_it(g_currentY, 0,1476 "Making catalog of files to be backed up");1477 } else {1478 mvaddstr_and_log_it(g_currentY, 0,1479 "Using supplied catalog of files to be backed up");1480 }1481 1482 if (bkpinfo->make_filelist) {1483 res =1484 mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);1485 } else {1486 res =1487 mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);1488 }1489 1490 if (res) {1491 log_OS_error("Call to mondo_makefilelist failed");1492 mvaddstr_and_log_it(g_currentY++, 74, "Failed.");1493 } else {1494 mvaddstr_and_log_it(g_currentY++, 74, "Done.");1495 }1496 return (res);1497 1301 } 1498 1302 … … 1675 1479 1676 1480 1481 1482 /** 1483 * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full. 1484 * @param logfile Unused. 1485 * @param include_paths The paths to back up, or NULL if you're using a user-defined filelist. 1486 * @param excp The paths to NOT back up. 1487 * @param differential The differential level (currently only 0 and 1 are supported). 1488 * @param userdef_filelist The user-defined filelist, or NULL if you're using @p include_paths. 1489 * @return 0, always. 1490 * @bug @p logfile is unused. 1491 * @bug Return value is meaningless. 1492 */ 1493 int mondo_makefilelist(char *logfile, char *include_paths, char *excp, int differential, char *userdef_filelist) 1494 { 1495 char *p, *q; 1496 char *sz_datefile; 1497 char *sz_filelist; 1498 char *exclude_paths = NULL; 1499 char *tmp; 1500 int i; 1501 FILE *fout; 1502 char *command = NULL; 1503 time_t time_of_last_full_backup = 0; 1504 struct stat statbuf; 1505 char *tmp1 = NULL; 1506 char *tmp2 = NULL; 1507 1508 malloc_string(tmp); 1509 malloc_string(g_skeleton_filelist); 1510 mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0); 1511 if (!include_paths && !userdef_filelist) { 1512 fatal_error("Please supply either include_paths or userdef_filelist"); 1513 } 1514 // make hole for filelist 1515 mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir); 1516 paranoid_system(command); 1517 mr_free(command); 1518 1519 mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir); 1520 make_hole_for_file(sz_filelist); 1521 1522 if (differential == 0) { 1523 // restore last good datefile if it exists 1524 mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile); 1525 run_program_and_log_output(command, 3); 1526 mr_free(command); 1527 1528 // backup last known good datefile just in case :) 1529 if (does_file_exist(sz_datefile)) { 1530 mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, sz_datefile); 1531 paranoid_system(command); 1532 mr_free(command); 1533 } 1534 make_hole_for_file(sz_datefile); 1535 write_one_liner_data_file(sz_datefile, 1536 call_program_and_get_last_line_of_output 1537 ("date +%s")); 1538 } else if (lstat(sz_datefile, &statbuf)) { 1539 log_msg(2, "Warning - unable to find date of previous backup. Full backup instead."); 1540 differential = 0; 1541 time_of_last_full_backup = 0; 1542 } else { 1543 time_of_last_full_backup = statbuf.st_mtime; 1544 log_msg(2, "Differential backup. Yay."); 1545 } 1546 paranoid_free(sz_datefile); 1547 1548 // use user-specified filelist (if specified) 1549 if (userdef_filelist) { 1550 log_msg(1, "Using the user-specified filelist - %s - instead of calculating one", userdef_filelist); 1551 mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist); 1552 if (run_program_and_log_output(command, 3)) { 1553 mr_free(command); 1554 fatal_error("Failed to copy user-specified filelist"); 1555 } 1556 mr_free(command); 1557 } else { 1558 if (include_paths) { 1559 log_msg(2, "include_paths = '%s'", include_paths); 1560 } 1561 log_msg(1, "Calculating filelist"); 1562 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'")); 1563 if (strlen(tmp2) < 1) { 1564 mr_asprintf(tmp1," "); 1565 } else { 1566 log_msg(2, "Found windows FS: %s",tmp2); 1567 mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2); 1568 mr_free(tmp2); 1569 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1570 log_msg(2, "Found windows files: %s",tmp2); 1571 } 1572 mr_free(tmp1); 1573 1574 mr_asprintf(exclude_paths, " %s %s %s %s %s . .. " MNT_CDROM " " MNT_FLOPPY " /media /tmp /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir); 1575 mr_free(tmp2); 1576 1577 log_msg(2, "Excluding paths = '%s'", exclude_paths); 1578 log_msg(2, "Generating skeleton filelist so that we can track our progress"); 1579 sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir); 1580 make_hole_for_file(g_skeleton_filelist); 1581 log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries); 1582 log_msg(2, "Opening out filelist to %s", sz_filelist); 1583 if (!(fout = fopen(sz_filelist, "w"))) { 1584 fatal_error("Cannot openout to sz_filelist"); 1585 } 1586 i = 0; 1587 if ((!include_paths) || (strlen(include_paths) == 0)) { 1588 log_msg(1, "Including only '/' in %s", sz_filelist); 1589 open_and_list_dir("/", exclude_paths, fout, 1590 time_of_last_full_backup); 1591 } else { 1592 p = include_paths; 1593 while (*p) { 1594 q = next_entry(p); 1595 log_msg(1, "Including %s in filelist %s", q, sz_filelist); 1596 open_and_list_dir(q, exclude_paths, fout, 1597 time_of_last_full_backup); 1598 p += strlen(q); 1599 paranoid_free(q); 1600 while (*p == ' ') { 1601 p++; 1602 } 1603 } 1604 } 1605 mr_free(exclude_paths); 1606 paranoid_fclose(fout); 1607 } 1608 log_msg(2, "Copying new filelist to scratchdir"); 1609 mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir); 1610 paranoid_system(command); 1611 mr_free(command); 1612 1613 mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir); 1614 paranoid_system(command); 1615 mr_free(command); 1616 1617 mr_asprintf(command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir); 1618 paranoid_system(command); 1619 mr_free(command); 1620 1621 paranoid_free(sz_filelist); 1622 log_msg(2, "Freeing variables"); 1623 paranoid_free(tmp); 1624 paranoid_free(g_skeleton_filelist); 1625 log_msg(2, "Exiting"); 1626 return (0); 1627 } 1628 1629 1630 1631 /** 1632 * Wrapper around mondo_makefilelist(). 1633 * @param bkpinfo The backup information structure. Fields used: 1634 * - @c bkpinfo->differential 1635 * - @c bkpinfo->exclude_paths 1636 * - @c bkpinfo->include_paths 1637 * - @c bkpinfo->make_filelist 1638 * - @c bkpinfo->scratchdir 1639 * - @c bkpinfo->tmpdir 1640 * @return 0 for success, nonzero for failure. 1641 * @see mondo_makefilelist 1642 */ 1643 int prepare_filelist() 1644 { 1645 1646 /*@ int **************************************************** */ 1647 int res = 0; 1648 1649 assert(bkpinfo != NULL); 1650 log_it("tmpdir=%s; scratchdir=%s", bkpinfo->tmpdir, bkpinfo->scratchdir); 1651 if (bkpinfo->make_filelist) { 1652 mvaddstr_and_log_it(g_currentY, 0, 1653 "Making catalog of files to be backed up"); 1654 } else { 1655 mvaddstr_and_log_it(g_currentY, 0, 1656 "Using supplied catalog of files to be backed up"); 1657 } 1658 1659 if (bkpinfo->make_filelist) { 1660 res = 1661 mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL); 1662 } else { 1663 res = 1664 mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths); 1665 } 1666 1667 if (res) { 1668 log_OS_error("Call to mondo_makefilelist failed"); 1669 mvaddstr_and_log_it(g_currentY++, 74, "Failed."); 1670 } else { 1671 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 1672 } 1673 return (res); 1674 } 1675 1676 1677 1677 /** 1678 1678 * Locate the string @p string_to_find in the tree rooted at @p startnode. -
branches/2.2.10/mondo/src/common/libmondo-files-EXT.h
r2334 r2382 33 33 extern long size_of_all_biggiefiles_K(); 34 34 extern void copy_mondo_and_mindi_stuff_to_scratchdir(); 35 extern void store_n fs_config();35 extern void store_netfs_config(); 36 36 37 37 -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2379 r2382 1059 1059 1060 1060 /** 1061 * Store the client's N FS configuration in files to be restored at restore-time.1062 * Assumes that @c bkpinfo->media_type = n fs, but does not check for this.1061 * Store the client's NETFS configuration in files to be restored at restore-time. 1062 * Assumes that @c bkpinfo->media_type = netfs, but does not check for this. 1063 1063 * @param bkpinfo The backup information structure. Fields used: 1064 * - @c n fs_mount1065 * - @c n fs_remote_dir1064 * - @c netfs_mount 1065 * - @c netfs_remote_dir 1066 1066 * - @c tmpdir 1067 1067 */ 1068 void store_n fs_config()1068 void store_netfs_config() 1069 1069 { 1070 1070 1071 1071 /*@ buffers ******** */ 1072 char *n fs_dev = NULL;1072 char *netfs_dev = NULL; 1073 1073 char *mac_addr = NULL; 1074 char *n fs_mount = NULL;1075 char *n fs_client_ipaddr = NULL;1076 char *n fs_client_netmask = NULL;1077 char *n fs_client_broadcast = NULL;1078 char *n fs_client_defgw = NULL;1079 char *n fs_server_ipaddr = NULL;1074 char *netfs_mount = NULL; 1075 char *netfs_client_ipaddr = NULL; 1076 char *netfs_client_netmask = NULL; 1077 char *netfs_client_broadcast = NULL; 1078 char *netfs_client_defgw = NULL; 1079 char *netfs_server_ipaddr = NULL; 1080 1080 char *tmp = NULL; 1081 1081 char *command = NULL; … … 1084 1084 char *p; 1085 1085 1086 if (! bkpinfo->n fs_mount) {1087 fatal_error("No n fs_mount found !");1088 } 1089 1090 log_it("Storing N FSconfiguration");1091 mr_asprintf(tmp, "%s", bkpinfo->n fs_mount);1086 if (! bkpinfo->netfs_mount) { 1087 fatal_error("No netfs_mount found !"); 1088 } 1089 1090 log_it("Storing Network configuration"); 1091 mr_asprintf(tmp, "%s", bkpinfo->netfs_mount); 1092 1092 p = strchr(tmp, ':'); 1093 1093 if (!p) { 1094 fatal_error("N FSmount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs");1094 fatal_error("Network mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs"); 1095 1095 } 1096 1096 *(p++) = '\0'; 1097 mr_asprintf(n fs_server_ipaddr, "%s", tmp);1098 mr_asprintf(n fs_mount, "%s", p);1097 mr_asprintf(netfs_server_ipaddr, "%s", tmp); 1098 mr_asprintf(netfs_mount, "%s", p); 1099 1099 mr_free(tmp); 1100 1100 1101 1101 /* BERLIOS : there is a bug #67 here as it only considers the first NIC */ 1102 1102 mr_asprintf(command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1"); 1103 mr_asprintf(n fs_dev, "%s", call_program_and_get_last_line_of_output(command));1103 mr_asprintf(netfs_dev, "%s", call_program_and_get_last_line_of_output(command)); 1104 1104 mr_free(command); 1105 1105 1106 1106 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2"); 1107 mr_asprintf(n fs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));1107 mr_asprintf(netfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command)); 1108 1108 mr_free(command); 1109 1109 1110 1110 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2"); 1111 mr_asprintf(n fs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));1111 mr_asprintf(netfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command)); 1112 1112 mr_free(command); 1113 1113 1114 1114 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2"); 1115 mr_asprintf(n fs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));1115 mr_asprintf(netfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command)); 1116 1116 mr_free(command); 1117 1117 1118 1118 mr_asprintf(command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'"); 1119 mr_asprintf(n fs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));1120 mr_free(command); 1121 1122 if (strlen(n fs_dev) < 2) {1123 fatal_error 1124 ("Unable to find ethN (eth0, eth1, ...) adapter via NFS mount you specified.");1125 } 1119 mr_asprintf(netfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command)); 1120 mr_free(command); 1121 1122 if (strlen(netfs_dev) < 2) { 1123 fatal_error("Unable to find ethN (eth0, eth1, ...) adapter via Network mount you specified."); 1124 } 1125 1126 1126 /******** 1127 * If the N FSdevice that found above is a bonded device,1127 * If the Network device that found above is a bonded device, 1128 1128 * we need to replace it with an ethN device or the 1129 * networking will not start during an N FSrestore.1129 * networking will not start during an Network restore. 1130 1130 * 1131 * If the N FS device in nfs_dev begins with the word "bond", or alb or aft1132 * look for the corresponding slave ethN device and copy it to n fs_dev.1131 * If the Network device in netfs_dev begins with the word "bond", or alb or aft 1132 * look for the corresponding slave ethN device and copy it to netfs_dev. 1133 1133 * Using the common MAC address 1134 1134 ********/ 1135 if (!strncmp(n fs_dev, "bond", 4) || !strncmp(nfs_dev, "alb", 3) || !strncmp(nfs_dev, "aft", 3)) {1136 log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", n fs_dev);1137 mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", n fs_dev);1135 if (!strncmp(netfs_dev, "bond", 4) || !strncmp(netfs_dev, "alb", 3) || !strncmp(netfs_dev, "aft", 3)) { 1136 log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", netfs_dev); 1137 mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", netfs_dev); 1138 1138 mr_asprintf(mac_addr, "%s", call_program_and_get_last_line_of_output(command)); 1139 1139 mr_free(command); 1140 1140 1141 mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,n fs_dev);1141 mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,netfs_dev); 1142 1142 mr_free(mac_addr); 1143 mr_free(n fs_dev);1144 1145 mr_asprintf(n fs_dev, "%s", call_program_and_get_last_line_of_output(command));1143 mr_free(netfs_dev); 1144 1145 mr_asprintf(netfs_dev, "%s", call_program_and_get_last_line_of_output(command)); 1146 1146 mr_free(command); 1147 1147 1148 log_to_screen("Replacing it with %s\n", nfs_dev); 1149 } 1150 1151 mr_asprintf(tmp, "%s/NFS-DEV", bkpinfo->tmpdir); 1152 write_one_liner_data_file(tmp, nfs_dev); 1153 mr_free(nfs_dev); 1154 mr_free(tmp); 1155 1156 mr_asprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1157 write_one_liner_data_file(tmp, nfs_client_ipaddr); 1158 mr_free(nfs_client_ipaddr); 1159 mr_free(tmp); 1160 1161 mr_asprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir); 1162 write_one_liner_data_file(tmp, nfs_client_netmask); 1163 mr_free(nfs_client_netmask); 1164 mr_free(tmp); 1165 1166 mr_asprintf(tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir); 1167 write_one_liner_data_file(tmp, nfs_client_broadcast); 1168 mr_free(nfs_client_broadcast); 1169 mr_free(tmp); 1170 1171 mr_asprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir); 1172 write_one_liner_data_file(tmp, nfs_client_defgw); 1173 mr_free(nfs_client_defgw); 1174 mr_free(tmp); 1175 1176 mr_asprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir); 1177 write_one_liner_data_file(tmp, nfs_server_ipaddr); 1178 mr_free(tmp); 1179 mr_free(nfs_server_ipaddr); 1180 1181 mr_asprintf(tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir); 1182 write_one_liner_data_file(tmp, bkpinfo->nfs_mount); 1183 mr_free(tmp); 1184 mr_free(nfs_mount); 1185 1186 mr_asprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir); 1187 write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir); 1148 log_to_screen("Replacing it with %s\n", netfs_dev); 1149 } 1150 1151 mr_asprintf(tmp, "%s/NETFS-DEV", bkpinfo->tmpdir); 1152 write_one_liner_data_file(tmp, netfs_dev); 1153 mr_free(netfs_dev); 1154 mr_free(tmp); 1155 1156 mr_asprintf(tmp, "%s/NETFS-PROTO", bkpinfo->tmpdir); 1157 write_one_liner_data_file(tmp, bkpinfo->netfs_proto); 1158 1159 mr_asprintf(tmp, "%s/NETFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1160 write_one_liner_data_file(tmp, netfs_client_ipaddr); 1161 mr_free(netfs_client_ipaddr); 1162 mr_free(tmp); 1163 1164 mr_asprintf(tmp, "%s/NETFS-CLIENT-NETMASK", bkpinfo->tmpdir); 1165 write_one_liner_data_file(tmp, netfs_client_netmask); 1166 mr_free(netfs_client_netmask); 1167 mr_free(tmp); 1168 1169 mr_asprintf(tmp, "%s/NETFS-CLIENT-BROADCAST", bkpinfo->tmpdir); 1170 write_one_liner_data_file(tmp, netfs_client_broadcast); 1171 mr_free(netfs_client_broadcast); 1172 mr_free(tmp); 1173 1174 mr_asprintf(tmp, "%s/NETFS-CLIENT-DEFGW", bkpinfo->tmpdir); 1175 write_one_liner_data_file(tmp, netfs_client_defgw); 1176 mr_free(netfs_client_defgw); 1177 mr_free(tmp); 1178 1179 mr_asprintf(tmp, "%s/NETFS-SERVER-IPADDR", bkpinfo->tmpdir); 1180 write_one_liner_data_file(tmp, netfs_server_ipaddr); 1181 mr_free(tmp); 1182 mr_free(netfs_server_ipaddr); 1183 1184 mr_asprintf(tmp, "%s/NETFS-SERVER-MOUNT", bkpinfo->tmpdir); 1185 write_one_liner_data_file(tmp, bkpinfo->netfs_mount); 1186 mr_free(tmp); 1187 mr_free(netfs_mount); 1188 1189 mr_asprintf(tmp, "%s/NETFS-SERVER-PATH", bkpinfo->tmpdir); 1190 write_one_liner_data_file(tmp, bkpinfo->netfs_remote_dir); 1188 1191 mr_free(tmp); 1189 1192 … … 1192 1195 mr_free(tmp); 1193 1196 1194 log_it("Finished storing N FSconfiguration");1197 log_it("Finished storing Network configuration"); 1195 1198 } 1196 1199 -
branches/2.2.10/mondo/src/common/libmondo-files.h
r2334 r2382 33 33 34 34 void copy_mondo_and_mindi_stuff_to_scratchdir(); 35 void store_n fs_config();35 void store_netfs_config(); 36 36 void estimate_noof_media_required(long); 37 37 bool is_this_file_compressed(char *); -
branches/2.2.10/mondo/src/common/libmondo-fork.c
r2375 r2382 117 117 old_stderr[0] = '\0'; 118 118 119 if ( bkpinfo->nfs_user) {120 mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->n fs_user, basic_call);119 if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) { 120 mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->netfs_user, basic_call); 121 121 } else { 122 122 mr_asprintf(tmp1, "%s", basic_call); -
branches/2.2.10/mondo/src/common/libmondo-mountlist.c
r2372 r2382 406 406 continue; 407 407 } 408 log_msg(2, "Processing partition %s on %s #%d in mountlist", device, drive, pos); 408 409 /* gap in the partition list? */ 409 410 if (curr_part_no - prev_part_no > 1) { … … 502 503 if (res == 0) { 503 504 mr_free(flaws_str); 505 log_msg(2, "Fine, no error in evaluate_drive_within_mountlist"); 504 506 return (NULL); 505 507 } else { 508 log_msg(2, "Error in evaluate_drive_within_mountlist: %s", flaws_str); 506 509 return (flaws_str); 507 510 } -
branches/2.2.10/mondo/src/common/libmondo-string.c
r2377 r2382 1102 1102 mr_asprintf(type_of_backup, "ISO"); 1103 1103 break; 1104 case n fs:1105 mr_asprintf(type_of_backup, "n fs");1104 case netfs: 1105 mr_asprintf(type_of_backup, "netfs"); 1106 1106 break; 1107 1107 case usb: -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2357 r2382 373 373 * - Used: @c bkpinfo->make_cd_use_lilo 374 374 * - Used: @c bkpinfo->media_device 375 * - Used: @c bkpinfo->n fs_mount375 * - Used: @c bkpinfo->netfs_mount 376 376 * - Used: @c bkpinfo->nonbootable_backup 377 377 * - Used: @c bkpinfo->scratchdir … … 657 657 } // end of iso code 658 658 659 if (bkpinfo->backup_media_type == n fs) {660 if (bkpinfo->n fs_mount) {661 mr_asprintf(hostname, "%s", bkpinfo->n fs_mount);659 if (bkpinfo->backup_media_type == netfs) { 660 if (bkpinfo->netfs_mount) { 661 mr_asprintf(hostname, "%s", bkpinfo->netfs_mount); 662 662 } else { 663 log_it("n fs_mount is NULL");663 log_it("netfs_mount is NULL"); 664 664 retval++; 665 665 mr_asprintf(hostname, ""); … … 667 667 colon = strchr(hostname, ':'); 668 668 if (!colon) { 669 log_it("n fs mount doesn't have a colon in it");669 log_it("netfs mount doesn't have a colon in it"); 670 670 retval++; 671 671 } else { … … 675 675 hent = gethostbyname(hostname); 676 676 if (!hent) { 677 log_it("Can't resolve N FSmount (%s): %s", hostname, hstrerror(h_errno));677 log_it("Can't resolve Network mount (%s): %s", hostname, hstrerror(h_errno)); 678 678 retval++; 679 679 } else { 680 680 mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr))); 681 mr_strcat(ip_address, strchr(bkpinfo->n fs_mount, ':'));682 mr_free(bkpinfo->n fs_mount);683 bkpinfo->n fs_mount = ip_address;681 mr_strcat(ip_address, strchr(bkpinfo->netfs_mount, ':')); 682 mr_free(bkpinfo->netfs_mount); 683 bkpinfo->netfs_mount = ip_address; 684 684 } 685 685 } 686 686 mr_free(hostname); 687 store_n fs_config();687 store_netfs_config(); 688 688 } 689 689 … … 797 797 mr_free(bkpinfo->call_after_iso); 798 798 mr_free(bkpinfo->kernel_path); 799 mr_free(bkpinfo->nfs_mount); 800 mr_free(bkpinfo->nfs_remote_dir); 801 mr_free(bkpinfo->nfs_user); 799 mr_free(bkpinfo->netfs_mount); 800 mr_free(bkpinfo->netfs_remote_dir); 801 mr_free(bkpinfo->netfs_user); 802 mr_free(bkpinfo->netfs_proto); 802 803 mr_free(bkpinfo->postnuke_tarball); 803 804 … … 855 856 bkpinfo->call_after_iso = NULL; 856 857 bkpinfo->kernel_path = NULL; 857 bkpinfo->nfs_mount = NULL; 858 bkpinfo->nfs_remote_dir = NULL; 859 bkpinfo->nfs_user = NULL; 858 bkpinfo->netfs_mount = NULL; 859 bkpinfo->netfs_remote_dir = NULL; 860 bkpinfo->netfs_user = NULL; 861 bkpinfo->netfs_proto = NULL; 860 862 bkpinfo->postnuke_tarball = NULL; 861 863 bkpinfo->wipe_media_first = FALSE; -
branches/2.2.10/mondo/src/common/libmondo-verify.c
r2376 r2382 1014 1014 * - @c bkpinfo->manual_cd_tray 1015 1015 * - @c bkpinfo->media_device 1016 * - @c bkpinfo->n fs_remote_dir1016 * - @c bkpinfo->netfs_remote_dir 1017 1017 * - @c bkpinfo->tmpdir 1018 1018 * - @c bkpinfo->verify_data … … 1048 1048 1049 1049 mr_asprintf(mountpoint, "%s/cdrom", bkpinfo->tmpdir); 1050 if (((bkpinfo->isodir == NULL) && (bkpinfo->n fs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {1050 if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) { 1051 1051 fatal_error("No iso filename preparation possible"); 1052 1052 } 1053 if (bkpinfo->n fs_remote_dir) {1054 // N FS1055 mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->n fs_remote_dir, bkpinfo->prefix, g_current_media_number);1053 if (bkpinfo->netfs_remote_dir) { 1054 // NETFS 1055 mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number); 1056 1056 } else { 1057 1057 // ISO -
branches/2.2.10/mondo/src/common/mondostructures.h
r2338 r2382 182 182 dvd, ///< Back up to DVD+R[W] or DVD-R[W] disks. 183 183 cdstream, ///< Back up to recordable CDs but treat them like a tape streamer. 184 n fs, ///< Back up to an NFS mount on the local subnet.184 netfs, ///< Back up to an NETFS mount on the local subnet. 185 185 tape, ///< Back up to tapes. 186 186 usb, ///< Back up to USB devices. … … 557 557 558 558 /** 559 * The N FS mount to back up to/restore from.560 * If backup_media_type is not @b n fs, this is ignored.559 * The NETFS mount to back up to/restore from. 560 * If backup_media_type is not @b netfs, this is ignored. 561 561 * It must contain a colon, and the server's address should be in dotted-decimal IP 562 562 * address form. (Domain names will be resolved in post_param_configuration().) 563 563 */ 564 char *n fs_mount;565 566 /** 567 * The directory, relative to the root of @p n fs_mount, to put564 char *netfs_mount; 565 566 /** 567 * The directory, relative to the root of @p netfs_mount, to put 568 568 * the backups in. 569 569 */ 570 char *nfs_remote_dir; 571 572 /** 573 * The potential user to use for NFS backup 574 */ 575 char *nfs_user; 570 char *netfs_remote_dir; 571 572 /** 573 * The potential user to use for NETFS backup 574 */ 575 char *netfs_user; 576 577 /** 578 * The protocol to use for Network backup (NFS, SSHFS, ...) 579 */ 580 char *netfs_proto; 576 581 577 582 /** -
branches/2.2.10/mondo/src/common/newt-specific.c
r2377 r2382 20 20 #include "my-stuff.h" 21 21 #include "mr_mem.h" 22 #include "mr_str.h" 22 23 #include "mondostructures.h" 23 24 #include "newt-specific.h" … … 99 100 long g_start_time = 0L; ///< The time (in seconds since the epoch) that the progress form was opened. 100 101 bool g_text_mode = TRUE; ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface. 101 char *g_selfmounted_isodir; ///< Holds the N FS mountpoint if mounted via mondoarchive.102 char *g_selfmounted_isodir; ///< Holds the NETFS mountpoint if mounted via mondoarchive. 102 103 103 104 /* @} - end of globalGroup */ … … 1106 1107 * Ask the user which backup media type they would like to use. 1107 1108 * The choices are @p none (exit to shell), @c cdr, @c cdrw, @c dvd, 1108 * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c n fs,1109 * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c netfs, 1109 1110 * and @c iso. 1110 1111 * @param restoring TRUE if we're restoring, FALSE if we're backing up. … … 1120 1121 char *title_sz = NULL; 1121 1122 char *minimsg_sz = NULL; 1122 static t_bkptype possible_bkptypes[] = { none, cdr, cdrw, dvd, tape, cdstream, udev, n fs, iso };1123 static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "n fs", "iso", NULL };1123 static t_bkptype possible_bkptypes[] = { none, cdr, cdrw, dvd, tape, cdstream, udev, netfs, iso }; 1124 static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL }; 1124 1125 char *outstr = NULL; 1125 1126 t_bkptype backup_type; … … 1171 1172 b4 = newtButton(17, 5, "USB Key/Disk"); 1172 1173 b5 = newtButton(1, 5, " DVD disks "); 1173 b6 = newtButton(17, 9, " N FSmount ");1174 b6 = newtButton(17, 9, " Net mount "); 1174 1175 b7 = newtButton(1, 13, " Hard disk "); 1175 1176 b8 = newtButton(17, 13, " Exit "); … … 1191 1192 output = dvd; 1192 1193 } else if (b_res == b6) { 1193 output = n fs;1194 output = netfs; 1194 1195 } else if (b_res == b7) { 1195 1196 output = iso; … … 1453 1454 for (i = 0; i < filelist->entries; i++) { 1454 1455 keylist[i] = (void *) i; 1455 tmp = filelist_entry_to_string(&(filelist->el[i])) , keylist[i];1456 newtListboxAppendEntry(fileListbox, tmp );1456 tmp = filelist_entry_to_string(&(filelist->el[i])); 1457 newtListboxAppendEntry(fileListbox, tmp, keylist[i]); 1457 1458 mr_free(tmp); 1458 1459 } -
branches/2.2.10/mondo/src/include/my-stuff.h
r2340 r2382 319 319 #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/md" 320 320 #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE 321 #define SANE_FORMATS "swap image vfat ext2 ext3 ext4 xfs vfs jfs reiserfs vmfs dos minix coda nfs nfs4 ntfs ntfs-3g hpfs raid lvm cifs ocfs ocfs2"321 #define SANE_FORMATS "swap image vfat ext2 ext3 ext4 xfs vfs jfs reiserfs vmfs dos minix coda fuse.sshfs nfs nfs4 ntfs ntfs-3g hpfs raid lvm cifs ocfs ocfs2" 322 322 #define ALT_TAPE "/dev/ht0" 323 323 #define MKE2FS_OR_NEWFS "mke2fs" -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c
r2357 r2382 2289 2289 } 2290 2290 2291 if (does_file_exist("/tmp/N FS-SERVER-PATH")) {2291 if (does_file_exist("/tmp/NETFS-SERVER-PATH")) { 2292 2292 mr_free(idev); 2293 idev = last_line_of_file("/tmp/N FS-SERVER-MOUNT");2294 mr_asprintf(isodir_format, "n fs");2293 idev = last_line_of_file("/tmp/NETFS-SERVER-MOUNT"); 2294 mr_asprintf(isodir_format, "netfs"); 2295 2295 mr_free(isodir_path); 2296 isodir_path = last_line_of_file("/tmp/N FS-SERVER-PATH");2296 isodir_path = last_line_of_file("/tmp/NETFS-SERVER-PATH"); 2297 2297 } 2298 2298 -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2376 r2382 7 7 #include "my-stuff.h" 8 8 #include "mr_mem.h" 9 #include "mr_str.h" 9 10 #include "../common/mondostructures.h" 10 11 #include "../common/libmondo.h" … … 562 563 } 563 564 564 if (bkpinfo->backup_media_type == n fs) {565 log_msg(2, "Mounting for N FSthingy");565 if (bkpinfo->backup_media_type == netfs) { 566 log_msg(2, "Mounting for Network thingy"); 566 567 log_msg(2, "isodir = %s", bkpinfo->isodir); 567 568 if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) { … … 570 571 log_msg(1, "isodir is being set to %s", bkpinfo->isodir); 571 572 } 572 if ((bkpinfo->isodir == NULL) || (bkpinfo->n fs_remote_dir == NULL) || (bkpinfo->prefix == NULL)) {573 if ((bkpinfo->isodir == NULL) || (bkpinfo->netfs_remote_dir == NULL) || (bkpinfo->prefix == NULL)) { 573 574 fatal_error("Unable to prepare the iso filename"); 574 575 } 575 576 #ifdef __FreeBSD__ 576 mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->n fs_remote_dir, bkpinfo->prefix, g_current_media_number);577 mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number); 577 578 mddev = make_vn(mount_cmd); 578 579 mr_free(mount_cmd); … … 580 581 mr_asprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev); 581 582 #else 582 mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->n fs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);583 mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM); 583 584 #endif 584 585 … … 744 745 mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX); 745 746 } 746 } else if (!strcmp(value, "n fs")) {747 bkpinfo->backup_media_type = n fs;747 } else if (!strcmp(value, "netfs")) { 748 bkpinfo->backup_media_type = netfs; 748 749 bkpinfo->please_dont_eject = TRUE; 749 750 mr_free(bkpinfo->prefix); … … 757 758 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) { 758 759 /* We need to override prefix value in PXE mode as it's 759 * already done in start-n fs */760 * already done in start-netfs */ 760 761 envtmp1 = getenv("imgname"); 761 762 if (envtmp1 == NULL) { … … 944 945 mr_free(tmp); 945 946 946 if (bkpinfo->backup_media_type == n fs) {947 if (bkpinfo->backup_media_type == netfs) { 947 948 if (!cfgf) { 948 if (bkpinfo->n fs_mount) {949 log_msg(2, "n fs_mount remains %s", bkpinfo->nfs_mount);950 } 951 if (bkpinfo->n fs_remote_dir) {952 log_msg(2, "n fs_remote_dir remains %s", bkpinfo->nfs_remote_dir);949 if (bkpinfo->netfs_mount) { 950 log_msg(2, "netfs_mount remains %s", bkpinfo->netfs_mount); 951 } 952 if (bkpinfo->netfs_remote_dir) { 953 log_msg(2, "netfs_remote_dir remains %s", bkpinfo->netfs_remote_dir); 953 954 } 954 955 log_msg(2, "...cos it wouldn't make sense to abandon the values that GOT ME to this config file in the first place"); 955 956 } else { 956 mr_free(bkpinfo->nfs_mount); 957 bkpinfo->nfs_mount = read_cfg_var(g_mondo_cfg_file, "nfs-server-mount"); 958 959 mr_free(bkpinfo->nfs_remote_dir); 960 bkpinfo->nfs_remote_dir = read_cfg_var(g_mondo_cfg_file, "nfs-server-path"); 961 962 if (bkpinfo->nfs_mount != NULL) { 963 log_msg(2, "nfs_mount is %s", bkpinfo->nfs_mount); 964 } 965 if (bkpinfo->nfs_remote_dir != NULL) { 966 log_msg(2, "nfs_remote_dir is %s", bkpinfo->nfs_remote_dir); 957 mr_free(bkpinfo->netfs_mount); 958 bkpinfo->netfs_mount = read_cfg_var(g_mondo_cfg_file, "netfs-server-mount"); 959 960 mr_free(bkpinfo->netfs_remote_dir); 961 bkpinfo->netfs_remote_dir = read_cfg_var(g_mondo_cfg_file, "netfs-server-path"); 962 963 if (bkpinfo->netfs_mount != NULL) { 964 log_msg(2, "netfs_mount is %s", bkpinfo->netfs_mount); 965 } 966 if (bkpinfo->netfs_remote_dir != NULL) { 967 log_msg(2, "netfs_remote_dir is %s", bkpinfo->netfs_remote_dir); 968 } 969 if (bkpinfo->netfs_proto != NULL) { 970 log_msg(2, "netfs_proto is %s", bkpinfo->netfs_proto); 967 971 } 968 972 } 969 973 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) { 970 974 /* We need to override values in PXE mode as it's 971 * already done in start-n fs */972 envtmp1 = getenv("n fsmount");975 * already done in start-netfs */ 976 envtmp1 = getenv("netfsmount"); 973 977 if (envtmp1 == NULL) { 974 fatal_error("no n fsmount variable in environment");978 fatal_error("no netfsmount variable in environment"); 975 979 } 976 980 envtmp2 = getenv("dirimg"); … … 978 982 fatal_error("no dirimg variable in environment"); 979 983 } 980 mr_free(bkpinfo->n fs_mount);981 mr_asprintf(bkpinfo->n fs_mount, "%s", envtmp1);982 983 mr_free(bkpinfo->n fs_remote_dir);984 mr_asprintf(bkpinfo->n fs_remote_dir, "%s", envtmp2);984 mr_free(bkpinfo->netfs_mount); 985 mr_asprintf(bkpinfo->netfs_mount, "%s", envtmp1); 986 987 mr_free(bkpinfo->netfs_remote_dir); 988 mr_asprintf(bkpinfo->netfs_remote_dir, "%s", envtmp2); 985 989 } 986 990 } else if (bkpinfo->backup_media_type == iso) { -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2376 r2382 919 919 mr_free(bkpinfo->restore_path); 920 920 mr_asprintf(bkpinfo->restore_path, "/"); 921 if (!g_restoring_live_from_cd && !g_restoring_live_from_n fs) {921 if (!g_restoring_live_from_cd && !g_restoring_live_from_netfs) { 922 922 popup_and_OK 923 923 ("Please insert tape/CD/USB Key, then hit 'OK' to continue."); 924 924 sleep(1); 925 925 } 926 if (!g_restoring_live_from_n fs) {926 if (!g_restoring_live_from_netfs) { 927 927 interactively_obtain_media_parameters_from_user(FALSE); 928 928 } … … 946 946 load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); 947 947 948 if (!g_restoring_live_from_n fs && (filelist = process_filelist_and_biggielist())) {948 if (!g_restoring_live_from_netfs && (filelist = process_filelist_and_biggielist())) { 949 949 save_filelist(filelist, "/tmp/selected-files.txt"); 950 950 mr_asprintf(old_restpath, "%s", bkpinfo->restore_path); … … 2828 2828 mount_boot_if_necessary(); /* for Gentoo users */ 2829 2829 log_msg(2, "Still here."); 2830 if (bkpinfo->backup_media_type == n fs) {2831 g_restoring_live_from_n fs = TRUE;2830 if (bkpinfo->backup_media_type == netfs) { 2831 g_restoring_live_from_netfs = TRUE; 2832 2832 } 2833 2833 /* Adding an initialisation in order to avoid to hndle NULL pointer later */ … … 2861 2861 // BCO:To be reviewed 2862 2862 if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) { 2863 if (bkpinfo->backup_media_type == n fs && bkpinfo->nfs_mount && !is_this_device_mounted(bkpinfo->nfs_mount)) {2864 log_msg(1, "Mounting nfs dir");2863 if (bkpinfo->backup_media_type == netfs && bkpinfo->netfs_mount && !is_this_device_mounted(bkpinfo->netfs_mount)) { 2864 log_msg(1, "Mounting remote %s dir", bkpinfo->netfs_proto); 2865 2865 mr_free(bkpinfo->isodir); 2866 2866 mr_asprintf(bkpinfo->isodir, "/tmp/isodir"); 2867 2867 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 2868 mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount); 2868 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 2869 mr_asprintf(tmp, "sshfs -o ro %s /tmp/isodir", bkpinfo->netfs_mount); 2870 } else { 2871 mr_asprintf(tmp, "mount %s -o nolock,ro /tmp/isodir", bkpinfo->netfs_mount); 2872 } 2869 2873 run_program_and_log_output(tmp, 1); 2870 2874 mr_free(tmp); -
branches/2.2.10/mondo/src/mondorestore/mr-externs.h
r2352 r2382 107 107 extern bool g_text_mode; 108 108 extern bool g_restoring_live_from_cd; 109 extern bool g_restoring_live_from_n fs;109 extern bool g_restoring_live_from_netfs; 110 110 extern int fput_string_one_char_at_a_time(FILE *, char *); 111 111 extern char *evaluate_mountlist(struct mountlist_itself *mountlist, int *res);
Note:
See TracChangeset
for help on using the changeset viewer.