setup-php 2.13.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +990 -922
- package/lib/config.d.ts +3 -0
- package/lib/config.js +71 -71
- package/lib/config.js.map +1 -1
- package/lib/coverage.d.ts +5 -0
- package/lib/coverage.js +97 -87
- package/lib/coverage.js.map +1 -1
- package/lib/extensions.d.ts +4 -0
- package/lib/extensions.js +214 -200
- package/lib/extensions.js.map +1 -1
- package/lib/fetch.d.ts +1 -0
- package/lib/fetch.js +63 -0
- package/lib/fetch.js.map +1 -0
- package/lib/install.d.ts +2 -0
- package/lib/install.js +75 -81
- package/lib/install.js.map +1 -1
- package/lib/tools.d.ts +23 -0
- package/lib/tools.js +367 -386
- package/lib/tools.js.map +1 -1
- package/lib/utils.d.ts +21 -0
- package/lib/utils.js +261 -291
- package/lib/utils.js.map +1 -1
- package/package.json +67 -56
- package/src/config.ts +82 -82
- package/src/configs/brew_extensions +31 -0
- package/src/configs/composer.env +2 -0
- package/src/configs/ini/jit.ini +3 -0
- package/src/configs/ini/php.ini +2 -0
- package/src/configs/ini/xdebug.ini +1 -0
- package/src/configs/os_releases.csv +19 -17
- package/src/configs/php-versions.json +6 -5
- package/src/configs/php_packages +12 -0
- package/src/configs/{php.json → pm/php.json} +29 -29
- package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
- package/src/configs/tools.json +278 -235
- package/src/configs/tools_schema.json +125 -114
- package/src/coverage.ts +144 -142
- package/src/extensions.ts +367 -349
- package/src/fetch.ts +54 -0
- package/src/install.ts +66 -82
- package/src/scripts/darwin.sh +285 -249
- package/src/scripts/extensions/add_extensions.ps1 +194 -0
- package/src/scripts/extensions/add_extensions.sh +184 -0
- package/src/scripts/{ext → extensions}/blackfire.ps1 +32 -32
- package/src/scripts/{ext → extensions}/blackfire.sh +22 -21
- package/src/scripts/{ext → extensions}/couchbase.sh +43 -43
- package/src/scripts/{ext → extensions}/cubrid.sh +60 -60
- package/src/scripts/extensions/extension_map.php +132 -0
- package/src/scripts/{ext → extensions}/firebird.ps1 +19 -19
- package/src/scripts/{ext → extensions}/firebird.sh +39 -35
- package/src/scripts/{ext → extensions}/gearman.sh +22 -22
- package/src/scripts/{ext → extensions}/geos.sh +17 -17
- package/src/scripts/{ext → extensions}/http.ps1 +54 -54
- package/src/scripts/{ext → extensions}/http.sh +109 -120
- package/src/scripts/{ext → extensions}/intl.sh +23 -23
- package/src/scripts/{ext → extensions}/ioncube.ps1 +33 -32
- package/src/scripts/{ext → extensions}/ioncube.sh +21 -19
- package/src/scripts/{ext → extensions}/oci.ps1 +85 -60
- package/src/scripts/{ext → extensions}/oci.sh +65 -63
- package/src/scripts/{ext → extensions}/patches/firebird.sh +11 -11
- package/src/scripts/{ext → extensions}/patches/geos.sh +7 -7
- package/src/scripts/{ext → extensions}/patches/http.sh +11 -11
- package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +6 -6
- package/src/scripts/{ext → extensions}/patches/phpize.sh +26 -26
- package/src/scripts/{ext → extensions}/patches/protobuf.sh +4 -4
- package/src/scripts/{ext → extensions}/phalcon.ps1 +54 -54
- package/src/scripts/{ext → extensions}/phalcon.sh +58 -58
- package/src/scripts/{ext → extensions}/source.sh +145 -144
- package/src/scripts/extensions/sqlsrv.sh +15 -0
- package/src/scripts/linux.sh +269 -256
- package/src/scripts/tools/add_tools.ps1 +239 -26
- package/src/scripts/tools/add_tools.sh +175 -20
- package/src/scripts/tools/blackfire.ps1 +19 -19
- package/src/scripts/tools/blackfire.sh +40 -39
- package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
- package/src/scripts/tools/grpc_php_plugin.sh +58 -58
- package/src/scripts/tools/ppa.sh +192 -151
- package/src/scripts/tools/protoc.ps1 +38 -38
- package/src/scripts/tools/protoc.sh +28 -28
- package/src/scripts/tools/symfony.ps1 +14 -0
- package/src/scripts/tools/symfony.sh +13 -0
- package/src/scripts/unix.sh +186 -0
- package/src/scripts/win32.ps1 +352 -494
- package/src/tools.ts +512 -538
- package/src/utils.ts +415 -500
- package/.eslintrc.json +0 -16
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/CONTRIBUTING.md +0 -70
- package/.github/FUNDING.yml +0 -7
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
- package/.github/SECURITY.md +0 -29
- package/.github/workflows/docs.yml +0 -77
- package/.github/workflows/node-workflow.yml +0 -51
- package/.github/workflows/workflow.yml +0 -78
- package/.idea/workspace.xml +0 -113
- package/.prettierrc.json +0 -12
- package/__tests__/config.test.ts +0 -52
- package/__tests__/coverage.test.ts +0 -110
- package/__tests__/extensions.test.ts +0 -263
- package/__tests__/install.test.ts +0 -175
- package/__tests__/tools.test.ts +0 -524
- package/__tests__/utils.test.ts +0 -307
- package/action.yml +0 -29
- package/dist/index.js +0 -3051
- package/examples/bedrock.yml +0 -32
- package/examples/blackfire-player.yml +0 -31
- package/examples/blackfire.yml +0 -31
- package/examples/cakephp-mysql.yml +0 -114
- package/examples/cakephp-postgres.yml +0 -112
- package/examples/cakephp.yml +0 -92
- package/examples/codeigniter.yml +0 -34
- package/examples/laravel-mysql.yml +0 -74
- package/examples/laravel-postgres.yml +0 -74
- package/examples/laravel.yml +0 -42
- package/examples/lumen-mysql.yml +0 -74
- package/examples/lumen-postgres.yml +0 -74
- package/examples/lumen.yml +0 -38
- package/examples/phalcon-mysql.yml +0 -74
- package/examples/phalcon-postgres.yml +0 -73
- package/examples/sage.yml +0 -57
- package/examples/slim-framework.yml +0 -34
- package/examples/symfony-mysql.yml +0 -57
- package/examples/symfony-postgres.yml +0 -55
- package/examples/symfony.yml +0 -39
- package/examples/yii2-mysql.yml +0 -73
- package/examples/yii2-postgres.yml +0 -71
- package/examples/zend-framework.yml +0 -36
- package/jest.config.js +0 -12
- package/lib/sapi.js +0 -64
- package/src/scripts/common.sh +0 -314
- package/tsconfig.json +0 -18
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
add_bazel() {
|
|
2
|
-
if ! command -v bazel; then
|
|
3
|
-
if [ "$(uname -s)" = "Linux" ]; then
|
|
4
|
-
add_list bazel/apt https://storage.googleapis.com/bazel-apt https://bazel.build/bazel-release.pub.gpg stable jdk1.8
|
|
5
|
-
install_packages bazel
|
|
6
|
-
else
|
|
7
|
-
brew install bazel
|
|
8
|
-
fi
|
|
9
|
-
fi
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get_grpc_tag() {
|
|
13
|
-
if [ "$grpc_tag" = "latest" ]; then
|
|
14
|
-
grpc_tag=$(get -s -n "" https://github.com/grpc/grpc/releases/latest | grep -Eo -m 1 "v[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
|
|
15
|
-
else
|
|
16
|
-
if [[ ${grpc_tag:0:1} != "v" ]] ; then grpc_tag="v$grpc_tag"; fi
|
|
17
|
-
status_code=$(get -v -n /tmp/grpc.tmp "https://github.com/grpc/grpc/releases/tag/$grpc_tag")
|
|
18
|
-
if [ "$status_code" != "200" ]; then
|
|
19
|
-
grpc_tag=$(get -s -n "" https://github.com/grpc/grpc/releases/latest | grep -Eo -m 1 "v[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
|
|
20
|
-
fi
|
|
21
|
-
fi
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
add_grpc_php_plugin_brew() {
|
|
25
|
-
brew install grpc
|
|
26
|
-
brew link --force --overwrite grpc >/dev/null 2>&1
|
|
27
|
-
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
|
28
|
-
license_path="$(brew --prefix grpc)/LICENSE"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
add_grpc_php_plugin_compile() {
|
|
32
|
-
get_grpc_tag
|
|
33
|
-
get -s -n "" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp
|
|
34
|
-
export DISABLE_BAZEL_WRAPPER=1
|
|
35
|
-
(
|
|
36
|
-
cd "/tmp/grpc-${grpc_tag:1}" || exit
|
|
37
|
-
add_bazel
|
|
38
|
-
./tools/bazel build src/compiler:grpc_php_plugin
|
|
39
|
-
sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin
|
|
40
|
-
sudo chmod a+x /usr/local/bin/grpc_php_plugin
|
|
41
|
-
license_path="/tmp/grpc-${grpc_tag:1}/LICENSE"
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
add_grpc_php_plugin() {
|
|
46
|
-
grpc_tag=$1
|
|
47
|
-
license_path=""
|
|
48
|
-
if [ "$grpc_tag" = "latest" ]; then
|
|
49
|
-
add_grpc_php_plugin_brew >/dev/null 2>&1
|
|
50
|
-
else
|
|
51
|
-
add_grpc_php_plugin_compile >/dev/null 2>&1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
|
55
|
-
printf "
|
|
56
|
-
cat "$license_path"
|
|
57
|
-
echo "
|
|
58
|
-
}
|
|
1
|
+
add_bazel() {
|
|
2
|
+
if ! command -v bazel; then
|
|
3
|
+
if [ "$(uname -s)" = "Linux" ]; then
|
|
4
|
+
add_list bazel/apt https://storage.googleapis.com/bazel-apt https://bazel.build/bazel-release.pub.gpg stable jdk1.8
|
|
5
|
+
install_packages bazel
|
|
6
|
+
else
|
|
7
|
+
brew install bazel
|
|
8
|
+
fi
|
|
9
|
+
fi
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get_grpc_tag() {
|
|
13
|
+
if [ "$grpc_tag" = "latest" ]; then
|
|
14
|
+
grpc_tag=$(get -s -n "" https://github.com/grpc/grpc/releases/latest | grep -Eo -m 1 "v[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
|
|
15
|
+
else
|
|
16
|
+
if [[ ${grpc_tag:0:1} != "v" ]] ; then grpc_tag="v$grpc_tag"; fi
|
|
17
|
+
status_code=$(get -v -n /tmp/grpc.tmp "https://github.com/grpc/grpc/releases/tag/$grpc_tag")
|
|
18
|
+
if [ "$status_code" != "200" ]; then
|
|
19
|
+
grpc_tag=$(get -s -n "" https://github.com/grpc/grpc/releases/latest | grep -Eo -m 1 "v[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
|
|
20
|
+
fi
|
|
21
|
+
fi
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
add_grpc_php_plugin_brew() {
|
|
25
|
+
brew install grpc
|
|
26
|
+
brew link --force --overwrite grpc >/dev/null 2>&1
|
|
27
|
+
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
|
28
|
+
license_path="$(brew --prefix grpc)/LICENSE"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
add_grpc_php_plugin_compile() {
|
|
32
|
+
get_grpc_tag
|
|
33
|
+
get -s -n "" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp
|
|
34
|
+
export DISABLE_BAZEL_WRAPPER=1
|
|
35
|
+
(
|
|
36
|
+
cd "/tmp/grpc-${grpc_tag:1}" || exit
|
|
37
|
+
add_bazel
|
|
38
|
+
./tools/bazel build src/compiler:grpc_php_plugin
|
|
39
|
+
sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin
|
|
40
|
+
sudo chmod a+x /usr/local/bin/grpc_php_plugin
|
|
41
|
+
license_path="/tmp/grpc-${grpc_tag:1}/LICENSE"
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
add_grpc_php_plugin() {
|
|
46
|
+
grpc_tag=$1
|
|
47
|
+
license_path=""
|
|
48
|
+
if [ "$grpc_tag" = "latest" ]; then
|
|
49
|
+
add_grpc_php_plugin_brew >/dev/null 2>&1
|
|
50
|
+
else
|
|
51
|
+
add_grpc_php_plugin_compile >/dev/null 2>&1
|
|
52
|
+
fi
|
|
53
|
+
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
|
54
|
+
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
|
55
|
+
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
|
56
|
+
cat "$license_path"
|
|
57
|
+
echo "$END_GROUP"
|
|
58
|
+
}
|
package/src/scripts/tools/ppa.sh
CHANGED
|
@@ -1,151 +1,192 @@
|
|
|
1
|
-
# Function to try to set ubuntu or debian version.
|
|
2
|
-
set_base_version_id() {
|
|
3
|
-
[[ "$ID" =~ ubuntu|debian ]] && return;
|
|
4
|
-
if ! [ -d "$dist_info_dir" ]; then
|
|
5
|
-
sudo mkdir -p "$dist_info_dir"
|
|
6
|
-
get -q -n "$dist_info_dir"/os_releases.csv https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/os_releases.csv
|
|
7
|
-
fi
|
|
8
|
-
for base in ubuntu debian; do
|
|
9
|
-
[[ "$ID_LIKE" =~ $base ]] && ID="$base" && VERSION_ID="$(grep -hr -m 1 "$VERSION_CODENAME" /usr/share/distro-info | cut -d ',' -f 1 | cut -d ' ' -f 1)" && break
|
|
10
|
-
done
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
# Function to try to set ubuntu or debian codename.
|
|
14
|
-
set_base_version_codename() {
|
|
15
|
-
[[ "$ID" =~ ubuntu|debian ]] && return;
|
|
16
|
-
if [[ "$ID_LIKE" =~ ubuntu ]]; then
|
|
17
|
-
[[ -n "$UBUNTU_CODENAME" ]] && VERSION_CODENAME="$UBUNTU_CODENAME" && return;
|
|
18
|
-
[ -e "$upstream_lsb" ] && VERSION_CODENAME=$(grep 'CODENAME' "$upstream_lsb" | cut -d '=' -f 2) && return;
|
|
19
|
-
VERSION_CODENAME=$(grep -E -m1 'deb .*ubuntu.com' "$list_file" | cut -d ' ' -f 3) && VERSION_CODENAME=${VERSION_CODENAME%-*}
|
|
20
|
-
elif [[ "$ID_LIKE" =~ debian ]] || command -v dpkg >/dev/null; then
|
|
21
|
-
ID_LIKE=debian
|
|
22
|
-
[[ -n "$DEBIAN_CODENAME" ]] && VERSION_CODENAME="$DEBIAN_CODENAME" && return;
|
|
23
|
-
update_lists && VERSION_CODENAME=$(apt-cache show tzdata | grep -m 1 Provides | cut -d '-' -f 2)
|
|
24
|
-
fi
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
# Function to set base os details
|
|
28
|
-
set_base_version() {
|
|
29
|
-
if [ -e /tmp/os-release ]; then
|
|
30
|
-
. /tmp/os-release
|
|
31
|
-
else
|
|
32
|
-
set_base_version_codename
|
|
33
|
-
set_base_version_id
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
ppa
|
|
83
|
-
ppa_url
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
else
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
1
|
+
# Function to try to set ubuntu or debian version.
|
|
2
|
+
set_base_version_id() {
|
|
3
|
+
[[ "$ID" =~ ubuntu|debian ]] && return;
|
|
4
|
+
if ! [ -d "$dist_info_dir" ]; then
|
|
5
|
+
sudo mkdir -p "$dist_info_dir"
|
|
6
|
+
get -q -n "$dist_info_dir"/os_releases.csv https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/os_releases.csv
|
|
7
|
+
fi
|
|
8
|
+
for base in ubuntu debian; do
|
|
9
|
+
[[ "$ID_LIKE" =~ $base ]] && ID="$base" && VERSION_ID="$(grep -hr -m 1 "$VERSION_CODENAME" /usr/share/distro-info | cut -d ',' -f 1 | cut -d ' ' -f 1)" && break
|
|
10
|
+
done
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
# Function to try to set ubuntu or debian codename.
|
|
14
|
+
set_base_version_codename() {
|
|
15
|
+
[[ "$ID" =~ ubuntu|debian ]] && return;
|
|
16
|
+
if [[ "$ID_LIKE" =~ ubuntu ]]; then
|
|
17
|
+
[[ -n "$UBUNTU_CODENAME" ]] && VERSION_CODENAME="$UBUNTU_CODENAME" && return;
|
|
18
|
+
[ -e "$upstream_lsb" ] && VERSION_CODENAME=$(grep 'CODENAME' "$upstream_lsb" | cut -d '=' -f 2) && return;
|
|
19
|
+
VERSION_CODENAME=$(grep -E -m1 'deb .*ubuntu.com' "$list_file" | cut -d ' ' -f 3) && VERSION_CODENAME=${VERSION_CODENAME%-*}
|
|
20
|
+
elif [[ "$ID_LIKE" =~ debian ]] || command -v dpkg >/dev/null; then
|
|
21
|
+
ID_LIKE=debian
|
|
22
|
+
[[ -n "$DEBIAN_CODENAME" ]] && VERSION_CODENAME="$DEBIAN_CODENAME" && return;
|
|
23
|
+
update_lists && VERSION_CODENAME=$(apt-cache show tzdata | grep -m 1 Provides | cut -d '-' -f 2)
|
|
24
|
+
fi
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Function to set base os details
|
|
28
|
+
set_base_version() {
|
|
29
|
+
if [ -e /tmp/os-release ]; then
|
|
30
|
+
. /tmp/os-release
|
|
31
|
+
else
|
|
32
|
+
set_base_version_codename
|
|
33
|
+
set_base_version_id
|
|
34
|
+
|
|
35
|
+
# Remove once PPAs start having bookworm releases
|
|
36
|
+
[ "$VERSION_CODENAME" = 'bookworm' ] && VERSION_CODENAME="bullseye"
|
|
37
|
+
|
|
38
|
+
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1
|
|
39
|
+
fi
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Helper function to update package lists.
|
|
43
|
+
update_lists_helper() {
|
|
44
|
+
list=$1
|
|
45
|
+
command -v sudo >/dev/null && SUDO=sudo
|
|
46
|
+
if [[ -n "$list" ]]; then
|
|
47
|
+
${SUDO} apt-get update -o Dir::Etc::sourcelist="$list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
|
|
48
|
+
else
|
|
49
|
+
${SUDO} apt-get update
|
|
50
|
+
fi
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Function to update the package lists.
|
|
54
|
+
update_lists() {
|
|
55
|
+
local ppa=${1:-}
|
|
56
|
+
local ppa_search=${2:-}
|
|
57
|
+
local list=
|
|
58
|
+
status_file=/tmp/os_lists
|
|
59
|
+
if [[ -n "$ppa" && -n "$ppa_search" ]]; then
|
|
60
|
+
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
|
|
61
|
+
status_file=/tmp/"${ppa/\//_}"
|
|
62
|
+
elif grep -Eq '^deb ' "$list_file"; then
|
|
63
|
+
list="$list_file"
|
|
64
|
+
fi
|
|
65
|
+
if [ ! -e "$status_file" ]; then
|
|
66
|
+
update_lists_helper "$list" >/dev/null 2>&1
|
|
67
|
+
echo '' | tee "$status_file" >/dev/null 2>&1
|
|
68
|
+
fi
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Function to get fingerprint from an Ubuntu PPA.
|
|
72
|
+
ubuntu_fingerprint() {
|
|
73
|
+
ppa=$1
|
|
74
|
+
get -s -n "" "$lp_api"/~"${ppa%/*}"/+archive/"${ppa##*/}" | jq -r '.signing_key_fingerprint'
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# Function to get fingerprint from a Debian PPA.
|
|
78
|
+
debian_fingerprint() {
|
|
79
|
+
ppa=$1
|
|
80
|
+
ppa_url=$2
|
|
81
|
+
package_dist=$3
|
|
82
|
+
release_pub=/tmp/"${ppa/\//-}".gpg
|
|
83
|
+
get -q -n "$release_pub" "$ppa_url"/dists/"$package_dist"/Release.gpg
|
|
84
|
+
gpg --list-packets "$release_pub" | grep -Eo 'fpr\sv4\s.*[a-zA-Z0-9]+' | head -n 1 | cut -d ' ' -f 3
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Function to add a GPG key.
|
|
88
|
+
add_key() {
|
|
89
|
+
ppa=${1:-ondrej/php}
|
|
90
|
+
ppa_url=$2
|
|
91
|
+
package_dist=$3
|
|
92
|
+
key_source=$4
|
|
93
|
+
key_file=$5
|
|
94
|
+
key_urls=("$key_source")
|
|
95
|
+
if [[ "$key_source" =~ launchpad.net|debian.org|setup-php.com ]]; then
|
|
96
|
+
fingerprint="$("${ID}"_fingerprint "$ppa" "$ppa_url" "$package_dist")"
|
|
97
|
+
sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
|
|
98
|
+
key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
|
|
99
|
+
fi
|
|
100
|
+
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
|
101
|
+
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
|
102
|
+
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
|
|
103
|
+
fi
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# Function to check if a PPA and its lists exist
|
|
107
|
+
check_lists() {
|
|
108
|
+
ppa=$1
|
|
109
|
+
ppa_search=$2
|
|
110
|
+
if grep -Eqr "$ppa_search" "$list_dir"; then
|
|
111
|
+
list_count="$(sudo find /var/lib/apt/lists -type f -name "*${ppa/\//_}*" | wc -l)"
|
|
112
|
+
if [ "$list_count" = "0" ]; then
|
|
113
|
+
update_lists "$ppa" "$ppa_search"
|
|
114
|
+
fi
|
|
115
|
+
return 0;
|
|
116
|
+
else
|
|
117
|
+
return 1;
|
|
118
|
+
fi
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
# Function to add a sources list.
|
|
122
|
+
add_list() {
|
|
123
|
+
ppa=${1-ondrej/php}
|
|
124
|
+
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
|
|
125
|
+
key_source=${3:-"$ppa_url"}
|
|
126
|
+
package_dist=${4:-"$VERSION_CODENAME"}
|
|
127
|
+
branches=${5:-main}
|
|
128
|
+
ppa_search="deb .*$ppa_url $package_dist .*$branches"
|
|
129
|
+
if check_lists "$ppa" "$ppa_search"; then
|
|
130
|
+
echo "Repository $ppa already exists";
|
|
131
|
+
return 1;
|
|
132
|
+
else
|
|
133
|
+
arch=$(dpkg --print-architecture)
|
|
134
|
+
[ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
|
|
135
|
+
add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
|
|
136
|
+
echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa/\//-}".list >/dev/null 2>&1
|
|
137
|
+
update_lists "$ppa" "$ppa_search"
|
|
138
|
+
. /etc/os-release
|
|
139
|
+
fi
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
# Function to remove a PPA.
|
|
144
|
+
remove_list() {
|
|
145
|
+
ppa=${1-ondrej/php}
|
|
146
|
+
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
|
|
147
|
+
grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
|
|
148
|
+
sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring || true
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
# Function to add a PPA.
|
|
152
|
+
add_ppa() {
|
|
153
|
+
set_base_version
|
|
154
|
+
ppa=${1:-ondrej/php}
|
|
155
|
+
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
|
156
|
+
add_list "$ppa"
|
|
157
|
+
elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
|
158
|
+
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg
|
|
159
|
+
else
|
|
160
|
+
add_list "$ppa"
|
|
161
|
+
fi
|
|
162
|
+
exit_code="$?"
|
|
163
|
+
. /etc/os-release
|
|
164
|
+
return $exit_code
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# Function to update a PPA.
|
|
168
|
+
update_ppa() {
|
|
169
|
+
set_base_version
|
|
170
|
+
ppa=${1:-ondrej/php}
|
|
171
|
+
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
|
|
172
|
+
package_dist=${4:-"$VERSION_CODENAME"}
|
|
173
|
+
branches=${5:-main}
|
|
174
|
+
ppa_search="deb .*$ppa_url $package_dist .*$branches"
|
|
175
|
+
update_lists "$ppa" "$ppa_search"
|
|
176
|
+
. /etc/os-release
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
# Variables
|
|
180
|
+
list_file='/etc/apt/sources.list'
|
|
181
|
+
list_dir="$list_file.d"
|
|
182
|
+
upstream_lsb='/etc/upstream-release/lsb-release'
|
|
183
|
+
lp_api='https://api.launchpad.net/1.0'
|
|
184
|
+
lp_ppa='http://ppa.launchpad.net'
|
|
185
|
+
key_dir='/usr/share/keyrings'
|
|
186
|
+
dist_info_dir='/usr/share/distro-info'
|
|
187
|
+
sury='https://packages.sury.org'
|
|
188
|
+
sks=(
|
|
189
|
+
'https://keyserver.ubuntu.com'
|
|
190
|
+
'https://pgp.mit.edu'
|
|
191
|
+
'https://keys.openpgp.org'
|
|
192
|
+
)
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
Function Get-ProtobufTag() {
|
|
2
|
-
if("$protobuf_tag" -eq "latest") {
|
|
3
|
-
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
|
4
|
-
} else {
|
|
5
|
-
try {
|
|
6
|
-
[net.httpWebRequest] $request = [net.webRequest]::create("https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
|
7
|
-
$req.Method = "HEAD"
|
|
8
|
-
[net.httpWebResponse] $response = $request.getResponse()
|
|
9
|
-
$response.Close()
|
|
10
|
-
$protobuf_tag = "v$protobuf_tag"
|
|
11
|
-
} catch {
|
|
12
|
-
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return $protobuf_tag
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Function Add-Protoc() {
|
|
19
|
-
param(
|
|
20
|
-
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'The PHP version to be installed')]
|
|
21
|
-
[ValidatePattern('^latest$|^(v?)\d+\.\d+\.\d+$')]
|
|
22
|
-
[string] $protobuf_tag
|
|
23
|
-
)
|
|
24
|
-
$protobuf_tag = Get-ProtobufTag
|
|
25
|
-
$arch_num = '64'
|
|
26
|
-
if(-not([Environment]::Is64BitOperatingSystem)) {
|
|
27
|
-
$arch_num = '32'
|
|
28
|
-
}
|
|
29
|
-
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
|
30
|
-
Invoke-WebRequest -Uri $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
|
31
|
-
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
|
32
|
-
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
|
33
|
-
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
|
34
|
-
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
|
35
|
-
printf "
|
|
36
|
-
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
|
37
|
-
Write-Output "
|
|
38
|
-
}
|
|
1
|
+
Function Get-ProtobufTag() {
|
|
2
|
+
if("$protobuf_tag" -eq "latest") {
|
|
3
|
+
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
|
4
|
+
} else {
|
|
5
|
+
try {
|
|
6
|
+
[net.httpWebRequest] $request = [net.webRequest]::create("https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
|
7
|
+
$req.Method = "HEAD"
|
|
8
|
+
[net.httpWebResponse] $response = $request.getResponse()
|
|
9
|
+
$response.Close()
|
|
10
|
+
$protobuf_tag = "v$protobuf_tag"
|
|
11
|
+
} catch {
|
|
12
|
+
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return $protobuf_tag
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
Function Add-Protoc() {
|
|
19
|
+
param(
|
|
20
|
+
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'The PHP version to be installed')]
|
|
21
|
+
[ValidatePattern('^latest$|^(v?)\d+\.\d+\.\d+$')]
|
|
22
|
+
[string] $protobuf_tag
|
|
23
|
+
)
|
|
24
|
+
$protobuf_tag = Get-ProtobufTag
|
|
25
|
+
$arch_num = '64'
|
|
26
|
+
if(-not([Environment]::Is64BitOperatingSystem)) {
|
|
27
|
+
$arch_num = '32'
|
|
28
|
+
}
|
|
29
|
+
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
|
30
|
+
Invoke-WebRequest -Uri $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
|
31
|
+
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
|
32
|
+
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
|
33
|
+
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
|
34
|
+
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
|
35
|
+
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
|
36
|
+
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
|
37
|
+
Write-Output "$env:END_GROUP"
|
|
38
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
get_protobuf_tag() {
|
|
2
|
-
if [ "$protobuf_tag" = "latest" ]; then
|
|
3
|
-
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
|
4
|
-
else
|
|
5
|
-
status_code=$(get -v -n /tmp/protobuf.tmp "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
|
6
|
-
if [ "$status_code" = "200" ]; then
|
|
7
|
-
protobuf_tag="v$protobuf_tag"
|
|
8
|
-
else
|
|
9
|
-
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
|
10
|
-
fi
|
|
11
|
-
fi
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
add_protoc() {
|
|
15
|
-
protobuf_tag=$1
|
|
16
|
-
get_protobuf_tag
|
|
17
|
-
(
|
|
18
|
-
platform='linux'
|
|
19
|
-
[ "$(uname -s)" = "Darwin" ] && platform='osx'
|
|
20
|
-
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip"
|
|
21
|
-
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
|
22
|
-
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
|
23
|
-
) >/dev/null 2>&1
|
|
24
|
-
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
|
25
|
-
printf "
|
|
26
|
-
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
|
27
|
-
echo "
|
|
28
|
-
}
|
|
1
|
+
get_protobuf_tag() {
|
|
2
|
+
if [ "$protobuf_tag" = "latest" ]; then
|
|
3
|
+
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
|
4
|
+
else
|
|
5
|
+
status_code=$(get -v -n /tmp/protobuf.tmp "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
|
6
|
+
if [ "$status_code" = "200" ]; then
|
|
7
|
+
protobuf_tag="v$protobuf_tag"
|
|
8
|
+
else
|
|
9
|
+
protobuf_tag=$(get -s -n "" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)" | head -n 1)
|
|
10
|
+
fi
|
|
11
|
+
fi
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
add_protoc() {
|
|
15
|
+
protobuf_tag=$1
|
|
16
|
+
get_protobuf_tag
|
|
17
|
+
(
|
|
18
|
+
platform='linux'
|
|
19
|
+
[ "$(uname -s)" = "Darwin" ] && platform='osx'
|
|
20
|
+
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip"
|
|
21
|
+
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
|
22
|
+
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
|
23
|
+
) >/dev/null 2>&1
|
|
24
|
+
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
|
25
|
+
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
|
26
|
+
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
|
27
|
+
echo "$END_GROUP"
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Function Add-Symfony() {
|
|
2
|
+
$arch_name ='amd64'
|
|
3
|
+
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
|
4
|
+
$arch_name = '386'
|
|
5
|
+
}
|
|
6
|
+
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
|
7
|
+
Invoke-WebRequest -Uri $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
|
8
|
+
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
9
|
+
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe >$null 2>&1
|
|
10
|
+
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
|
11
|
+
Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
|
12
|
+
$tool_version = Get-ToolVersion symfony "-V"
|
|
13
|
+
Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
add_symfony() {
|
|
2
|
+
if [ "$(uname -s)" = "Linux" ]; then
|
|
3
|
+
echo 'deb [trusted=yes] https://repo.symfony.com/apt/ /' | sudo tee /etc/apt/sources.list.d/symfony-cli.list >/dev/null 2>&1
|
|
4
|
+
update_lists symfony repo.symfony.com
|
|
5
|
+
install_packages symfony-cli
|
|
6
|
+
elif [ "$(uname -s)" = "Darwin" ]; then
|
|
7
|
+
add_brew_tap symfony-cli/homebrew-tap
|
|
8
|
+
brew install symfony-cli/tap/symfony-cli >/dev/null 2>&1
|
|
9
|
+
fi
|
|
10
|
+
sudo ln -s "$(command -v symfony)" "${tool_path_dir:?}"/symfony-cli
|
|
11
|
+
tool_version=$(get_tool_version "symfony" "-V")
|
|
12
|
+
add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
|
|
13
|
+
}
|