From 45836282f52e18bb3f00465812c207428a96136a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 12 Oct 2022 22:44:49 +0200 Subject: Add existing. --- lib/facter/raspberry_serial.rb | 4 ++++ manifests/init.pp | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 lib/facter/raspberry_serial.rb create mode 100644 manifests/init.pp 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', + } +} -- cgit v1.2.3