summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/facter/raspberry_serial.rb4
-rw-r--r--manifests/init.pp16
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/facter/raspberry_serial.rb b/lib/facter/raspberry_serial.rb
new file mode 100644
index 0000000..bcf34da
--- /dev/null
+++ b/lib/facter/raspberry_serial.rb
@@ -0,0 +1,4 @@
+Facter.add('serial') do
+ confine { File.exists? '/usr/local/bin/serial' }
+ setcode "/usr/local/bin/serial"
+end
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..72bd1c5
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,16 @@
+class raspberry {
+ file { '/usr/local/bin/serial':
+ ensure => file,
+ mode => '0555',
+ content => @(EOF)
+ #!/bin/sh
+ perl -n -e'/^Serial\s*: 0{8}(.*)/ && print "$1\n"' /proc/cpuinfo
+ | EOF
+ }
+
+ file_line { 'Hack in to force systemd service prodiver on raspbian':
+ path => '/var/lib/gems/2.7.0/gems/puppet-7.14.0/lib/puppet/provider/service/systemd.rb',
+ after => '^\s*defaultfor :operatingsystem => :debian',
+ line => ' defaultfor :operatingsystem => :raspbian',
+ }
+}