18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/picobox/os/distro.rb', line 18
def su(os)
su ||= if TTY::Which.exist?('sudo') && os.user != 'root'
'sudo -E sh -c'
elsif os.user == 'root'
message = <<-END.gsub(/^\s+\|/, '')
|Not a great idea to install things as root user.
|
| You need to:
| * Install sudo and add yourself to sudoers
|
END
raise StandardError, message
else
message = <<-END.gsub(/^\s+\|/, '')
|This installer needs the ability to run commands as root.
| We are unable to find 'sudo' available to make this happen.
|
| You need to:
| * Install sudo and add yourself to sudoers
|
END
raise StandardError, message
end
end
|