Skip to content

Commit 4617f49

Browse files
committed
Fix updating list [skip ci]
1 parent b543bc4 commit 4617f49

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

scripts/install.sh

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ set_base_version() {
6060
}
6161

6262
update_lists_helper() {
63-
list=$1
63+
local list=$1
6464
command -v sudo >/dev/null && SUDO=sudo
6565
if [[ -n "$list" ]]; then
6666
${SUDO} apt-get update -o Dir::Etc::sourcelist="$list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
@@ -72,6 +72,7 @@ update_lists_helper() {
7272
update_lists() {
7373
local ppa=${1:-}
7474
local ppa_search=${2:-}
75+
local list=
7576
if [ ! -e /tmp/setup_php ] || [[ -n $ppa && -n $ppa_search ]]; then
7677
if [[ -n "$ppa" && -n "$ppa_search" ]]; then
7778
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
@@ -84,8 +85,8 @@ update_lists() {
8485
}
8586

8687
check_lists() {
87-
ppa=$1
88-
ppa_search=$2
88+
local ppa=$1
89+
local ppa_search=$2
8990
if grep -Eqr "$ppa_search" "$list_dir"; then
9091
list_count="$(sudo find /var/lib/apt/lists -type f -name "*${ppa/\//_}*" | wc -l)"
9192
if [ "$list_count" = "0" ]; then
@@ -98,26 +99,26 @@ check_lists() {
9899
}
99100

100101
ubuntu_fingerprint() {
101-
ppa=$1
102+
local ppa=$1
102103
get -s "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
103104
}
104105

105106
debian_fingerprint() {
106-
ppa=$1
107-
ppa_url=$2
108-
package_dist=$3
107+
local ppa=$1
108+
local ppa_url=$2
109+
local package_dist=$3
109110
release_pub=/tmp/"${ppa/\//-}".gpg
110111
get -q "$release_pub" "$ppa_url"/dists/"$package_dist"/Release.gpg
111112
gpg --list-packets "$release_pub" | grep -Eo 'fpr\sv4\s.*[a-zA-Z0-9]+' | head -n 1 | cut -d ' ' -f 3
112113
}
113114

114115
add_key() {
115-
ppa=${1:-ondrej/php}
116-
ppa_url=$2
117-
package_dist=$3
118-
key_source=$4
119-
key_file=$5
120-
key_urls=("$key_source")
116+
local ppa=${1:-ondrej/php}
117+
local ppa_url=$2
118+
local package_dist=$3
119+
local key_source=$4
120+
local key_file=$5
121+
local key_urls=("$key_source")
121122
if [[ "$key_source" =~ launchpad.net|launchpadcontent.net|debian.org|setup-php.com ]]; then
122123
fingerprint="$("${ID}"_fingerprint "$ppa" "$ppa_url" "$package_dist")"
123124
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
@@ -130,12 +131,12 @@ add_key() {
130131
}
131132

132133
add_list() {
133-
ppa=${1-ondrej/php}
134-
ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
135-
key_source=${3:-"$ppa_url"}
136-
package_dist=${4:-"$VERSION_CODENAME"}
137-
branches=${5:-main}
138-
ppa_search="deb .*$ppa_url $package_dist .*$branches"
134+
local ppa=${1-ondrej/php}
135+
local ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
136+
local key_source=${3:-"$ppa_url"}
137+
local package_dist=${4:-"$VERSION_CODENAME"}
138+
local branches=${5:-main}
139+
local ppa_search="deb .*$ppa_url $package_dist .*$branches"
139140
if check_lists "$ppa" "$ppa_search"; then
140141
echo "Repository $ppa already exists";
141142
return 1;
@@ -151,7 +152,7 @@ add_list() {
151152
}
152153

153154
remove_list() {
154-
ppa=${1-ondrej/php}
155+
local ppa=${1-ondrej/php}
155156
[ -n "$2" ] && ppa_urls=("$2") || ppa_urls=("$lp_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu")
156157
for ppa_url in "${ppa_urls[@]}"; do
157158
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
@@ -169,11 +170,11 @@ add_ppa() {
169170

170171
update_ppa() {
171172
set_base_version
172-
ppa=ondrej/php
173-
ppa_url=$lp_ppa/$ppa/ubuntu
174-
package_dist=$VERSION_CODENAME
175-
branches=main
176-
ppa_search="deb .*$ppa_url $package_dist .*$branches"
173+
local ppa=ondrej/php
174+
local ppa_url=$lp_ppa/$ppa/ubuntu
175+
local package_dist=$VERSION_CODENAME
176+
local branches=main
177+
local ppa_search="deb .*$ppa_url $package_dist .*$branches"
177178
update_lists "$ppa" "$ppa_search"
178179
. /etc/os-release
179180
}
@@ -227,7 +228,7 @@ github_deps() {
227228
[[ "$version" =~ 5.6|7.[0-2] ]] && jammy_deps+=('libpcre3-dev') || jammy_deps+=('libpcre2-dev')
228229
install_packages "${jammy_deps[@]}"
229230
elif [ "$VERSION_ID" = "24.04" ]; then
230-
noble_libs=('unixodbc-dev' 'libmagickcore-dev')
231+
noble_libs=('unixodbc-dev' 'libmagickcore-dev' 'libxmlrpc-epi-dev')
231232
[[ "$version" =~ 5.6|7.[0-2] ]] && noble_libs+=('libpcre3-dev')
232233
install_packages "${noble_libs[@]}"
233234
fi

0 commit comments

Comments
 (0)