mirror of
https://gitee.com/amber-ce/amber-ce-bookworm.git
synced 2025-06-05 14:49:51 +08:00
build-pkg.sh
This commit is contained in:
parent
8eca27e209
commit
3d88f051ce
43
build-pkg.sh
Executable file
43
build-pkg.sh
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 安全读取配置文件的推荐方式
|
||||||
|
read_config() {
|
||||||
|
local config_file="$1"
|
||||||
|
|
||||||
|
# 检查文件是否存在
|
||||||
|
if [ ! -f "$config_file" ]; then
|
||||||
|
echo "Error: Config file $config_file not found" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 处理并加载配置
|
||||||
|
source <(
|
||||||
|
sed -nE '
|
||||||
|
# 跳过注释和空行
|
||||||
|
/^[[:space:]]*#/d # 删除注释行
|
||||||
|
/^[[:space:]]*$/d # 删除空行
|
||||||
|
# 转换 @VAR@=value 格式
|
||||||
|
s/^@([^@]+)@=(.*)$/\1=\2/p
|
||||||
|
' "$config_file"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
read_config "ace-base.config"
|
||||||
|
|
||||||
|
# 访问变量
|
||||||
|
echo "Package Name: $PKG_NAME"
|
||||||
|
echo "Host Name: $HOST_NAME"
|
||||||
|
echo "Executable Name: $EXEC_NAME"
|
||||||
|
echo "Pretty Name: $PRETTY_NAME"
|
||||||
|
|
||||||
|
if [[ -z "$1" ]];then
|
||||||
|
echo "Need TARGET DIR"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
target_dir="${1}" # 要处理的目标目录
|
||||||
|
|
||||||
|
rm -rf ${target_dir}/
|
||||||
|
cp -r src/ ${target_dir}/
|
||||||
|
bash replacer.sh ${target_dir}/
|
||||||
|
cd pkg/opt/apps/$PKG_NAME/files && bash build-container.sh $(shell uname -m)
|
||||||
|
bash linker.sh ${target_dir}/
|
6
debian/rules
vendored
6
debian/rules
vendored
@ -6,11 +6,7 @@
|
|||||||
dh $@
|
dh $@
|
||||||
|
|
||||||
override_dh_auto_configure:
|
override_dh_auto_configure:
|
||||||
rm -rf pkg/
|
bash build-pkg.sh pkg/
|
||||||
cp -r src/ pkg/
|
|
||||||
bash replacer.sh pkg/
|
|
||||||
cd pkg/opt/apps/amber-ce-bookworm/files && bash build-container.sh $(shell uname -m)
|
|
||||||
bash linker.sh pkg/
|
|
||||||
|
|
||||||
override_dh_dwz:
|
override_dh_dwz:
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ read_config() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# 使用示例
|
|
||||||
read_config "ace-base.config"
|
read_config "ace-base.config"
|
||||||
|
|
||||||
# 访问变量
|
# 访问变量
|
||||||
|
Loading…
x
Reference in New Issue
Block a user