~awstools-dev/ubuntu/maverick/ec2-ami-tools/maverick

« back to all changes in this revision

Viewing changes to lib/ec2/platform/linux/uname.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2008-10-14 08:35:25 UTC
  • Revision ID: james.westby@ubuntu.com-20081014083525-c0n69wr7r7aqfb8w
Tags: 1.3-26357-0ubuntu2
* New upstream version.
* Update the debian copyright file.
* Added quilt patch system to make it easier to maintain. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
 
 
3
# Copyright 2008 Amazon.com, Inc. or its affiliates.  All Rights
 
4
# Reserved.  Licensed under the Amazon Software License (the
 
5
# "License").  You may not use this file except in compliance with the
 
6
# License. A copy of the License is located at
 
7
# http://aws.amazon.com/asl or in the "license" file accompanying this
 
8
# file.  This file is distributed on an "AS IS" BASIS, WITHOUT
 
9
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
 
10
# the License for the specific language governing permissions and
 
11
# limitations under the License.
 
12
 
 
13
require 'ostruct'
 
14
require 'ec2/platform'
 
15
 
 
16
module EC2
 
17
  module Platform
 
18
    module Linux
 
19
      class Uname
 
20
        @@uname ||= OpenStruct.new
 
21
        def self.all
 
22
          @@uname.all ||= `uname -a`.strip
 
23
        end
 
24
        def self.platform
 
25
          @@uname.platform ||= `uname -i`.strip
 
26
        end
 
27
        def self.nodename
 
28
          @@uname.nodename ||= `uname -n`.strip
 
29
        end
 
30
        def self.processor
 
31
          @@uname.processor ||= `uname -p`.strip
 
32
        end
 
33
        def self.release
 
34
          @@uname.release ||= `uname -r`.strip
 
35
        end
 
36
        def self.os
 
37
          @@uname.os ||= `uname -s`.strip
 
38
        end
 
39
        def self.machine
 
40
          @@uname.machine ||= `uname -m`.strip
 
41
        end
 
42
        def self.uname
 
43
          @@uname
 
44
        end        
 
45
      end
 
46
    end
 
47
  end
 
48
end
 
49
if __FILE__ == $0
 
50
   include EC2::Platform::Linux
 
51
   puts "Uname = #{Uname.all.inspect}"
 
52
end