frp/package.sh

68 lines
1.7 KiB
Bash
Raw Normal View History

2024-03-12 11:07:55 +01:00
#!/bin/sh
set -e
2016-04-11 11:27:14 +02:00
# compile for version
2020-04-02 19:24:37 +02:00
make
2016-04-11 11:27:14 +02:00
if [ $? -ne 0 ]; then
echo "make error"
exit 1
fi
frp_version=`./bin/frps --version`
echo "build version: $frp_version"
# cross_compiles
2020-04-02 19:24:37 +02:00
make -f ./Makefile.cross-compiles
2016-04-11 11:27:14 +02:00
2020-04-02 18:59:47 +02:00
rm -rf ./release/packages
mkdir -p ./release/packages
2016-04-11 11:27:14 +02:00
2024-03-21 12:38:18 +01:00
os_all='linux windows darwin freebsd android'
2022-08-23 04:10:04 +02:00
arch_all='386 amd64 arm arm64 mips64 mips64le mips mipsle riscv64'
2016-04-11 11:27:14 +02:00
2020-04-02 18:59:47 +02:00
cd ./release
2016-04-11 11:27:14 +02:00
for os in $os_all; do
for arch in $arch_all; do
frp_dir_name="frp_${frp_version}_${os}_${arch}"
frp_path="./packages/frp_${frp_version}_${os}_${arch}"
2016-05-15 07:30:14 +02:00
2016-04-11 11:27:14 +02:00
if [ "x${os}" = x"windows" ]; then
2016-05-15 07:30:14 +02:00
if [ ! -f "./frpc_${os}_${arch}.exe" ]; then
continue
fi
if [ ! -f "./frps_${os}_${arch}.exe" ]; then
continue
fi
mkdir ${frp_path}
2016-04-11 11:27:14 +02:00
mv ./frpc_${os}_${arch}.exe ${frp_path}/frpc.exe
mv ./frps_${os}_${arch}.exe ${frp_path}/frps.exe
else
2016-05-15 07:30:14 +02:00
if [ ! -f "./frpc_${os}_${arch}" ]; then
continue
fi
if [ ! -f "./frps_${os}_${arch}" ]; then
continue
fi
mkdir ${frp_path}
2016-04-11 11:27:14 +02:00
mv ./frpc_${os}_${arch} ${frp_path}/frpc
mv ./frps_${os}_${arch} ${frp_path}/frps
fi
2020-04-02 18:59:47 +02:00
cp ../LICENSE ${frp_path}
cp -f ../conf/frpc.toml ${frp_path}
cp -f ../conf/frps.toml ${frp_path}
2016-04-11 11:27:14 +02:00
# packages
cd ./packages
if [ "x${os}" = x"windows" ]; then
zip -rq ${frp_dir_name}.zip ${frp_dir_name}
else
tar -zcf ${frp_dir_name}.tar.gz ${frp_dir_name}
fi
cd ..
rm -rf ${frp_path}
done
done
2020-04-02 18:59:47 +02:00
cd -