diskman 1.0.1 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/diskman/chooser.rb +1 -1
- data/lib/diskman/commands/mkfs.rb +3 -5
- data/lib/diskman/commands/write.rb +2 -2
- data/lib/diskman/device.rb +2 -7
- data/lib/diskman/root_device.rb +5 -1
- data/lib/diskman/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc55f72e8adacb9143ad05cf5edc11c2db9d8be185569bb9263735efcbe54700
|
4
|
+
data.tar.gz: 28a1cfa67910767440b3f6293192ddd05be1194e3b9a7246ed304b3bdb33df3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07d213e836deffc0998b14e57e68a4b41f509cf3ba7e7d60d488c6ee8a9f376c7032c90e34a1fb603bee553aaa81902145dfe2a83ca79d1bd976627e269c18d
|
7
|
+
data.tar.gz: 0f68a40ed3db1504f00b05765a646fd57e1e8686fb37e6d1b6e6a7af93303bbd2b4018dffafa9b9ab27a434be3a30b8d4ef5b96cee8f988a768fbddbd51f2729
|
data/lib/diskman/chooser.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Command
|
2
2
|
class Mkfs
|
3
3
|
def get_list
|
4
|
-
Dir['/
|
5
|
-
path.gsub(%r[^/
|
4
|
+
Dir['/sbin/mkfs.*'].map do |path|
|
5
|
+
path.gsub(%r[^/sbin/mkfs.], '')
|
6
6
|
end.sort
|
7
7
|
end
|
8
8
|
|
@@ -13,8 +13,6 @@ module Command
|
|
13
13
|
end
|
14
14
|
|
15
15
|
device = RootDevice.choose
|
16
|
-
device.ensure_not_mounted!
|
17
|
-
|
18
16
|
device = device.choose_with_partitions
|
19
17
|
|
20
18
|
fs = Chooser.new(get_list, item: 'filesystem').select
|
@@ -24,7 +22,7 @@ module Command
|
|
24
22
|
puts "Device: #{device.to_s.yellow}"
|
25
23
|
puts "Command: #{cmd.yellow}"
|
26
24
|
|
27
|
-
System.exec!
|
25
|
+
System.exec! cmd
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
@@ -7,7 +7,7 @@ module Command
|
|
7
7
|
end
|
8
8
|
|
9
9
|
device = RootDevice.choose
|
10
|
-
device.
|
10
|
+
device = device.choose_with_partitions
|
11
11
|
|
12
12
|
size = File.size(file)
|
13
13
|
cmd = device.get_write_command(file, size)
|
@@ -16,7 +16,7 @@ module Command
|
|
16
16
|
puts "Device: #{device.to_s.yellow}"
|
17
17
|
puts "Command: #{cmd.yellow}"
|
18
18
|
|
19
|
-
System.exec!
|
19
|
+
System.exec! cmd
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/diskman/device.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Diskman
|
2
2
|
class Device
|
3
|
+
attr_reader :name
|
3
4
|
attr_reader :path
|
4
5
|
|
5
6
|
def initialize(name)
|
@@ -16,13 +17,7 @@ module Diskman
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def get_write_command(path, bytes)
|
19
|
-
|
20
|
-
pv = 'pv --size %d' % bytes
|
21
|
-
dd = 'dd if="%s" | ' + pv + ' | sudo dd of="%s" bs=%d'
|
22
|
-
else
|
23
|
-
dd = 'sudo dd if="%s" of="%s" bs=%d'
|
24
|
-
end
|
25
|
-
|
20
|
+
dd = 'sudo dd if="%s" of="%s" bs=%dK status=progress'
|
26
21
|
dd % [path, @path, 4096]
|
27
22
|
end
|
28
23
|
|
data/lib/diskman/root_device.rb
CHANGED
@@ -5,11 +5,15 @@ module Diskman
|
|
5
5
|
File.read(file).strip == '1'
|
6
6
|
end.map do |path|
|
7
7
|
path =~ %r[^/sys/block/(.*)/removable$]x && RootDevice.new($1)
|
8
|
+
end.reject do |device|
|
9
|
+
device.name =~ /sr\d+/
|
8
10
|
end.sort
|
9
11
|
end
|
10
12
|
|
11
13
|
def self.choose
|
12
|
-
Chooser.new(RootDevice.get_removable, item: 'removable device').select
|
14
|
+
selection = Chooser.new(RootDevice.get_removable, item: 'removable device').select
|
15
|
+
selection.ensure_not_mounted!
|
16
|
+
selection
|
13
17
|
end
|
14
18
|
|
15
19
|
def choose_with_partitions
|
data/lib/diskman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diskman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- crdx
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require_all
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colorize
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.21.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.21.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,16 +86,16 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '13.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
97
|
-
description:
|
98
|
-
email:
|
96
|
+
version: '13.0'
|
97
|
+
description:
|
98
|
+
email:
|
99
99
|
executables:
|
100
100
|
- diskman
|
101
101
|
extensions: []
|
@@ -117,7 +117,7 @@ homepage: https://github.com/crdx/diskman
|
|
117
117
|
licenses:
|
118
118
|
- MIT
|
119
119
|
metadata: {}
|
120
|
-
post_install_message:
|
120
|
+
post_install_message:
|
121
121
|
rdoc_options: []
|
122
122
|
require_paths:
|
123
123
|
- lib
|
@@ -132,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
136
|
-
signing_key:
|
135
|
+
rubygems_version: 3.2.21
|
136
|
+
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Interactive command line interface for safely managing disks
|
139
139
|
test_files: []
|