Commit Graph

8636 Commits

Author SHA1 Message Date
Helmut Grohne e71b0aadaa build-sys: check for libtoolize rather than libtool
The system libtool program has architecture dependent behaviour. It is
therefore unavailable in cross build environments. The only place it was
used in util-linux is autogen.sh to determine the availability of
libtool. All other places correctly use libtoolize or
$(top_builddir)/libtool.

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
2014-10-14 12:04:11 +02:00
Benno Schulenberg 9ed38607d7 textual: grammarize an informative message, and tweak some comments
Also add two clarifying comments for translators.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-14 12:03:56 +02:00
Søren Holm 10e1d2e5f7 libmount: provide version as int for better compiletime test
Signed-off-by: Søren Holm <sgh@sgh.dk>
2014-10-14 12:03:54 +02:00
Karel Zak 33ecab2b9c dmesg: improve reltime colors
[  +0.004034] sd 113:0:0:0: [sdb] Attached SCSI disk
[Oct10 13:04]  sdb: unknown partition table
[  +0.034011]  sdb: sdb1 sdb2 sdb3 sdb4 < sdb5 sdb6 >

.. the "Oct10 13:04" is possible to colorize by "timebreak"
scheme (default is bold green).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 10:20:19 +02:00
Karel Zak 3692c28d06 tests: add PMBR sfdisk test
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-13 13:30:28 +02:00
Karel Zak 0aa57f1868 tests: add sfdisk GPT tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-10 12:56:45 +02:00
Karel Zak 2ce7b95985 libfdisk: fix script next_token()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-10 12:53:12 +02:00
Karel Zak 90dc69e40a sfdisk: leave on error
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-10 12:52:24 +02:00
Karel Zak 2d2cb0251d libfdisk: make script header parser more pedantic
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-10 12:24:10 +02:00
Karel Zak 9368018ff0 tests: test cazy sizes for sfdisk
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 14:08:59 +02:00
Karel Zak 28d79d9b0d libfdisk: (dos) reset logical partition stuff after error
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 14:03:45 +02:00
Karel Zak 2f34f1c77f tests: update sfdisk tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 13:21:04 +02:00
Karel Zak 8f48195846 libfdisk: cleanup script dump
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 13:03:52 +02:00
Karel Zak 05af8bd4f0 sfdisk: ask on EOF
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:23:59 +02:00
Karel Zak bcdeacd796 libfdisk: (dos) follow explicit sizes
* this patch add to dos driver support for fdisk_partition->size_explicit
  to avoid unexpected last sector alignment for sizes explicitly specified
  in sectors

* add support for small "first LBA", the current default is to use
  1MiB offset for the first partition and for each EBR. This is not
  backwardly compatible and it makes impossible to apply sfdisk
  scripts/dumps from old systems, because original offset can be
  smaller than 2048 sectors (old sfdisk default is 1 sector).

  The solution is on the fly to detect this situation and change
  fdisk_context->first_lba to 1 sector. Nasty.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:10:36 +02:00
Karel Zak 18b266cea3 libfdisk: (gpt) follow explicit size, fiz size+1 buf
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:10:09 +02:00
Karel Zak 9b0b9fb1bf libfdisk: follow explicitly specified partition size
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:09:07 +02:00
Karel Zak 6d37c2ce9a libfdisk: add functions to play nasty games with first/last LBA
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:06:52 +02:00
Karel Zak 6d812a4859 fdisk: reset cached output fields when change disk label
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:03:32 +02:00
Karel Zak 892c89eb76 libfdisk: allow to specify partition size by explicit number of sectors
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:02:17 +02:00
Karel Zak 0a9ac4d2f5 libfdisk: use skip_blank() in scripts
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-08 13:11:59 +02:00
Karel Zak 8be199ea2b sfdisk: cleanup isatty() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-08 13:00:56 +02:00
Karel Zak a536cf7106 libfdisk: (dos) don't inform about logical partition
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-08 13:00:19 +02:00
Karel Zak 4e8ee117c4 libfdisk: consolidate script parser code
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-08 12:59:50 +02:00
Karel Zak d79634cfa8 libfdisk: fix script parser
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 15:33:18 +02:00
Karel Zak 50f7514e9d libfdisk: (dos) fix booable flag usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 15:32:09 +02:00
Karel Zak e1422de3d8 sfdisk: add --label-nested for hybrid GPT
regular disk label:
	# sfdisk --list /dev/sdb
	..
	Disklabel type: gpt
	Disk identifier: 9DF9A9F1-0654-4E7A-9A5E-36E66D60FD79

	Device     Start    End Sectors Size Type
	/dev/sdb1   2048  22527   20480  10M Linux filesystem
	/dev/sdb2  22528  43007   20480  10M Linux swap
	/dev/sdb3  43008 204766  161759  79M Linux filesystem

