-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminify.sh
More file actions
executable file
·38 lines (28 loc) · 955 Bytes
/
Copy pathminify.sh
File metadata and controls
executable file
·38 lines (28 loc) · 955 Bytes
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
#!/usr/bin/env bash
set -e
OS=$TARGETOS
OSArch=$(dpkg --print-architecture)
ORIGIN="https://github.com"
if [ "$IS_LOCAL" != "" ]; then
echo "Building in local"
# 修改镜像源为阿里云
sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources
fi
case "$OSArch" in
ppc64el) OSArch="powerpc64le" ;;
armhf) OSArch="arm" ;;
esac
if [ "$OS" = "darwin" ]; then
exit 0
fi
apt-get update
apt-get install -y --no-install-recommends tar xz-utils
UPXVersion=$(wget -qO- -t1 -T2 "$ORIGIN/upx/upx/releases" | grep -oP 'UPX \K([0-9]+\.[0-9]+\.[0-9]+)' | head -n 1)
upxFileName="upx-${UPXVersion}-${OSArch}_${OS}"
upxDownloadUrl="$ORIGIN/upx/upx/releases/download/v${UPXVersion}/${upxFileName}.tar.xz"
if [ ! -f "./upx/$upxFileName/upx" ]; then
mkdir -p ./upx
wget $upxDownloadUrl -O ./upx/upx.tar.xz
tar -xvf ./upx/upx.tar.xz -C ./upx
fi
./upx/$upxFileName/upx --best /app/serve