-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #756 from eightbitraptor/mvh-void-support
Add support for VoidLinux
- Loading branch information
Showing
12 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Specinfra | ||
module Command | ||
module Module | ||
module Runit | ||
include Specinfra::Command::Module::Service::Runit | ||
extend Specinfra::Command::Module::Service::Delegator | ||
def_delegator_service_under :runit | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Specinfra::Command::Voidlinux < Specinfra::Command::Linux | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Specinfra::Command::Voidlinux::Base < Specinfra::Command::Linux::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Specinfra::Command::Voidlinux::Base::Package < Specinfra::Command::Linux::Base::Package | ||
class << self | ||
def check_is_installed(package, version=nil) | ||
"xbps-query -S #{escape(package)} | grep -q 'state: installed'" | ||
end | ||
|
||
alias :check_is_installed_by_xbps :check_is_installed | ||
|
||
def get_version(package, opts=nil) | ||
"xbps-query -S #{package} | sed -nE 's/^pkgver: #{package}-([^\)+])/\1/p'" | ||
end | ||
|
||
def install(package, version=nil, option='') | ||
"xbps-install --yes #{package}" | ||
end | ||
|
||
def remove(package, option='') | ||
"xbps-remove --yes #{option} #{package}" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Specinfra::Command::Voidlinux::Base::Service < Specinfra::Command::Linux::Base::Service | ||
class << self | ||
include Specinfra::Command::Module::Runit | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Specinfra::Helper::DetectOs::Voidlinux < Specinfra::Helper::DetectOs | ||
def detect | ||
if run_command("ls /etc/os-release").success? | ||
line = run_command("cat /etc/os-release").stdout | ||
|
||
if line =~ /^ID="void"/ | ||
{ :family => 'voidlinux', :release => nil } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper' | ||
|
||
describe Specinfra::Command::Module::Service::Runit do | ||
class Specinfra::Command::Module::Service::Runit::Test < Specinfra::Command::Base | ||
extend Specinfra::Command::Module::Service::Runit | ||
end | ||
let(:klass) { Specinfra::Command::Module::Service::Runit::Test } | ||
it { expect(klass.check_is_enabled_under_runit('httpd')).to eq 'test ! -f /etc/sv/httpd/down' } | ||
it { expect(klass.check_is_running_under_runit('httpd')).to eq "sv status httpd | grep -E '^run: '" } | ||
it { expect(klass.enable_under_runit('httpd')).to eq 'ln -s /etc/sv/httpd /var/service/' } | ||
it { expect(klass.disable_under_runit('httpd')).to eq 'rm /var/service/httpd' } | ||
it { expect(klass.start_under_runit('httpd')).to eq 'sv up /var/service/httpd' } | ||
it { expect(klass.stop_under_runit('httpd')).to eq 'sv down /var/service/httpd' } | ||
it { expect(klass.restart_under_runit('httpd')).to eq 'sv restart /var/service/httpd' } | ||
it { expect(klass.reload_under_runit('httpd')).to eq 'sv reload /var/service/httpd' } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'spec_helper' | ||
|
||
require 'spec_helper' | ||
|
||
set :os, { :family => 'voidlinux' } | ||
|
||
describe get_command(:check_package_is_installed, 'httpd') do | ||
it { should eq "xbps-query -S httpd | grep -q 'state: installed'" } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'spec_helper' | ||
|
||
property[:os] = nil | ||
set :os, :family => 'voidlinux' | ||
|
||
describe get_command(:enable_service, 'nginx') do | ||
it { should eq 'ln -s /etc/sv/nginx /var/service/' } | ||
end | ||
|
||
describe get_command(:disable_service, 'nginx') do | ||
it { should eq 'rm /var/service/nginx' } | ||
end | ||
|
||
describe get_command(:start_service, 'nginx') do | ||
it { should eq 'sv up /var/service/nginx' } | ||
end | ||
|
||
describe get_command(:stop_service, 'nginx') do | ||
it { should eq 'sv down /var/service/nginx' } | ||
end | ||
|
||
describe get_command(:restart_service, 'nginx') do | ||
it { should eq 'sv restart /var/service/nginx' } | ||
end |