nested (PMBR):
	# sfdisk --list --label-nested dos /dev/sdb
	...
	Disklabel type: dos
	Disk identifier: 0x00000000

	Device     Boot Start    End Sectors  Size Id Type
	/dev/sdb1           1 204799  204799  100M ee GPT

and for example:
        # sfdisk --label-nested dos /dev/sdb <<EOF
        1, 2047, ee
        , 10M, L
        , 10M, S
        ,,

creates hybrid GPT (PMBR partitions point to the same location as GPT)

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:33 +02:00
Karel Zak 11eee4c477 libfdisk: propagate assign-device operation to parent
Let's make it possible to use fdisk_assign_device() for nested
contexts.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:33 +02:00
Karel Zak a8a4887bcd libfdisk: fix sun and sgi to be usable from sfdisk
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:33 +02:00
Karel Zak f5aa7b613d fdisk: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 01f9286cb1 sfdisk: add --output <list> for print command(s)
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak fff8ad5882 fdisk: add --output <list> for print command(s)
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak eac3aac95b libfdisk: add fdisk_label_get_field_by_name() and const for labels
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 00665c3fe1 libfdisk: (gpt) remove 'Cylinders'
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak bc9e854709 sfdisk: add --part-attrs
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak c77ba5316f libfdisk: (gpt) parse attr bits
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak b4b8438901 build-sys: add hint about 'make'
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 95085ec5d6 libfdisk: (dos) use script label-id
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak e36fb07af6 sfdisk: cleanup option names
Rename options to --part-{label,uuid,type} to be compatible with
another tools (like lsblk, parts, etc).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 351fad5069 sfdisk: add --name
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 3a5bdedf6a sfdisk: add --uuid command
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 9a79aa6e7a sfdisk: more update to the man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 5aac742940 sfdisk: update man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 347a7f7756 sfdisk: add --append
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak e54b1c6fcb sfdisk: be sensitive to PT limits
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak ab02d87e4f sfdisk: add --backup and --backup-file
The option --backup force sfdisk to store *all* fragments of the
partition table (including MBR partition tables store in the
extended partitions) to

	$HOME/sfdisk-<devname>-<offset>.bak

The options -O, -backup-file <path> allows to override the default
path, but sfdisk still appends <devname>-<offset>.bak to the <path>.
The backup files always contain only raw data from the device, so it's
possible to use dd(1) to restore original data on the device.

The original sfdisk also supported -O <file>, but semantic was little
bit different:

   - all was based on 512-byte sectors
   - all sectors was stored to the one file in format
	  <offset>|<sector>|<offset>|...

this original concept makes the backup files specific to sfdisk and with
dependence on sector size.

The new concept is the same we already use for wipefs(8) backup files.

Example (disk with GPT):

   # sfdisk /dev/sda --backup

   Welcome to sfdisk (util-linux 2.25.202-f4deb-dirty).
   Changes will remain in memory only, until you decide to write them.
   Be careful before using the write command.

   Backup files:
          PMBR (offset     0, size   512): /root/sfdisk-sda-0x00000000.bak
    GPT Header (offset   512, size   512): /root/sfdisk-sda-0x00000200.bak
   GPT Entries (offset  1024, size 16384): /root/sfdisk-sda-0x00000400.bak

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak db48b6a189 sfdisk: add --no-reread and --force
and also check if the device is in use.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak f01f252857 sfdisk: add --no-act
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak 35ce145f6a sfdisk: add deprecated --Linux
The sfdisk does not care about compatibility with classic DOS
partitioning, and it does not warn about incompatibility with DOS at
all. It means that --Linux is default and it's unnecessary to use
this option.

It's the same situation like with "--unit S", these options are very
probably often used in scripts, and these all is default now. So for
backward compatibility new sfdisk accepts these options on command
line, but prints "option is deprecated" warning message.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak f0edb076ed sfdisk: add --quiet
Note that original sfdisk implementation suppressed warning
messages for --quiet.

Now we keep warning and error messages visible, but suppress
extra info messages only (for example to make it more usable in
scripts). IMHO suppress warnings is bad idea.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00