diff options
author | Christian Zoffoli <xmerlin@gentoo.org> | 2005-03-31 20:57:46 +0000 |
---|---|---|
committer | Christian Zoffoli <xmerlin@gentoo.org> | 2005-03-31 20:57:46 +0000 |
commit | bdcd3e7100d1d3ab61f5631d172e1dac4daef7a3 (patch) | |
tree | ded66d42b9c1948fde2016f7252cab5cc9bfe363 /sys-block | |
parent | stable amd64 (diff) | |
download | historical-bdcd3e7100d1d3ab61f5631d172e1dac4daef7a3.tar.gz historical-bdcd3e7100d1d3ab61f5631d172e1dac4daef7a3.tar.bz2 historical-bdcd3e7100d1d3ab61f5631d172e1dac4daef7a3.zip |
backported some fixes from mdk (64-bit & lib64 fixes, fflush before re-read partition table, added save all and rest all actions)
Package-Manager: portage-2.0.51.19
Diffstat (limited to 'sys-block')
8 files changed, 618 insertions, 6 deletions
diff --git a/sys-block/partimage/ChangeLog b/sys-block/partimage/ChangeLog index 1e3b0745d831..12f9adfe2ff7 100644 --- a/sys-block/partimage/ChangeLog +++ b/sys-block/partimage/ChangeLog @@ -1,6 +1,17 @@ # ChangeLog for sys-block/partimage # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-block/partimage/ChangeLog,v 1.4 2005/03/13 13:58:09 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-block/partimage/ChangeLog,v 1.5 2005/03/31 20:57:46 xmerlin Exp $ + +*partimage-0.6.4-r3 (31 Mar 2005) + + 31 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> + +files/partimage-0.6.4-LP64-fixes.patch, + +files/partimage-0.6.4-fflush-before-re-read-partition-table.patch, + +files/partimage-0.6.4-lib64.patch, + +files/partimage-0.6.4-save_all_and_rest_all_actions.patch, + +partimage-0.6.4-r3.ebuild: + backported some fixes from mdk (64-bit & lib64 fixes, fflush before re-read + partition table, added save all and rest all actions) 13 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> partimage-0.6.4-r2.ebuild: diff --git a/sys-block/partimage/Manifest b/sys-block/partimage/Manifest index f404e1592722..122d652f9248 100644 --- a/sys-block/partimage/Manifest +++ b/sys-block/partimage/Manifest @@ -1,12 +1,13 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -MD5 aab6d589b113128ba78da9228d78b482 ChangeLog 4133 +MD5 11cb60c7dd01740e39988556543e65cf ChangeLog 4600 MD5 6b4c83400b7b7a44afb53e1a7ac388af metadata.xml 300 MD5 0823991ecf05c5fb37561fc3996200a5 partimage-0.6.2.ebuild 1682 MD5 3274833ce702b2312325db17559d9ff1 partimage-0.6.4-r1.ebuild 4498 MD5 01fc1caceb5760ff41ed006dbc945eda partimage-0.6.4-r2.ebuild 3956 MD5 d86d932f33956374c79b9ce3524c118d partimage-0.6.4.ebuild 4163 +MD5 582552aa429b2a14b23b77d2157c9431 partimage-0.6.4-r3.ebuild 4194 MD5 6fd04332b7f640a2aa71f208d2bd2dc8 files/digest-partimage-0.6.2 68 MD5 3bbd1e2fc0dd50034c600d01d08e8997 files/digest-partimage-0.6.4 68 MD5 3bbd1e2fc0dd50034c600d01d08e8997 files/digest-partimage-0.6.4-r1 68 @@ -19,10 +20,15 @@ MD5 724ac3895dc01f277b34dab251ec47bb files/partimaged.conf 424 MD5 86ccd8a7d116f22182ae60e01da1bfff files/partimaged.init 756 MD5 938ecb802f7e26ff8df88404f0648c7c files/partimagedusers.5 1263 MD5 b854c74900be1967b69b5997a434897c files/servercert.cnf 1096 +MD5 60b6a720fc1d32cb9325428d7aeb49c2 files/partimage-0.6.4-LP64-fixes.patch 1773 +MD5 d4ac3ff2ae9e3225c14bbb1fc1373df9 files/partimage-0.6.4-fflush-before-re-read-partition-table.patch 401 +MD5 a4cd05177b2b00d6e1b2d426ff9736eb files/partimage-0.6.4-lib64.patch 2102 +MD5 5e328f1bb041b6b49957186d5598f3c1 files/partimage-0.6.4-save_all_and_rest_all_actions.patch 10301 +MD5 3bbd1e2fc0dd50034c600d01d08e8997 files/digest-partimage-0.6.4-r3 68 -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.2.6 (GNU/Linux) +Version: GnuPG v1.4.1 (GNU/Linux) -iD8DBQFCNEcMgMUyd/cdjWsRAgqDAJ9ChWPAi0A+fhWbwQaebbM9jAz7pACfS50c -3PLdyEnh7jA/O4chxRtPJKk= -=y0f1 +iD8DBQFCTGZogMUyd/cdjWsRAsbjAJ0YG1UXAYVPxVLamuwRyLZ5yl5DtwCeNHHR +XtFVsA6rYyB9pebkHwrETSk= +=Eswt -----END PGP SIGNATURE----- diff --git a/sys-block/partimage/files/digest-partimage-0.6.4-r3 b/sys-block/partimage/files/digest-partimage-0.6.4-r3 new file mode 100644 index 000000000000..f525923985b4 --- /dev/null +++ b/sys-block/partimage/files/digest-partimage-0.6.4-r3 @@ -0,0 +1 @@ +MD5 ee56df4a6be1f78f53dc48454655aa8a partimage-0.6.4.tar.bz2 654707 diff --git a/sys-block/partimage/files/partimage-0.6.4-LP64-fixes.patch b/sys-block/partimage/files/partimage-0.6.4-LP64-fixes.patch new file mode 100644 index 000000000000..3880067e6340 --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.4-LP64-fixes.patch @@ -0,0 +1,60 @@ +--- partimage-0.6.4/src/client/fs/fs_xfs.h.LP64-fixes 2004-02-03 19:57:36.000000000 -0500 ++++ partimage-0.6.4/src/client/fs/fs_xfs.h 2005-02-21 10:25:06.220053947 -0500 +@@ -19,6 +19,7 @@ + #define FS_XFS_H + + #include <ctype.h> ++#include <stdint.h> + + #include "partimage.h" + #include "common.h" +@@ -99,22 +100,14 @@ class CRestoringWindow; + #define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi) + + #define XFS_SB_MAGIC 0x58465342 // 'XFSB' +-typedef signed char __int8_t; +-typedef unsigned char __uint8_t; +-typedef signed short int __int16_t; +-typedef unsigned short int __uint16_t; +-typedef signed int __int32_t; +-typedef unsigned int __uint32_t; +-#ifdef __ia64__ +-typedef signed long int __int64_t; +-typedef unsigned long int __uint64_t; +-#elif __alpha__ +-typedef signed long int __int64_t; +-typedef unsigned long int __uint64_t; +-#else +-typedef signed long long int __int64_t; +-typedef unsigned long long int __uint64_t; +-#endif ++typedef int8_t __int8_t; ++typedef uint8_t __uint8_t; ++typedef int16_t __int16_t; ++typedef uint16_t __uint16_t; ++typedef int32_t __int32_t; ++typedef uint32_t __uint32_t; ++typedef int64_t __int64_t; ++typedef uint64_t __uint64_t; + + // POSIX Extensions + typedef unsigned char uchar_t; +@@ -157,16 +150,8 @@ typedef __uint64_t xfs_drtbno_t; // exte + typedef __uint64_t xfs_dfiloff_t; // block number in a file + typedef __uint64_t xfs_dfilblks_t; // number of blocks in a file + +-#ifdef __ia64__ +-typedef unsigned long __u64; +-typedef signed long __s64; +-#elif __alpha__ +-typedef unsigned long __u64; +-typedef signed long __s64; +-#else +-typedef unsigned long long __u64; +-typedef signed long long __s64; +-#endif ++typedef uint64_t __u64; ++typedef int64_t __s64; + + typedef __u64 xfs_off_t; + //typedef __s32 xfs32_off_t; diff --git a/sys-block/partimage/files/partimage-0.6.4-fflush-before-re-read-partition-table.patch b/sys-block/partimage/files/partimage-0.6.4-fflush-before-re-read-partition-table.patch new file mode 100644 index 000000000000..f60a5bc27489 --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.4-fflush-before-re-read-partition-table.patch @@ -0,0 +1,11 @@ +--- partimage-0.6.4/src/client/misc.cpp.pix 2004-02-05 21:19:00.000000000 +0100 ++++ partimage-0.6.4/src/client/misc.cpp 2005-01-21 11:43:19.439462188 +0100 +@@ -294,6 +294,8 @@ + nRes = fwrite(mbrOriginal[dwOriginalMbrNb].cData+MBR_SIZE_BOOT, MBR_SIZE_TABLE+2, 1, fDevice); // table + 0xAA55 + } + ++ fflush(fDevice); ++ + // re-read partition table + if (ioctl(fileno(fDevice), BLKRRPART)) + { diff --git a/sys-block/partimage/files/partimage-0.6.4-lib64.patch b/sys-block/partimage/files/partimage-0.6.4-lib64.patch new file mode 100644 index 000000000000..19bbf154c4b8 --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.4-lib64.patch @@ -0,0 +1,44 @@ +--- partimage-0.6.4/src/client/Makefile.am.chris 2005-03-29 13:34:39.129627648 +0200 ++++ partimage-0.6.4/src/client/Makefile.am 2005-03-29 13:34:49.238090928 +0200 +@@ -33,7 +33,7 @@ + mbr_backup.cpp + + # all libs are added in LIBS, we needn't add them to partimage_LDADD +-partimage_LDADD = -L/usr/lib -lslang fs/libfs.a ../shared/libshared.a ++partimage_LDADD = -L$(libdir) -lslang fs/libfs.a ../shared/libshared.a + partimage_LDFLAGS = @PARTIMAGE_LDFLAGS@ + + DEFS=@DEFS@ -DLOCALEDIR=\"${localedir}\" -D_REENTRANT -D_FILE_OFFSET_BITS=64 +--- partimage-0.6.4/src/client/Makefile.in.chris 2005-03-29 13:33:23.625106080 +0200 ++++ partimage-0.6.4/src/client/Makefile.in 2005-03-29 13:33:53.689535592 +0200 +@@ -253,7 +253,7 @@ + + + # all libs are added in LIBS, we needn't add them to partimage_LDADD +-partimage_LDADD = -L/usr/lib -lslang fs/libfs.a ../shared/libshared.a ++partimage_LDADD = -L$(libdir) -lslang fs/libfs.a ../shared/libshared.a + partimage_LDFLAGS = @PARTIMAGE_LDFLAGS@ + MAINTAINERCLEANFILES = Makefile.in + all: all-recursive +--- partimage-0.6.4/src/server/Makefile.am.chris 2005-03-29 13:34:55.995063712 +0200 ++++ partimage-0.6.4/src/server/Makefile.am 2005-03-29 13:35:05.279652240 +0200 +@@ -21,7 +21,7 @@ + partimaged-gui_dummy.h partimaged-gui_newt.h partimaged.h + + #partimaged_LDADD = -L/usr/lib -lz -lbz2 -lnewt -lpthread -lcrypt -lslang -lcom_err -lext2fs ../shared/libshared.a +-partimaged_LDADD = -L/usr/lib -lslang ../shared/libshared.a ++partimaged_LDADD = -L$(libdir) -lslang ../shared/libshared.a + + partimaged_LDFLAGS = @PARTIMAGE_LDFLAGS@ + +--- partimage-0.6.4/src/server/Makefile.in.chris 2005-03-29 13:34:10.496980472 +0200 ++++ partimage-0.6.4/src/server/Makefile.in 2005-03-29 13:34:32.172685264 +0200 +@@ -231,7 +231,7 @@ + + + #partimaged_LDADD = -L/usr/lib -lz -lbz2 -lnewt -lpthread -lcrypt -lslang -lcom_err -lext2fs ../shared/libshared.a +-partimaged_LDADD = -L/usr/lib -lslang ../shared/libshared.a ++partimaged_LDADD = -L$(libdir) -lslang ../shared/libshared.a + partimaged_LDFLAGS = @PARTIMAGE_LDFLAGS@ + MAINTAINERCLEANFILES = Makefile.in + all: all-am diff --git a/sys-block/partimage/files/partimage-0.6.4-save_all_and_rest_all_actions.patch b/sys-block/partimage/files/partimage-0.6.4-save_all_and_rest_all_actions.patch new file mode 100644 index 000000000000..581373e8ceaa --- /dev/null +++ b/sys-block/partimage/files/partimage-0.6.4-save_all_and_rest_all_actions.patch @@ -0,0 +1,335 @@ +--- partimage-0.6.4/src/client/main.cpp.pix 2004-02-04 01:57:36.000000000 +0100 ++++ partimage-0.6.4/src/client/main.cpp 2005-01-24 13:46:19.388390009 +0100 +@@ -142,6 +142,7 @@ + int nChoice; + char szDevice[MAX_DEVICENAMELEN]; + char szImageFile[MAXPATHLEN]; ++ char szImageDir[MAXPATHLEN]; + char szTemp[2048]; + char szTemp2[1024]; + char szTemp3[1024]; +@@ -505,13 +506,17 @@ + if (argc - optind == 2) // commands with 1 parameter + { + showDebug(8, "full cmdline with 1 param\n"); +- strncpy(szImageFile, argv[optind+1], MAXPATHLEN); +- + if (strcmp(argv[optind], "restmbr")==0) // restore an MBR + nChoice = OPERATION_RESTMBR; + else if (strcmp(argv[optind], "imginfo")==0) + // show informations about the imagefile + nChoice = OPERATION_IMGINFO; ++ else if (strcmp(argv[optind], "save_all")==0) ++ nChoice = OPERATION_SAVE_ALL; ++ else if (strcmp(argv[optind], "rest_all")==0) ++ nChoice = OPERATION_REST_ALL; ++ ++ strncpy(nChoice == OPERATION_REST_ALL || nChoice == OPERATION_SAVE_ALL ? szImageDir : szImageFile, argv[optind+1], MAXPATHLEN); + } + + // check options +@@ -644,6 +649,38 @@ + nRes = -1; + } + break; ++ ++ case OPERATION_SAVE_ALL: ++ showDebug(1, "action=SAVE_ALL\n"); ++ try { save_all(szImageDir, &options); } ++ catch (CExceptions *excep) ++ { ++ showDebug(1, "caught exception: %d\n", excep->GetExcept()); ++ ++ if (!options.bBatchMode && !excep->getCaught()) ++ g_interface -> Error(excep, szImageFile); ++ ++ showDebug(1, "\nFINAL ERROR\n\n"); ++ ++ nRes = -1; ++ } ++ break; ++ ++ case OPERATION_REST_ALL: ++ showDebug(1, "action=REST_ALL\n"); ++ try { rest_all(szImageDir, &options); } ++ catch (CExceptions *excep) ++ { ++ showDebug(1, "caught exception: %d\n", excep->GetExcept()); ++ ++ if (!options.bBatchMode && !excep->getCaught()) ++ g_interface -> Error(excep, szImageFile); ++ ++ showDebug(1, "\nFINAL ERROR\n\n"); ++ ++ nRes = -1; ++ } ++ break; + + default: // exit + if (options.bSync) +--- partimage-0.6.4/src/client/misc.cpp.pix 2005-01-24 13:46:19.382388046 +0100 ++++ partimage-0.6.4/src/client/misc.cpp 2005-01-24 14:39:16.454532386 +0100 +@@ -2274,3 +2274,231 @@ + strcpy(szFileSystem, "befs"); + RETURN_int(FS_BEFS); + } ++ ++static int str_begins_with(const char *s, const char *prefix) ++{ ++ return strncmp(s, prefix, strlen(prefix)) == 0; ++} ++ ++static char *sfdisk_line_to_disk_device(const char *line) ++{ ++ static const char *new_disk_prefix = "# partition table of "; ++ if (str_begins_with(line, new_disk_prefix)) { ++ const char *device = line + strlen(new_disk_prefix); ++ return strndup(device, strlen(device) - 1); ++ } else { ++ return NULL; ++ } ++} ++ ++static char *sfdisk_line_to_partition_device(const char *line) ++{ ++ if (char *p = strchr(line, ':')) { ++ while (p[-1] == ' ' && p > line) p--; ++ return strndup(line, p - line); ++ } else { ++ return NULL; ++ } ++} ++ ++static char *full_device_to_device(char *device) ++{ ++ char *p; ++ if (str_begins_with(device, "/dev/")) { ++ p = device + strlen("/dev/"); ++ } else { ++ showDebug(2, "full_device_to_device: weird device %s\n", device); ++ p = strrchr(device, '/'); ++ p = p ? p + 1 : device; ++ } ++ p = strdup(p); ++ char *q; ++ while (q = strchr(p, '/')) *q = '_'; ++ ++ return p; ++} ++ ++static void my_pclose(FILE *f) ++{ ++ int status = pclose(f); ++ if (status != 0) showDebug(1, "ERROR: command failed (%d)\n", status); ++} ++ ++static void write_unsigned(CImage *image, unsigned int nb) ++{ ++ image->write((char *) &nb, sizeof(nb), true); ++} ++static void write_string(CImage *image, const char *s) ++{ ++ unsigned int len = strlen(s); ++ write_unsigned(image, len); ++ image->write((void *) s, len, true); ++} ++static unsigned int read_unsigned(CImage *image) ++{ ++ unsigned int nb; ++ image->read((char *) &nb, sizeof(nb), true); ++ return nb; ++} ++static char *read_string(CImage *image) ++{ ++ unsigned int len = read_unsigned(image); ++ if (len == 0) return NULL; ++ char *s = (char *) malloc(len + 1); ++ image->read(s, len, true); ++ s[len] = '\0'; ++ return s; ++} ++ ++void save_all(char *szImageDir, COptions *options) ++{ ++ BEGIN; ++ ++ char *sfdisk[1024]; ++ unsigned int sfdisk_nb_lines = 0; ++ { ++ FILE *f = popen("LC_ALL=C sfdisk -d", "r"); ++ char tmp[1024]; ++ ++ while (1) { ++ if (!fgets(tmp, sizeof(tmp), f)) break; ++ if (sfdisk_nb_lines >= sizeof(sfdisk)) break; ++ sfdisk[sfdisk_nb_lines++] = strdup(tmp); ++ } ++ my_pclose(f); ++ } ++ ++ char aux[MAXPATHLEN]; ++ CImage image(options); ++ SNPRINTF(aux, "%s/sfdisk.lst", szImageDir); ++ image.set_szImageFilename(aux); ++ image.openWriting(); ++ ++ write_unsigned(&image, sfdisk_nb_lines); ++ ++ for (unsigned int i = 0; i < sfdisk_nb_lines; i++) ++ write_string(&image, sfdisk[i]); ++ ++ for (unsigned int i = 0; i < sfdisk_nb_lines; i++) ++ if (char *device = sfdisk_line_to_disk_device(sfdisk[i])) { ++ showDebug(2, "opening %s to get its MBR\n", device); ++ FILE *f = fopen(device, "r"); ++ char mbr[512]; ++ if (f && fread(mbr, 512, 1, f) == 1) { ++ write_string(&image, device); ++ image.write(mbr, sizeof(mbr), true); ++ } else ++ showDebug(1, "ERROR: can't read MBR of device %s\n", device); ++ if (f) fclose(f); ++ } ++ write_unsigned(&image, 0); ++ ++ closeFilesSave(false, *options, &image, NULL); ++ ++ COptions save_part_options(*options); ++ save_part_options.qwSplitSize = 0; ++ save_part_options.bAskDesc = false; ++ save_part_options.bBackupMBR = false; ++ save_part_options.bCheckBeforeSaving = false; // checking always find an error, so... ++ ++ for (unsigned int i = 0; i < sfdisk_nb_lines; i++) { ++ if (!strstr(sfdisk[i], "Id=83")) continue; ++ ++ char *device = sfdisk_line_to_partition_device(sfdisk[i]); ++ if (!device) continue; ++ ++ char *short_device = full_device_to_device(device); ++ SNPRINTF(aux, "%s/part_%s", szImageDir, short_device); ++ free(short_device); ++ showDebug(1, "savePartition(%s, %s, ...)\n", device, aux); ++ savePartition(device, aux, &save_part_options); ++ ++ free(device); ++ } ++ ++ RETURN; ++} ++ ++void rest_all(char *szImageDir, COptions *options) ++{ ++ BEGIN; ++ ++ char **sfdisk; ++ unsigned int sfdisk_nb_lines = 0; ++ ++ char aux[MAXPATHLEN]; ++ CImage image(options); ++ ++ { ++ SNPRINTF(aux, "%s/sfdisk.lst", szImageDir); ++ image.set_szImageFilename(aux); ++ image.openReading(); ++ ++ sfdisk_nb_lines = read_unsigned(&image); ++ showDebug(2, "rest_all got sfdisk_nb_lines = %d\n", sfdisk_nb_lines); ++ sfdisk = (char **) alloca(sizeof(char *) * sfdisk_nb_lines); ++ for (unsigned int i = 0; i < sfdisk_nb_lines; i++) { ++ sfdisk[i] = read_string(&image); ++ showDebug(2, "rest_all got line = %s\n", sfdisk[i]); ++ } ++ while (1) { ++ char *device = read_string(&image); ++ if (!device) break; ++ ++ char mbr[512]; ++ image.read(mbr, 512, true); ++ ++ FILE *f = fopen(device, "r+b"); ++ if (f && fwrite(mbr, 512, 1, f) == 1) ++ showDebug(1, "MBR of %s restored\n", device); ++ else ++ showDebug(1, "ERROR: restoring MBR of device %s failed: %s\n", device, strerror(errno)); ++ if (f) fclose(f); ++ } ++ ++ // since sfdisk.lst is not really nice to the library, we can't close the thread from procReadBufferFromImage which has already exited ++ image.closeReading(false); ++ } ++ ++ { ++ FILE *f = NULL; ++ for (unsigned int i = 0; i < sfdisk_nb_lines; i++) { ++ if (char *device = sfdisk_line_to_disk_device(sfdisk[i])) { ++ if (f) my_pclose(f); ++ SNPRINTF(aux, "sfdisk %s >>" PARTIMAGE_LOG " 2>>" PARTIMAGE_LOG, device); ++ showDebug(1, "calling %s\n", aux); ++ f = popen(aux, "w"); ++ free(device); ++ } ++ if (f) ++ fputs(sfdisk[i], f); ++ else ++ showDebug(1, "dropping line: %s", sfdisk[i]); ++ } ++ if (f) my_pclose(f); ++ } ++ ++ for (unsigned int i = 0; i < sfdisk_nb_lines; i++) { ++ ++ char *device = sfdisk_line_to_partition_device(sfdisk[i]); ++ if (!device) continue; ++ ++ if (strstr(sfdisk[i], "Id=83")) { ++ char *short_device = full_device_to_device(device); ++ SNPRINTF(aux, "%s/part_%s", szImageDir, short_device); ++ free(short_device); ++ if (image.getImageDisk()->doesFileExists(aux)) { ++ showDebug(1, "restorePartition(%s, %s, ...)\n", device, aux); ++ restorePartition(device, aux, options); ++ } else ++ showDebug(1, "no such %s image disk, not restoring it\n", aux); ++ } else if (strstr(sfdisk[i], "Id=82")) { ++ SNPRINTF(aux, "mkswap %s >>" PARTIMAGE_LOG, device); ++ showDebug(2, "%s\n", aux); ++ system(aux); ++ } ++ free(device); ++ } ++ ++ RETURN; ++} +--- partimage-0.6.4/src/client/misc.h.pix 2004-02-04 01:57:36.000000000 +0100 ++++ partimage-0.6.4/src/client/misc.h 2005-01-24 13:46:19.390390663 +0100 +@@ -47,6 +47,8 @@ + void savePartition(char *szDevice, char *szImageName, /*char *szFilesystem, */COptions *options); + void restorePartition(char *szDevice, char *szImageName, COptions *options); + void restoreMbr(char *szImageFile, COptions *options); ++void save_all(char *szImageDir, COptions *options); ++void rest_all(char *szImageDir, COptions *options); + + // ======================================================= + void closeFilesSave(bool on_error, COptions options, CImage *image, FILE *fDeviceFile); +--- partimage-0.6.4/src/client/partimage.h.pix 2004-02-04 01:57:36.000000000 +0100 ++++ partimage-0.6.4/src/client/partimage.h 2005-01-24 13:46:19.390390663 +0100 +@@ -94,6 +94,8 @@ + #define OPERATION_RESTMBR 3 + #define OPERATION_IMGINFO 4 + #define OPERATION_EXIT 5 ++#define OPERATION_SAVE_ALL 6 ++#define OPERATION_REST_ALL 7 + + // returned by CExceptionsGUI::windowError + // user canceled the job +--- partimage-0.6.4/src/shared/image_disk.cpp.pix 2004-02-04 01:57:36.000000000 +0100 ++++ partimage-0.6.4/src/shared/image_disk.cpp 2005-01-24 13:46:19.391390990 +0100 +@@ -526,6 +526,7 @@ + + SNPRINTF(szShortName, "pi%.8lx", (DWORD)generateIdentificator()); + extractFilepathFromFullPath(m_szImageFilename, szPathDir); // filepath without filename ++ if (access(szPathDir, R_OK) == -1) mkdir(szPathDir, 0755); + snprintf(m_szSpaceFilename, MAXPATHLEN, "%s/%8s.tmp", szPathDir, szShortName); + showDebug(1, "TEMP=[%s]\n", m_szSpaceFilename); + diff --git a/sys-block/partimage/partimage-0.6.4-r3.ebuild b/sys-block/partimage/partimage-0.6.4-r3.ebuild new file mode 100644 index 000000000000..29ed9640b287 --- /dev/null +++ b/sys-block/partimage/partimage-0.6.4-r3.ebuild @@ -0,0 +1,144 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-block/partimage/partimage-0.6.4-r3.ebuild,v 1.1 2005/03/31 20:57:46 xmerlin Exp $ + +inherit gnuconfig eutils flag-o-matic + +DESCRIPTION="Console-based application to efficiently save raw partition data to an image file. Optional encryption/compression support." +HOMEPAGE="http://www.partimage.org/" +SRC_URI="mirror://sourceforge/partimage/${P}.tar.bz2" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="ssl nologin nls" + +DEPEND="${RDEPEND} sys-devel/autoconf" + +RDEPEND="virtual/libc + >=sys-libs/zlib-1.1.4 + >=dev-libs/lzo-1.08 + >=dev-libs/newt-0.50.35-r1 + app-arch/bzip2 + >=sys-libs/slang-1.4.5-r2 + nls? ( sys-devel/gettext ) + ssl? ( >=dev-libs/openssl-0.9.6g )" + +PARTIMAG_GROUP_GID=91 +PARTIMAG_USER_UID=91 +PARTIMAG_GROUP_NAME=partimag +PARTIMAG_USER_NAME=partimag +PARTIMAG_USER_SH=/bin/false +PARTIMAG_USER_HOMEDIR=/var/log/partimage +PARTIMAG_USER_GROUPS=partimag + +pkg_setup() { + # Now add users if needed + enewgroup ${PARTIMAG_GROUP_NAME} ${PARTIMAG_GROUP_GID} + enewuser ${PARTIMAG_USER_NAME} ${PARTIMAG_USER_UID} ${PARTIMAG_USER_SH} ${PARTIMAG_USER_HOMEDIR} ${PARTIMAG_USER_GROUPS} +} + +src_unpack() { + unpack ${A} + cd ${S} + + # we can do better security ourselves + epatch ${FILESDIR}/${P}-nodumbpermchecks.diff || die + epatch ${FILESDIR}/${P}-chown.patch || die + epatch ${FILESDIR}/${P}-not_install_info.patch || die + epatch ${FILESDIR}/${P}-fixserverargs.diff || die + epatch ${FILESDIR}/${P}-lib64.patch || die + epatch ${FILESDIR}/${P}-fflush-before-re-read-partition-table.patch || die + epatch ${FILESDIR}/${P}-LP64-fixes.patch || die + epatch ${FILESDIR}/${P}-save_all_and_rest_all_actions.patch || die +} + +src_compile() { + filter-flags -fno-exceptions + + local myconf + use nologin && myconf="${myconf} --disable-login" + + econf \ + ${myconf} \ + `use_enable ssl` \ + `use_enable nls`|| die "econf failed" + + emake || die +} + +src_install() { + einstall \ + MKINSTALLDIRS=/usr/share/automake-1.8/mkinstalldirs || die + + keepdir /var/log/partimage + + insinto /etc/partimaged; doins ${FILESDIR}/servercert.cnf || die + + # init.d / conf.d + exeinto /etc/init.d ; newexe ${FILESDIR}/${PN}d.init ${PN}d || die + insinto /etc/conf.d ; newins ${FILESDIR}/${PN}d.conf ${PN}d || die + + doman debian/partimage.1 debian/partimaged.8 ${FILESDIR}/partimagedusers.5 || die + dodoc AUTHORS BUGS COPYING ChangeLog INSTALL README* TODO partimage.lsm +} + +# vars for SSL stuff +confdir="${ROOT}etc/partimaged" +privkey="${confdir}/partimaged.key" +cnf="${confdir}/servercert.cnf" +csr="${confdir}/partimaged.csr" +cert="${confdir}/partimaged.cert" + +pkg_config() { + if use ssl; then + ewarn "Please customize /etc/partimaged/servercert.cnf before you continue!" + ewarn "Press Ctrl-C to break now for it, or press enter to continue." + read + if [ ! -f ${privkey} ]; then + einfo "Generating unencrypted private key: ${privkey}" + openssl genrsa -out ${privkey} 1024 || die "Failed!" + else + einfo "Private key already exists: ${privkey}" + fi + if [ ! -f ${csr} ]; then + einfo "Generating certificate request: ${csr}" + openssl req -new -x509 -outform PEM -out ${csr} -key ${privkey} -config ${cnf} || die "Failed!" + else + einfo "Certificate request already exists: ${csr}" + fi + if [ ! -f ${cert} ]; then + einfo "Generating self-signed certificate: ${cert}" + openssl x509 -in ${csr} -out ${cert} -signkey ${privkey} || die "Failed!" + else + einfo "Self-signed certifcate already exists: ${cert}" + fi + einfo "Setting permissions" + partimagesslperms || die "Failed!" + einfo "Done" + else + einfo "SSL is disabled, not building certificates" + fi +} + +partimagesslperms() { + local ret=0 + chmod 600 ${privkey} 2>/dev/null + ret=$((${ret}+$?)) + chown partimag:root ${privkey} 2>/dev/null + ret=$((${ret}+$?)) + chmod 644 ${cert} ${csr} 2>/dev/null + ret=$((${ret}+$?)) + chown root:root ${cert} ${csr} 2>/dev/null + ret=$((${ret}+$?)) + return $ret +} + +pkg_postinst() { + if use ssl; then + einfo "To create the required SSL certificates, please do:" + einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" + # force a permmissions fixup + partimagesslperms + return 0 + fi +} |