Commit Graph

5 Commits (e7b302c8b8077952a04256084307a44670f69733)

Author SHA1 Message Date
Jose M. Guisado e7b302c8b8 setup disk: fix padding
ogServer expects a 4-partition setup. When specifying less than that,
the partition setup needs to be padded with EMPTY partitions.

Fixes a bug in which this padding is not valid.
2022-05-17 11:40:07 +02:00
Jose M. Guisado b765ee50d3 utils: add print_json
Adds a pretty printing function for JSON data.

Replaces print for print_json in corresponding cli objects.

Follows commit 828d6c0ce7
("list scopes: pretty print scope tree")
2022-05-17 11:24:49 +02:00
OpenGnSys Support Team 5f922571e2 ogCLI is AGPLv3+
Update license header in files.
2021-05-14 00:26:33 +02:00
Jose M. Guisado 01ed5a3039 Add "setup disk" command
Enables sending format and partition commands to the ogServer.

Syntax: ogcli setup disk {options}

Options are:

  --type [{dos,gpt}]    Disk partition scheme
  --num [NUM]           Disk number (defaults to 1)
  --format [FORMAT]     Indicates which partitions to reformat if they
                        are already present. Use --part alone to mean all
                        partitions.
  --part PART [PART ...]
                        Partition definition (syntax:
                        "num,part_scheme,fs,size")

	size is specified as a positive digit followed by a size unit
	like [MGT]

		512M, 50G, 1T, etc.

	ogcli accepts {LINUX,WINDOWS,EFI,CACHE} as part types and {EXT4,
	NTFS, FAT32, CACHE} as filesystem types inside the partition
	definition string

	1,LINUX,EXT4,50G => partition 1, of type linux with ext4 fs of
			    50 GB size

	If you wanted to add a partition cache (OpenGnsys usually
	mandates this partition to be number 4) you can omit partitions
	up to that number and ogcli will fill with EMPTY partitions.

	So if you define the following parts:
		--part 1,...
		--part 4,...
	ogcli will fill parts 2 and 3 with EMPTY part type and fs.

Client selection argument follow previous used options

  --center-id CENTER_ID
  --room-id ROOM_ID
  --client-ip CLIENT_IP
2021-04-07 12:58:54 +02:00
Jose M. Guisado 4dfb90cf56 Add 'list disks'
Enables consuming /client/setup API from ogServer in order to fetch
partition and disk setup information from a given client.

Example, if pc11 is a client with 1 disk, 4 part (1:linux,2-3:empty,4:cache):

ogcli list disk --client-ip 192.168.56.11

{
  "partitions": [
    {
      "disk": 1,
      "partition": 0,
      "code": 1,
      "size": 52428800,
      "used_size": 0,
      "filesystem": 0,
      "os": 0,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 1,
      "code": 131,
      "size": 40000000,
      "used_size": 4,
      "filesystem": 6,
      "os": 8,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 2,
      "code": 0,
      "size": 0,
      "used_size": 0,
      "filesystem": 1,
      "os": 0,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 3,
      "code": 0,
      "size": 0,
      "used_size": 0,
      "filesystem": 1,
      "os": 0,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 4,
      "code": 202,
      "size": 10000000,
      "used_size": 1,
      "filesystem": 2,
      "os": 0,
      "image": 0,
      "software": 0
    }
  ]
}
2021-04-06 13:16:46 +02:00