summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorDmitry Marakasov <amdmi3@FreeBSD.org>2013-09-14 10:54:57 +0000
committerDmitry Marakasov <amdmi3@FreeBSD.org>2013-09-14 10:54:57 +0000
commit155f07275f594784e9f95649f35f50469ec6450d (patch)
treec9fb6dfbe55be58579591644eb801e41f12eefd6 /sysutils
parentRemove USE_GCC=any as it works properly with clang (diff)
- Re-add sysutils/gpart, another useful port removed with no reason
A port of a tool which tries to guess the primary partition table of a PC-type hard disk in case the primary partition table in sector 0 is damaged, incorrect or deleted. The guessed table can be written to a file or device. Supported (guessable) filesystem or partition types: DOS/Windows FAT, Linux ext2 and swap, OS/2 HPFS, Windows NTFS, FreeBSD and Solaris/x86 disklabels, Minix FS, Reiser FS WWW: http://brzitwa.de/mb/gpart/index.html (outdated)
Notes
Notes: svn path=/head/; revision=327267
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/gpart/Makefile31
-rw-r--r--sysutils/gpart/distinfo2
-rw-r--r--sysutils/gpart/files/patch-inst.defs13
-rw-r--r--sysutils/gpart/files/patch-make.defs16
-rw-r--r--sysutils/gpart/files/patch-man__gpart.man11
-rw-r--r--sysutils/gpart/files/patch-src__disku.c45
-rw-r--r--sysutils/gpart/files/patch-src__gm_bsddl.h11
-rw-r--r--sysutils/gpart/files/patch-src__gm_ntfs.h34
-rw-r--r--sysutils/gpart/files/patch-src__gpart.h42
-rw-r--r--sysutils/gpart/pkg-descr9
11 files changed, 215 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 1dc032a30b6a..9818f78101e6 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -342,6 +342,7 @@
SUBDIR += gnomebaker
SUBDIR += goaccess
SUBDIR += gosa
+ SUBDIR += gpart
SUBDIR += gpkgdep
SUBDIR += gpte
SUBDIR += graid5
diff --git a/sysutils/gpart/Makefile b/sysutils/gpart/Makefile
new file mode 100644
index 000000000000..75eb4d8b1b53
--- /dev/null
+++ b/sysutils/gpart/Makefile
@@ -0,0 +1,31 @@
+# Created by: Andrew Stevenson <andrew@ugh.net.au>
+# $FreeBSD$
+
+PORTNAME= gpart
+PORTVERSION= 0.1h
+PORTREVISION= 2
+CATEGORIES= sysutils
+MASTER_SITES= SUNSITE/system/filesystems \
+ http://mirror.amdmi3.ru/distfiles/
+
+MAINTAINER= amdmi3@FreeBSD.org
+COMMENT= Tries to recover lost partition tables and file systems
+
+LICENSE= GPLv2
+
+USES= gmake
+MAN8= gpart.8
+PLIST_FILES= sbin/gpart
+CFLAGS+= -std=c99
+
+.if defined(WANT_STATIC)
+MAKE_ARGS+= LDFLAGS=-static
+.endif
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} != "i386" && ${ARCH} != "alpha" && ${ARCH} != "amd64"
+BROKEN= Only compiles on i386, amd64 and alpha.
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/gpart/distinfo b/sysutils/gpart/distinfo
new file mode 100644
index 000000000000..b8e12710654c
--- /dev/null
+++ b/sysutils/gpart/distinfo
@@ -0,0 +1,2 @@
+SHA256 (gpart-0.1h.tar.gz) = b542bceb1a778c719304dadae5dbc2a8bd7f195c06774933e7255b98cfa46ee3
+SIZE (gpart-0.1h.tar.gz) = 52357
diff --git a/sysutils/gpart/files/patch-inst.defs b/sysutils/gpart/files/patch-inst.defs
new file mode 100644
index 000000000000..cb69167258d3
--- /dev/null
+++ b/sysutils/gpart/files/patch-inst.defs
@@ -0,0 +1,13 @@
+--- ./inst.defs.orig 2000-12-13 23:45:49.000000000 +0100
++++ ./inst.defs 2011-03-17 01:15:54.000000000 +0100
+@@ -1,8 +1,8 @@
+ #
+ # installation directories for gpart
+ #
+-prefix=/usr/local
+-bindir=$(prefix)/bin
++prefix=$(PREFIX)
++bindir=$(prefix)/sbin
+ libdir=$(prefix)/lib
+ mandir=$(prefix)/man
+ manext=8
diff --git a/sysutils/gpart/files/patch-make.defs b/sysutils/gpart/files/patch-make.defs
new file mode 100644
index 000000000000..9468e5c82f3d
--- /dev/null
+++ b/sysutils/gpart/files/patch-make.defs
@@ -0,0 +1,16 @@
+--- ./make.defs.orig 2001-01-29 20:17:12.000000000 +0100
++++ ./make.defs 2011-03-17 01:15:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ #
+ #
+ #
+-CC = gcc
+-CFLAGS = -Wall -O2 -pedantic
++CC ?= gcc
++CFLAGS += -Wall -pedantic
+ LDFLAGS =
+-MAKEDEP = gcc -M
++MAKEDEP = $(CC) -M
+ INSTALL = install
+ RM = rm -f
+ #
diff --git a/sysutils/gpart/files/patch-man__gpart.man b/sysutils/gpart/files/patch-man__gpart.man
new file mode 100644
index 000000000000..845d168fc756
--- /dev/null
+++ b/sysutils/gpart/files/patch-man__gpart.man
@@ -0,0 +1,11 @@
+--- ./man/gpart.man.orig 2001-02-07 18:54:18.000000000 +0100
++++ ./man/gpart.man 2011-03-17 01:15:54.000000000 +0100
+@@ -378,7 +378,7 @@
+ drive without starting the scan loop in FreeBSD type
+
+ .RS
+-gpart -vvd /dev/wd2
++gpart -vvd /dev/ad2
+ .RE
+ .RE
+
diff --git a/sysutils/gpart/files/patch-src__disku.c b/sysutils/gpart/files/patch-src__disku.c
new file mode 100644
index 000000000000..19605f19fb39
--- /dev/null
+++ b/sysutils/gpart/files/patch-src__disku.c
@@ -0,0 +1,45 @@
+--- ./src/disku.c.orig 2001-02-07 20:04:07.000000000 +0100
++++ ./src/disku.c 2011-03-17 01:15:54.000000000 +0100
+@@ -28,7 +28,9 @@
+
+ #if defined(__FreeBSD__)
+ #include <errno.h>
++#include <sys/param.h>
+ #include <sys/disklabel.h>
++#include <sys/disk.h>
+ #endif
+
+
+@@ -61,12 +63,26 @@
+ #endif
+
+ #if defined(__FreeBSD__)
+- struct disklabel dl;
+- if (ioctl(d->d_fd,DIOCGDINFO,&dl) == -1)
+- pr(FATAL,EM_IOCTLFAILED,"DIOCGDINFO",strerror(errno));
+- g.d_c = dl.d_ncylinders;
+- g.d_h = dl.d_ntracks;
+- g.d_s = dl.d_nsectors;
++ struct disklabel loclab;
++ u_int u;
++ off_t o; /* total disk size */
++
++ if (ioctl(d->d_fd, DIOCGFWSECTORS, &u) == 0)
++ g.d_s = u;
++ else
++ pr(FATAL, EM_IOCTLFAILED, "DIOCGFWSECTORS", strerror(errno));
++ // loclab.d_nsectors = 63;
++ if (ioctl(d->d_fd, DIOCGFWHEADS, &u) == 0)
++ g.d_h = u;
++ else
++ pr(FATAL, EM_IOCTLFAILED, "DIOCGFWHEADS", strerror(errno));
++ if (ioctl(d->d_fd, DIOCGSECTORSIZE, &u) == 0)
++ if (u != 512)
++ pr(FATAL, "sector size not a multiple of 512");
++ if (ioctl(d->d_fd, DIOCGMEDIASIZE, &o))
++ pr(FATAL, EM_IOCTLFAILED, "DIOCGMEDIASIZE", strerror(errno));
++
++ g.d_c = o / u / g.d_h / g.d_s;
+ #endif
+
+ return (&g);
diff --git a/sysutils/gpart/files/patch-src__gm_bsddl.h b/sysutils/gpart/files/patch-src__gm_bsddl.h
new file mode 100644
index 000000000000..c1179a38a618
--- /dev/null
+++ b/sysutils/gpart/files/patch-src__gm_bsddl.h
@@ -0,0 +1,11 @@
+--- ./src/gm_bsddl.h.orig 2000-12-13 23:54:31.000000000 +0100
++++ ./src/gm_bsddl.h 2011-03-17 01:15:54.000000000 +0100
+@@ -28,7 +28,7 @@
+
+ #define BBSIZE 8192 /* size of boot area, with label */
+
+-#ifdef __i386__
++#if defined(__i386__) || defined(__amd64__)
+ #define LABELSECTOR 1 /* sector containing label */
+ #define LABELOFFSET 0 /* offset of label in sector */
+ #endif
diff --git a/sysutils/gpart/files/patch-src__gm_ntfs.h b/sysutils/gpart/files/patch-src__gm_ntfs.h
new file mode 100644
index 000000000000..af5e4ea2fa4a
--- /dev/null
+++ b/sysutils/gpart/files/patch-src__gm_ntfs.h
@@ -0,0 +1,34 @@
+--- ./src/gm_ntfs.h.orig 2001-01-29 21:33:58.000000000 +0100
++++ ./src/gm_ntfs.h 2011-03-17 01:15:54.000000000 +0100
+@@ -29,17 +29,16 @@
+ /* 'NTFS' in little endian */
+ #define NTFS_SUPER_MAGIC 0x5346544E
+
+-#if defined(i386) || defined(__i386__) || defined(__alpha__)
++#include <stdint.h>
+
+ /* unsigned integral types */
+ #ifndef NTFS_INTEGRAL_TYPES
+ #define NTFS_INTEGRAL_TYPES
+-typedef unsigned char ntfs_u8;
+-typedef unsigned short ntfs_u16;
+-typedef unsigned int ntfs_u32;
+-typedef s64_t ntfs_u64;
++typedef uint8_t ntfs_u8;
++typedef uint16_t ntfs_u16;
++typedef uint32_t ntfs_u32;
++typedef uint64_t ntfs_u64;
+ #endif /* NTFS_INTEGRAL_TYPES */
+-#endif /* defined(i386) || defined(__i386__) || defined(__alpha__) */
+
+
+ /* Macros reading unsigned integers from a byte pointer */
+@@ -53,8 +52,5 @@
+ /* Macros reading signed integers, returning int */
+ #define NTFS_GETS8(p) ((int)(*(char*)(p)))
+ #define NTFS_GETS16(p) ((int)(*(short*)(p)))
+-#define NTFS_GETS24(p) (NTFS_GETU24(p) < 0x800000 ? (int)NTFS_GETU24(p) :
+-
+-
+
+ #endif /* _GM_NTFS_H */
diff --git a/sysutils/gpart/files/patch-src__gpart.h b/sysutils/gpart/files/patch-src__gpart.h
new file mode 100644
index 000000000000..07771ea1c33a
--- /dev/null
+++ b/sysutils/gpart/files/patch-src__gpart.h
@@ -0,0 +1,42 @@
+--- ./src/gpart.h.orig 2001-01-31 00:07:29.000000000 +0100
++++ ./src/gpart.h 2011-03-17 01:15:54.000000000 +0100
+@@ -22,8 +22,9 @@
+
+ #define PROGRAM "gpart"
+
++#include <stdint.h>
+
+-typedef unsigned char byte_t;
++typedef uint8_t byte_t;
+
+
+
+@@ -31,7 +32,7 @@
+ * endianness (incomplete, later)
+ */
+
+-#if defined(__i386__) || defined(__alpha__)
++#if defined(__i386__) || defined(__amd64__) || defined(__alpha__)
+ # define le16(x) (x) /* x as little endian */
+ # define be16(x) ((((x)&0xff00)>>8) | \
+ (((x)&0x00ff)<<8))
+@@ -112,8 +113,8 @@
+ byte_t p_ehd; /* end head */
+ byte_t p_esect; /* end sector */
+ byte_t p_ecyl; /* end cylinder */
+- unsigned long p_start; /* start sector (absolute) */
+- unsigned long p_size; /* # of sectors */
++ uint32_t p_start; /* start sector (absolute) */
++ uint32_t p_size; /* # of sectors */
+ } dos_part_entry;
+
+
+@@ -123,7 +124,7 @@
+ byte_t _align[2];
+ byte_t t_boot[DOSPARTOFF];
+ dos_part_entry t_parts[NDOSPARTS];
+- unsigned short t_magic; /* DOSPTMAGIC */
++ uint16_t t_magic; /* DOSPTMAGIC */
+ } dos_part_table;
+
+
diff --git a/sysutils/gpart/pkg-descr b/sysutils/gpart/pkg-descr
new file mode 100644
index 000000000000..8e6da0e5c8c2
--- /dev/null
+++ b/sysutils/gpart/pkg-descr
@@ -0,0 +1,9 @@
+A port of a tool which tries to guess the primary partition table of a PC-type
+hard disk in case the primary partition table in sector 0 is damaged, incorrect
+or deleted. The guessed table can be written to a file or device.
+
+Supported (guessable) filesystem or partition types: DOS/Windows FAT, Linux
+ext2 and swap, OS/2 HPFS, Windows NTFS, FreeBSD and Solaris/x86 disklabels,
+Minix FS, Reiser FS
+
+WWW: http://brzitwa.de/mb/gpart/index.html (outdated)