This repository was archived by the owner on Oct 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathupdate-gcs.sh
More file actions
executable file
·67 lines (48 loc) · 1.96 KB
/
update-gcs.sh
File metadata and controls
executable file
·67 lines (48 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
#!/bin/bash
set -e
DIR="$( dirname "${BASH_SOURCE[0]}" )"
if [ -z "${DEB_TMP_DIR}" ]; then
DEB_TMP_DIR='/tmp/php-build'
fi
if [ -z "${GCP_PACKAGE_BUCKET}" ]; then
GCP_PACKAGE_BUCKET='gcp-php-packages'
fi
if [ -z "${DEBIAN_GCS_PATH}" ]; then
DEBIAN_GCS_PATH='gs://php-mvm-a/packages'
fi
if [ -z "${UBUNTU_GCS_PATH}" ]; then
UBUNTU_GCS_PATH='gs://php-mvm-a/ubuntu-packages'
fi
if [ "${1}" == "debian" ]; then
GCS_PATH=${DEBIAN_GCS_PATH}
TARGET_DIR=${DEB_TMP_DIR}/debian
GCS_DESTINATION='gcp-php-runtime-jessie'
else
GCS_PATH=${UBUNTU_GCS_PATH}
TARGET_DIR=${DEB_TMP_DIR}/ubuntu
GCS_DESTINATION='gcp-php-runtime-bionic'
fi
mkdir -p ${TARGET_DIR}
PHP_VERSIONS=`sed -n '/PHP_VERSIONS/{n;p;}' "${DIR}/ubuntu-packages.cfg" | grep -o '".*"' | sed 's/"//g'`
IFS=',' read -ra VERSIONS <<< "${PHP_VERSIONS}"
echo 'Downloading deb packages'
echo '============================================='
for v in "${VERSIONS[@]}"; do
gsutil -m cp "${GCS_PATH}/${v}/*.deb" $TARGET_DIR
done
gsutil -m cp "${GCS_PATH}/libraries/*.deb" $TARGET_DIR
echo 'Dedupping deb packages'
echo '============================================='
#php /google/data/ro/teams/php-cloud/php-debian-package-dedup/dedup.php "${1}"
# We're going to mirror rapture's naming scheme to make the switch to GCS as
# seamless as possible.
#gsutil -m rm -r gs://${GCP_PACKAGE_BUCKET}/${GCS_DESTINATION}
#gsutil -m rm -r gs://${GCP_PACKAGE_BUCKET}/${GCS_DESTINATION}-unstable
gsutil -m cp ${TARGET_DIR}/*.deb gs://${GCP_PACKAGE_BUCKET}/${GCS_DESTINATION}
gsutil -m cp ${TARGET_DIR}/*.deb gs://${GCP_PACKAGE_BUCKET}/${GCS_DESTINATION}-unstable
readonly RUNTIME_DIST="${GCS_DESTINATION}-$(date +%Y%m%d-1)"
gsutil -m cp ${TARGET_DIR}/*.deb "gs://${GCP_PACKAGE_BUCKET}/${RUNTIME_DIST}"
echo ""
echo "-----------------------------------------------------------------------"
echo "New RUNTIME_DISTRIBUTION value: ${RUNTIME_DIST}"
echo "-----------------------------------------------------------------------"