-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-deb.sh
41 lines (29 loc) · 1.18 KB
/
build-deb.sh
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
#!/bin/bash
echo "start build EzeTranslate debian package"
echo ""
go build EzeTranslate.go
echo "build EzeTranslate success"
echo ""
# 执行 ./EzeTranslate -v, 获取一个版本号 VER_CODE
VER_CODE=$("./EzeTranslate" -v)
echo "Version Code: $VER_CODE"
# 获取当前时间,格式为 yy/MM/dd_HH_mm_ss
CURRENT_TIME=$(date +"%y%m%d%H%M%S")
echo "Current Time: $CURRENT_TIME"
# 创建文件夹 ./build-target/deb/VER_CODE_{yy/MM/dd_HH_mm_ss}/EzeTranslate-deb
TARGET_DIR="./build-target/deb/${VER_CODE}_${CURRENT_TIME}"
mkdir -p "$TARGET_DIR"
echo "target build path: $TARGET_DIR"
echo ""
# 复制 deb-build-tpl 到 $TARGET_DIR/EzeTranslate-deb 里面
# 复制 EzeTranslate, config.yaml, res-static/ 到 $TARGET_DIR/EzeTranslate-deb/opt/EzeTranslate/ 里
cp -r "./deb-build-tpl" "$TARGET_DIR/eze-translate-${VER_CODE}"
mkdir -p "$TARGET_DIR/eze-translate-$VER_CODE/opt/EzeTranslate"
cp -r "./EzeTranslate" "./res-static" "$TARGET_DIR/eze-translate-${VER_CODE}/opt/EzeTranslate"
# 开始 build deb
cd "$TARGET_DIR"
echo "start build debian package in $TARGET_DIR ..."
echo ""
dpkg-deb --build eze-translate-${VER_CODE}
echo ""
echo "build success, target deb file: $TARGET_DIR/eze-translate.deb"