|
@@ -0,0 +1,36 @@
|
|
|
|
+#
|
|
|
|
+# Cookbook:: workstation
|
|
|
|
+# Recipe:: _ssh-ident
|
|
|
|
+#
|
|
|
|
+# Copyright:: 2022, The Authors, All Rights Reserved.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+username = node['my_workstation']['default_user'].first[0]
|
|
|
|
+user_repo_directory = ::File.join(node['my_workstation']['default_user'][username]['home'], 'repo')
|
|
|
|
+ssh_ident_repo = ::File.join(user_repo_directory, 'ssh-ident')
|
|
|
|
+ssh_ident_bin = ::File.join(ssh_ident_repo, 'ssh-ident')
|
|
|
|
+patch_file = '001-ssh_ident-fix-python.patch'
|
|
|
|
+
|
|
|
|
+git ssh_ident_repo do
|
|
|
|
+ repository 'https://github.com/ccontavalli/ssh-ident'
|
|
|
|
+ user username
|
|
|
|
+ action :checkout
|
|
|
|
+end
|
|
|
|
+
|
|
|
|
+cookbook_file ::File.join(ssh_ident_repo, patch_file) do
|
|
|
|
+ source patch_file
|
|
|
|
+ owner username
|
|
|
|
+ group username
|
|
|
|
+ notifies :run, "execute[git am #{patch_file}]", :immediately
|
|
|
|
+end
|
|
|
|
+
|
|
|
|
+# How to create a git patch:
|
|
|
|
+# Ref: https://devconnected.com/how-to-create-and-apply-git-patch-files/
|
|
|
|
+execute "git am #{patch_file}" do
|
|
|
|
+ cwd ssh_ident_repo
|
|
|
|
+ action :nothing
|
|
|
|
+end
|
|
|
|
+
|
|
|
|
+execute "/usr/bin/install #{ssh_ident_bin} /usr/sbin/ssh-ident" do
|
|
|
|
+ not_if { ::FileUtils.uptodate?('/usr/sbin/ssh-ident', [ssh_ident_bin]) }
|
|
|
|
+end
|