Merge pull request #336 from Tlntin/master
Fix the problem that batch packaging fails after changing url/package name information.(Linux/Mac)
This commit is contained in:
86
script/build.sh
vendored
86
script/build.sh
vendored
@@ -23,16 +23,17 @@ if [[ "$OSTYPE" =~ ^darwin ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
SHELL_FOLDER=$(cd "$(dirname "$0")" || exit 1; pwd)
|
SHELL_FOLDER=$(cd "$(dirname "$0")" || exit 1; pwd)
|
||||||
|
PROJECT_FOLDER=`dirname ${SHELL_FOLDER}`
|
||||||
|
echo "shell folder is ${SHELL_FOLDER}"
|
||||||
|
echo "project folder is ${PROJECT_FOLDER}"
|
||||||
|
|
||||||
# total app number, ignore first line
|
# total app number, ignore first line
|
||||||
total=$(sed -n '$=' app.csv)
|
total=$(sed -n '$=' app.csv)
|
||||||
export total=$((total-1))
|
export total=$((total-1))
|
||||||
export index=1
|
export index=1
|
||||||
|
|
||||||
export old_name="weread"
|
|
||||||
export old_title="WeRead"
|
|
||||||
export old_zh_name="微信阅读"
|
|
||||||
export old_url="https://weread.qq.com/"
|
|
||||||
export package_prefix="com-tw93"
|
export package_prefix="com-tw93"
|
||||||
|
export identifier_prefix="com.tw93"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -42,10 +43,7 @@ if [[ "$OSTYPE" =~ ^linux ]]; then
|
|||||||
echo "==============="
|
echo "==============="
|
||||||
export sd=${SHELL_FOLDER}/sd-linux-`arch`
|
export sd=${SHELL_FOLDER}/sd-linux-`arch`
|
||||||
chmod +x "$sd"
|
chmod +x "$sd"
|
||||||
# for linux, package name may be com.xxx.xxx
|
export desktop_file="src-tauri/assets/*.desktop"
|
||||||
echo "rename package name"
|
|
||||||
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
|
|
||||||
$sd "\"productName\": \"WeRead\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
@@ -55,8 +53,6 @@ if [[ "$OSTYPE" =~ ^darwin ]]; then
|
|||||||
|
|
||||||
export sd=${SHELL_FOLDER}/sd-apple-x64
|
export sd=${SHELL_FOLDER}/sd-apple-x64
|
||||||
chmod +x "$sd"
|
chmod +x "$sd"
|
||||||
echo "rename package name"
|
|
||||||
$sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tail -n +2 app.csv | while IFS=, read -r -a arr;
|
tail -n +2 app.csv | while IFS=, read -r -a arr;
|
||||||
@@ -65,11 +61,12 @@ do
|
|||||||
package_title=${arr[1]}
|
package_title=${arr[1]}
|
||||||
package_zh_name=${arr[2]}
|
package_zh_name=${arr[2]}
|
||||||
url=${arr[3]}
|
url=${arr[3]}
|
||||||
|
|
||||||
# replace package info
|
# replace package info
|
||||||
$sd -s "${old_url}" "${url}" src-tauri/tauri.conf.json
|
# clear url with regex
|
||||||
$sd -s "${old_name}" "${package_name}" src-tauri/tauri.conf.json
|
$sd "\"url\": \"(.*?)\"," "\"url\": \"\"," src-tauri/tauri.conf.json
|
||||||
# echo "update ico with 32x32 picture"
|
# replace url with no regex
|
||||||
# $sd "${old_name}" "${package_name}" src-tauri/src/main.rs
|
$sd -s "\"url\": \"\"," "\"url\": \"${url}\"," src-tauri/tauri.conf.json
|
||||||
|
|
||||||
# for apple, need replace title
|
# for apple, need replace title
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
@@ -82,8 +79,18 @@ do
|
|||||||
echo "warning"
|
echo "warning"
|
||||||
cp "src-tauri/icons/icon.icns" "src-tauri/icons/${package_name}.icns"
|
cp "src-tauri/icons/icon.icns" "src-tauri/icons/${package_name}.icns"
|
||||||
fi
|
fi
|
||||||
$sd -s "${old_name}" "${package_name}" src-tauri/tauri.macos.conf.json
|
# clear package_name with regex
|
||||||
$sd -s "${old_title}" "${package_title}" src-tauri/tauri.conf.json
|
$sd "\"productName\": \"(.*?)\"," "\"productName\": \"\"," src-tauri/tauri.conf.json
|
||||||
|
# replace package_name with no regex
|
||||||
|
$sd -s "\"productName\": \"\"," "\"productName\": \"${package_title}\"," src-tauri/tauri.conf.json
|
||||||
|
# clear icon path with regex
|
||||||
|
$sd "\"icon\": \[\"(.*?)\"\]," "\"icon\": [\"\"]," src-tauri/tauri.macos.conf.json
|
||||||
|
# replace icon path with no regex
|
||||||
|
$sd -s "\"icon\": [\"\"]," "\"icon\": [\"icons/${package_name}.icns\"]," src-tauri/tauri.macos.conf.json
|
||||||
|
# clear identifier with regex
|
||||||
|
$sd "\"identifier\": \"(.*?)\"," "\"identifier\": \"\"," src-tauri/tauri.macos.conf.json
|
||||||
|
# replace identifier with not regex
|
||||||
|
$sd -s "\"identifier\": \"\"," "\"identifier\": \"${identifier_prefix}.${package_name}\"," src-tauri/tauri.macos.conf.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echo "update ico with 32x32 picture"
|
# echo "update ico with 32x32 picture"
|
||||||
@@ -97,23 +104,44 @@ do
|
|||||||
echo "warning"
|
echo "warning"
|
||||||
echo "icon for linux not exist, will use default icon to replace it"
|
echo "icon for linux not exist, will use default icon to replace it"
|
||||||
echo "warning"
|
echo "warning"
|
||||||
cp "src-tauri/png/icon_256.ico" "src-tauri/png/${package_name}_256.ico"
|
|
||||||
cp "src-tauri/png/icon_512.png" "src-tauri/png/${package_name}_512.png"
|
cp "src-tauri/png/icon_512.png" "src-tauri/png/${package_name}_512.png"
|
||||||
fi
|
fi
|
||||||
$sd "${old_name}" "${package_name}" src-tauri/tauri.linux.conf.json
|
# clear package_name with regex
|
||||||
|
$sd "\"productName\": \"(.*?)\"," "\"productName\": \"\"," src-tauri/tauri.conf.json
|
||||||
|
# replace package_name with no regex
|
||||||
|
$sd -s "\"productName\": \"\"," "\"productName\": \"${package_prefix}-${package_name}\"," src-tauri/tauri.conf.json
|
||||||
|
# clear icon path with regex
|
||||||
|
$sd "\"icon\": \[\"(.*?)\"\]," "\"icon\": [\"\"]," src-tauri/tauri.linux.conf.json
|
||||||
|
# replace icon path with no regex
|
||||||
|
$sd -s "\"icon\": [\"\"]," "\"icon\": [\"png/${package_name}_512.png\"]," src-tauri/tauri.linux.conf.json
|
||||||
|
# clear identifier with regex
|
||||||
|
$sd "\"identifier\": \"(.*?)\"," "\"identifier\": \"\"," src-tauri/tauri.linux.conf.json
|
||||||
|
# replace identifier with not regex
|
||||||
|
$sd -s "\"identifier\": \"\"," "\"identifier\": \"${identifier_prefix}.${package_name}\"," src-tauri/tauri.linux.conf.json
|
||||||
echo "update desktop"
|
echo "update desktop"
|
||||||
old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop"
|
|
||||||
new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
|
||||||
mv "${old_desktop}" "${new_desktop}"
|
|
||||||
$sd -s "${old_zh_name}" "${package_zh_name}" "${new_desktop}"
|
|
||||||
$sd -s "${old_name}" "${package_name}" "${new_desktop}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# update package info
|
new_desktop="${PROJECT_FOLDER}/src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
||||||
old_name=${package_name}
|
new_desktop_map_path="/usr/share/applications/${package_prefix}-${package_name}.desktop"
|
||||||
old_title=${package_title}
|
for file in `ls ${PROJECT_FOLDER}/src-tauri/assets/`
|
||||||
old_zh_name=${package_zh_name}
|
do
|
||||||
old_url=${url}
|
mv "${PROJECT_FOLDER}/src-tauri/assets/${file}" "${new_desktop}"
|
||||||
|
echo mv "${PROJECT_FOLDER}/src-tauri/assets/${file}" "${new_desktop}"
|
||||||
|
done
|
||||||
|
# clear desktop file with regex
|
||||||
|
$sd "\"files\": \{\"(.*)\"\}" "\"files\": \{\"\"\}" src-tauri/tauri.linux.conf.json
|
||||||
|
# replace desktop file with no regex
|
||||||
|
$sd -s "\"files\": \{\"\"\}" "\"files\": {\"${new_desktop_map_path}\": \"${new_desktop}\"}" src-tauri/tauri.linux.conf.json
|
||||||
|
# clear desktop content with regex
|
||||||
|
$sd "Exec=.*" "Exec=" "${new_desktop}"
|
||||||
|
$sd "Icon=.*" "Icon=" "${new_desktop}"
|
||||||
|
$sd "Name=.*" "Name=" "${new_desktop}"
|
||||||
|
$sd "Name\[zh_CN\]=.*" "Name[zh_CN]=" "${new_desktop}"
|
||||||
|
# repleace dekstop content with no reg
|
||||||
|
$sd -s "Exec=" "Exec=${package_prefix}-${package_name}" "${new_desktop}"
|
||||||
|
$sd -s "Icon=" "Icon=${package_prefix}-${package_name}" "${new_desktop}"
|
||||||
|
$sd -s "Name=" "Name=${package_title}" "${new_desktop}"
|
||||||
|
$sd -s "Name[zh_CN]=" "Name[zh_CN]=${package_zh_name}" "${new_desktop}"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "building package ${index}/${total}"
|
echo "building package ${index}/${total}"
|
||||||
echo "package name is ${package_name} (${package_zh_name})"
|
echo "package name is ${package_name} (${package_zh_name})"
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"icon": [
|
"icon": ["png/weread_512.png"],
|
||||||
"png/weread_256.ico",
|
|
||||||
"png/weread_512.png"
|
|
||||||
],
|
|
||||||
"identifier": "com.tw93.weread",
|
"identifier": "com.tw93.weread",
|
||||||
"active": true,
|
"active": true,
|
||||||
"category": "DeveloperTool",
|
"category": "DeveloperTool",
|
||||||
@@ -22,9 +19,7 @@
|
|||||||
"gnome-video-effects",
|
"gnome-video-effects",
|
||||||
"gnome-video-effects-extra"
|
"gnome-video-effects-extra"
|
||||||
],
|
],
|
||||||
"files": {
|
"files": {"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"}
|
||||||
"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"externalBin": [],
|
"externalBin": [],
|
||||||
"longDescription": "",
|
"longDescription": "",
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"icon": [
|
"icon": ["icons/weread.icns"],
|
||||||
"icons/weread.icns"
|
|
||||||
],
|
|
||||||
"identifier": "com.tw93.weread",
|
"identifier": "com.tw93.weread",
|
||||||
"active": true,
|
"active": true,
|
||||||
"category": "DeveloperTool",
|
"category": "DeveloperTool",
|
||||||
|
|||||||
Reference in New Issue
Block a user