Add `git` APT source setting for Ubuntu2404.

This commit is contained in:
Kazuhiro MUSASHI 2024-04-28 11:51:43 +09:00
parent 8ae10311a6
commit f6a6c49823
1 changed files with 22 additions and 15 deletions

View File

@ -20,12 +20,15 @@ end
### Here we are going to install git. ### Here we are going to install git.
# Constants: # Constants:
case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp
when "24.04"
execute 'add-apt-repository -y ppa:git-core/ppa' do
not_if 'test -e /etc/apt/sources.list.d/git-core-ubuntu-ppa-noble.sources'
end
else
KEYSRV = 'hkp://keyserver.ubuntu.com:80' KEYSRV = 'hkp://keyserver.ubuntu.com:80'
ID = 'E1DF1F24' ID = 'E1DF1F24'
GIT_PREPUSH = '/usr/share/git-core/templates/hooks/pre-push'
PREPUSH = 'https://gist.github.com/kazu634/8267388/raw/e9202cd4c29a66723c88d2be05f3cd19413d2137/pre-push'
# Retrieve the Ubuntu code: # Retrieve the Ubuntu code:
DIST = run_command('lsb_release -cs').stdout.chomp DIST = run_command('lsb_release -cs').stdout.chomp
@ -39,6 +42,7 @@ template '/etc/apt/sources.list.d/git.list' do
action :create action :create
variables(distribution: DIST) variables(distribution: DIST)
end end
end
execute 'apt update' do execute 'apt update' do
not_if 'LANG=C apt-cache policy git | grep Installed | grep ppa' not_if 'LANG=C apt-cache policy git | grep Installed | grep ppa'
@ -48,6 +52,9 @@ execute 'apt install git -y' do
not_if 'LANG=C apt-cache policy git | grep Installed | grep ppa' not_if 'LANG=C apt-cache policy git | grep Installed | grep ppa'
end end
GIT_PREPUSH = '/usr/share/git-core/templates/hooks/pre-push'
PREPUSH = 'https://gist.github.com/kazu634/8267388/raw/e9202cd4c29a66723c88d2be05f3cd19413d2137/pre-push'
execute "wget #{PREPUSH} -O #{GIT_PREPUSH}" do execute "wget #{PREPUSH} -O #{GIT_PREPUSH}" do
not_if "test -e #{GIT_PREPUSH}" not_if "test -e #{GIT_PREPUSH}"
end end