Class: Bootloader::GRUB2Pwd
- Inherits:
-
Object
- Object
- Bootloader::GRUB2Pwd
- Defined in:
- src/lib/bootloader/grub2pwd.rb
Overview
class is responsible for detection, encryption and writing of grub2 password protection
Instance Attribute Summary collapse
-
#encrypted_password ⇒ String?
Encrypted value of password.
-
#unrestricted ⇒ Boolean
(also: #unrestricted?)
if password protection is unrestricted or not.
-
#used ⇒ Boolean
(also: #used?)
flag is password protection is used at all.
Instance Method Summary collapse
-
#initialize ⇒ GRUB2Pwd
constructor
Reads or proposes configuration depending on stage.
-
#password=(value) ⇒ Object
Sets password in encrypted form.
-
#password? ⇒ Boolean
Gets if password is specified Rationale for this method is that in some cases it is possible to disable password configuration, but still keep old configuration in object, so after enabling it again it use old configuration.
-
#write ⇒ Object
writes configuration to disk.
Constructor Details
Instance Attribute Details
#encrypted_password ⇒ String?
Encrypted value of password
25 |
# File 'src/lib/bootloader/grub2pwd.rb', line 25 attr_accessor :used, :unrestricted, :encrypted_password |
#unrestricted ⇒ Boolean Also known as: unrestricted?
if password protection is unrestricted or not
25 |
# File 'src/lib/bootloader/grub2pwd.rb', line 25 attr_accessor :used, :unrestricted, :encrypted_password |
#used ⇒ Boolean Also known as: used?
flag is password protection is used at all
25 26 27 |
# File 'src/lib/bootloader/grub2pwd.rb', line 25 def used @used end |
Instance Method Details
#password=(value) ⇒ Object
Sets password in encrypted form
49 50 51 |
# File 'src/lib/bootloader/grub2pwd.rb', line 49 def password=(value) @encrypted_password = encrypt(value) end |
#password? ⇒ Boolean
Gets if password is specified Rationale for this method is that in some cases it is possible to disable password configuration, but still keep old configuration in object, so after enabling it again it use old configuration
57 58 59 |
# File 'src/lib/bootloader/grub2pwd.rb', line 57 def password? !@encrypted_password.nil? end |
#write ⇒ Object
writes configuration to disk
39 40 41 42 43 44 45 |
# File 'src/lib/bootloader/grub2pwd.rb', line 39 def write if used? enable else disable end end |