Class: DnsOne::Setup
Constant Summary collapse
- SYSTEMD_SERVICES_DIR =
"/lib/systemd/system/"
- SERVICE_NAME =
'dnsone'
- SYSTEMD_SERVICE_FILE =
"#{SYSTEMD_SERVICES_DIR}/#{SERVICE_NAME}.service"
Instance Attribute Summary collapse
-
#conf ⇒ Object
Returns the value of attribute conf.
Instance Method Summary collapse
-
#initialize ⇒ Setup
constructor
A new instance of Setup.
- #remove ⇒ Object
- #setup ⇒ Object
Constructor Details
Instance Attribute Details
#conf ⇒ Object
Returns the value of attribute conf.
6 7 8 |
# File 'lib/dns_one/setup.rb', line 6 def conf @conf end |
Instance Method Details
#remove ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dns_one/setup.rb', line 24 def remove unless is_setup? die "Nothing to remove. Exiting." end # SYSTEMD_SERVICE_FILE if Util.has_systemd? and File.exist? SYSTEMD_SERVICE_FILE Util.run "systemctl stop #{SERVICE_NAME}" Util.run "systemctl disable #{SERVICE_NAME}" File.delete SYSTEMD_SERVICE_FILE end # conf_file if File.exists? conf.conf_file if confirm? "Delete #{conf.conf_file}?" FileUtils.rm conf.conf_file end end # work_dir if conf.work_dir == '/var/local/dnsone' # Only deletes if path matches the hardcoded one if Dir.exists? conf.work_dir if confirm? "Delete #{conf.work_dir}?" FileUtils.rm_rf conf.work_dir end end end puts "Removed." end |
#setup ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/dns_one/setup.rb', line 15 def setup check_reqs add_user mkdirs copy_sample_conf install_systemd_service setup_finished_msg end |