Mark24 пре 2 година
родитељ
комит
fae998bc6b
4 измењених фајлова са 21 додато и 17 уклоњено
  1. 15 14
      installer.rb
  2. 1 1
      os/DebianLinux.rb
  3. 2 2
      os/MacOS.rb
  4. 3 0
      os/UbuntuLinux.rb

+ 15 - 14
installer.rb

@@ -8,24 +8,25 @@ module OSPatch
     return File.exist?("/etc/debian_version")
   end
 
+  def detect_linux_debian
+    return File.exist?("/etc/debian_version")
+  end
+
+  def detect_linux_ubuntu
+    os_release_file = "/etc/os-release"
+    if File.exist?(os_release_file)
+      os_release = File.read(os_release_file)
+      return true if os_release.include?("ubuntu")
+    end
+    return false
+  end
   def check_os
     case RUBY_PLATFORM.downcase
     when /darwin/
       @osname = "MacOS"
-    when /ubuntu/i
-      @osname = "DebianLinux"
-    when /debian/i
-      @osname = "DebianLinux"
-      # when /centos/i
-      #   @osname = "CentOS"
-      # when /fedora/i
-      #   @osname = "Fedora"
-      # when /redhat/i
-      #   @osname = "Red Hat"
-      # when /suse/i
-      #   @osname = "SUSE"
-      # when /unix/
-      #   @osname = "unix"
+    when /linux/
+      @osname = "DebianLinux" if detect_linux_debian
+      @osname = "UbuntuLinux" if detect_linux_ubuntu
     when /mswin|win32|mingw|cygwin/
       @osname = "win"
       not_support_exit

+ 1 - 1
os/DebianLinux.rb

@@ -12,7 +12,7 @@ module RimeDeploy
 
     class BackupRimeConfigJob < Job
       def call
-        puts "Job: BackupRimeConfigJob".blue
+        puts into
         system(
           "mv #{Config::DebianLinux::ConfigPath} #{Config::DebianLinux::ConfigPath}.#{Time.now.to_i}.old"
         )

+ 2 - 2
os/MacOS.rb

@@ -1,5 +1,5 @@
 module RimeDeploy
-  module Mac
+  module MacOS
     class InstallRimeJob < Job
       def call
         puts intro
@@ -11,7 +11,7 @@ module RimeDeploy
 
     class BackupRimeConfigJob < Job
       def call
-        puts "Job: BackupRimeConfigJob".blue
+        puts intro
         system(
           "mv #{Config::MacOS::ConfigPath} #{Config::MacOS::ConfigPath}.#{Time.now.to_i}.old"
         )

+ 3 - 0
os/UbuntuLinux.rb

@@ -0,0 +1,3 @@
+module RimeDeploy
+  alias UbuntuLinux DebianLinux
+end