From 1998a11c29d6c556289855b6717583f28cd093a9 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Mon, 1 Jul 2024 15:22:58 +0900 Subject: [PATCH] Disable `Ubuntu Pro` announcement. --- cookbooks/base/default.rb | 3 +++ cookbooks/base/ubuntupro.rb | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 cookbooks/base/ubuntupro.rb diff --git a/cookbooks/base/default.rb b/cookbooks/base/default.rb index 07657ff..f81b098 100644 --- a/cookbooks/base/default.rb +++ b/cookbooks/base/default.rb @@ -70,6 +70,9 @@ include_recipe './starship.rb' # Install cloudflared command: include_recipe './cloudflared.rb' +# Disable Ubuntu Pro +include_recipe './ubuntupro.rb' + # recipes for Ubuntu 20.04 and later case node['platform_version'] when "20.04", "22.04", "24.04" diff --git a/cookbooks/base/ubuntupro.rb b/cookbooks/base/ubuntupro.rb new file mode 100644 index 0000000..dc5d636 --- /dev/null +++ b/cookbooks/base/ubuntupro.rb @@ -0,0 +1,11 @@ +case node['platform_version'] +when "24.04" + directory "/etc/apt/apt.conf.d/bk/" + + %w( 20apt-esm-hook.conf ).each do |conf| + execute "mv /etc/apt/apt.conf.d/#{conf} /etc/apt/apt.conf.d/bk/#{conf}" + execute "touch /etc/apt/apt.conf.d/#{conf}" + end + + execute 'pro config set apt_news=false' +end